[Interpreter] Fix cctest/test-bytecode-generator/IfConditions.

Avoid hard-coding expected parameter indices.  These depend on the
frame size which can vary (e.g. if embedded constant pools are
enabled).

R=oth@chromium.org, rmcilroy@chromium.org, michael_dawson@ca.ibm.com
BUG=

Review URL: https://codereview.chromium.org/1375373002

Cr-Commit-Position: refs/heads/master@{#31049}
This commit is contained in:
mbrandy 2015-10-01 06:33:10 -07:00 committed by Commit bot
parent 1d998bd0a6
commit 1ed17f2057

View File

@ -789,13 +789,13 @@ TEST(IfConditions) {
kPointerSize, kPointerSize,
2, 2,
19, 19,
{B(Ldar), R(-5), // {B(Ldar), R(helper.kLastParamIndex), //
B(Star), R(0), // B(Star), R(0), //
B(LdaZero), // B(LdaZero), //
B(TestLessThanOrEqual), R(0), // B(TestLessThanOrEqual), R(0), //
B(JumpIfFalse), U8(7), // B(JumpIfFalse), U8(7), //
B(LdaConstant), U8(0), // B(LdaConstant), U8(0), //
B(Return), // B(Return), //
B(Jump), U8(5), // TODO(oth): Unreachable jump after return B(Jump), U8(5), // TODO(oth): Unreachable jump after return
B(LdaConstant), U8(1), // B(LdaConstant), U8(1), //
B(Return), // B(Return), //
@ -809,16 +809,16 @@ TEST(IfConditions) {
kPointerSize, kPointerSize,
3, 3,
17, 17,
{B(Ldar), R(-6), // {B(Ldar), R(helper.kLastParamIndex - 1), //
B(Star), R(0), // B(Star), R(0), //
B(Ldar), R(-5), // B(Ldar), R(helper.kLastParamIndex), //
B(TestIn), R(0), // B(TestIn), R(0), //
B(JumpIfFalse), U8(7), // B(JumpIfFalse), U8(7), //
B(LdaConstant), U8(0), // B(LdaConstant), U8(0), //
B(Return), // B(Return), //
B(Jump), U8(2), // TODO(oth): Unreachable jump after return B(Jump), U8(2), // TODO(oth): Unreachable jump after return
B(LdaUndefined), // B(LdaUndefined), //
B(Return)}, // B(Return)}, //
1, 1,
{helper.factory()->NewNumberFromInt(200), unused, unused, unused}}, {helper.factory()->NewNumberFromInt(200), unused, unused, unused}},
{"function f(z) { var a = 0; var b = 0; if (a === 0.01) { " {"function f(z) { var a = 0; var b = 0; if (a === 0.01) { "
@ -871,14 +871,14 @@ TEST(IfConditions) {
3, 3,
122, 122,
{ {
#define IF_CONDITION_RETURN(condition) \ #define IF_CONDITION_RETURN(condition) \
B(Ldar), R(-6), \ B(Ldar), R(helper.kLastParamIndex - 1), \
B(Star), R(0), \ B(Star), R(0), \
B(Ldar), R(-5), \ B(Ldar), R(helper.kLastParamIndex), \
B(condition), R(0), \ B(condition), R(0), \
B(JumpIfFalse), U8(7), \ B(JumpIfFalse), U8(7), \
B(LdaSmi8), U8(1), \ B(LdaSmi8), U8(1), \
B(Return), \ B(Return), \
B(Jump), U8(2), B(Jump), U8(2),
IF_CONDITION_RETURN(TestEqual) // IF_CONDITION_RETURN(TestEqual) //
IF_CONDITION_RETURN(TestEqualStrict) // IF_CONDITION_RETURN(TestEqualStrict) //