Index: test/cctest/interpreter/test-bytecode-generator.cc |
diff --git a/test/cctest/interpreter/test-bytecode-generator.cc b/test/cctest/interpreter/test-bytecode-generator.cc |
index 6e56266abcefe72b73751cfbede767f240c6f670..68dab0ec68ad6cbdc71a1debe9b4d2658e542647 100644 |
--- a/test/cctest/interpreter/test-bytecode-generator.cc |
+++ b/test/cctest/interpreter/test-bytecode-generator.cc |
@@ -4774,71 +4774,73 @@ TEST(ForIn) { |
2, |
{B(LdaUndefined), B(Return)}, |
0}, |
+ {"for (var p in undefined) {}", |
+ 2 * kPointerSize, |
+ 1, |
+ 2, |
+ {B(LdaUndefined), B(Return)}, |
+ 0}, |
{"var x = 'potatoes';\n" |
"for (var p in x) { return p; }", |
- 5 * kPointerSize, |
+ 8 * kPointerSize, |
1, |
- 46, |
+ 45, |
{ |
- B(LdaConstant), U8(0), // |
- B(Star), R(1), // |
- B(JumpIfUndefined), U8(40), // |
- B(JumpIfNull), U8(38), // |
- B(ToObject), // |
- B(Star), R(3), // |
- B(CallRuntime), U16(Runtime::kGetPropertyNamesFast), R(3), U8(1), // |
- B(ForInPrepare), R(3), // |
- B(JumpIfUndefined), U8(26), // |
- B(Star), R(4), // |
- B(LdaZero), // |
- B(Star), R(3), // |
- B(ForInDone), R(4), // |
- B(JumpIfTrue), U8(17), // |
- B(ForInNext), R(4), R(3), // |
- B(JumpIfUndefined), U8(7), // |
- B(Star), R(0), // |
- B(Star), R(2), // |
- B(Return), // |
- B(Ldar), R(3), // |
- B(Inc), // |
- B(Jump), U8(-19), // |
- B(LdaUndefined), // |
- B(Return), // |
+ B(LdaConstant), U8(0), // |
+ B(Star), R(1), // |
+ B(JumpIfUndefined), U8(39), // |
+ B(JumpIfNull), U8(37), // |
+ B(ToObject), // |
+ B(JumpIfNull), U8(34), // |
+ B(Star), R(3), // |
+ B(ForInPrepare), R(4), R(5), R(6), // |
+ B(LdaZero), // |
+ B(Star), R(7), // |
+ B(ForInDone), R(7), R(6), // |
+ B(JumpIfTrue), U8(20), // |
+ B(ForInNext), R(3), R(4), R(5), R(7), // |
+ B(JumpIfUndefined), U8(7), // |
+ B(Star), R(0), // |
+ B(Star), R(2), // |
+ B(Return), // |
+ B(ForInStep), R(7), // |
+ B(Star), R(7), // |
+ B(Jump), U8(-21), // |
+ B(LdaUndefined), // |
+ B(Return), // |
}, |
1, |
{InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE}}, |
{"var x = 0;\n" |
"for (var p in [1,2,3]) { x += p; }", |
- 5 * kPointerSize, |
+ 8 * kPointerSize, |
1, |
- 52, |
+ 51, |
{ |
- B(LdaZero), // |
- B(Star), R(1), // |
- B(CreateArrayLiteral), U8(0), U8(0), U8(simple_flags), // |
- B(JumpIfUndefined), U8(43), // |
- B(JumpIfNull), U8(41), // |
- B(ToObject), // |
- B(Star), R(3), // |
- B(CallRuntime), U16(Runtime::kGetPropertyNamesFast), R(3), U8(1), // |
- B(ForInPrepare), R(3), // |
- B(JumpIfUndefined), U8(29), // |
- B(Star), R(4), // |
- B(LdaZero), // |
- B(Star), R(3), // |
- B(ForInDone), R(4), // |
- B(JumpIfTrue), U8(20), // |
- B(ForInNext), R(4), R(3), // |
- B(JumpIfUndefined), U8(10), // |
- B(Star), R(0), // |
- B(Star), R(2), // |
- B(Add), R(1), // |
- B(Star), R(1), // |
- B(Ldar), R(3), // |
- B(Inc), // |
- B(Jump), U8(-22), // |
- B(LdaUndefined), // |
- B(Return), // |
+ B(LdaZero), // |
+ B(Star), R(1), // |
+ B(CreateArrayLiteral), U8(0), U8(0), U8(3), // |
+ B(JumpIfUndefined), U8(42), // |
+ B(JumpIfNull), U8(40), // |
+ B(ToObject), // |
+ B(JumpIfNull), U8(37), // |
+ B(Star), R(3), // |
+ B(ForInPrepare), R(4), R(5), R(6), // |
+ B(LdaZero), // |
+ B(Star), R(7), // |
+ B(ForInDone), R(7), R(6), // |
+ B(JumpIfTrue), U8(23), // |
+ B(ForInNext), R(3), R(4), R(5), R(7), // |
+ B(JumpIfUndefined), U8(10), // |
+ B(Star), R(0), // |
+ B(Star), R(2), // |
+ B(Add), R(1), // |
+ B(Star), R(1), // |
+ B(ForInStep), R(7), // |
+ B(Star), R(7), // |
+ B(Jump), U8(-24), // |
+ B(LdaUndefined), // |
+ B(Return), // |
}, |
1, |
{InstanceType::FIXED_ARRAY_TYPE}}, |
@@ -4847,86 +4849,82 @@ TEST(ForIn) { |
" if (x['a'] == 10) continue;\n" |
" if (x['a'] == 20) break;\n" |
"}", |
- 4 * kPointerSize, |
+ 7 * kPointerSize, |
1, |
- 81, |
+ 80, |
{ |
- B(CreateObjectLiteral), U8(0), U8(0), U8(deep_elements_flags), // |
- B(Star), R(0), // |
- B(CreateArrayLiteral), U8(1), U8(1), U8(simple_flags), // |
- B(JumpIfUndefined), U8(69), // |
- B(JumpIfNull), U8(67), // |
- B(ToObject), // |
- B(Star), R(1), // |
- B(CallRuntime), U16(Runtime::kGetPropertyNamesFast), R(1), U8(1), // |
- B(ForInPrepare), R(1), // |
- B(JumpIfUndefined), U8(55), // |
- B(Star), R(2), // |
- B(LdaZero), // |
- B(Star), R(1), // |
- B(ForInDone), R(2), // |
- B(JumpIfTrue), U8(46), // |
- B(ForInNext), R(2), R(1), // |
- B(JumpIfUndefined), U8(36), // |
- B(Star), R(3), // |
- B(StoreICSloppy), R(0), U8(2), U8(vector->GetIndex(slot4)), // |
- B(LoadICSloppy), R(0), U8(2), U8(vector->GetIndex(slot2)), // |
- B(Star), R(3), // |
- B(LdaSmi8), U8(10), // |
- B(TestEqual), R(3), // |
- B(JumpIfFalse), U8(4), // |
- B(Jump), U8(16), // |
- B(LoadICSloppy), R(0), U8(2), U8(vector->GetIndex(slot3)), // |
- B(Star), R(3), // |
- B(LdaSmi8), U8(20), // |
- B(TestEqual), R(3), // |
- B(JumpIfFalse), U8(4), // |
- B(Jump), U8(7), // |
- B(Ldar), R(1), // |
- B(Inc), // |
- B(Jump), U8(-48), // |
- B(LdaUndefined), // |
- B(Return), // |
+ B(CreateObjectLiteral), U8(0), U8(0), U8(deep_elements_flags), // |
+ B(Star), R(0), // |
+ B(CreateArrayLiteral), U8(1), U8(1), U8(simple_flags), // |
+ B(JumpIfUndefined), U8(68), // |
+ B(JumpIfNull), U8(66), // |
+ B(ToObject), // |
+ B(JumpIfNull), U8(63), // |
+ B(Star), R(1), // |
+ B(ForInPrepare), R(2), R(3), R(4), // |
+ B(LdaZero), // |
+ B(Star), R(5), // |
+ B(ForInDone), R(5), R(4), // |
+ B(JumpIfTrue), U8(49), // |
+ B(ForInNext), R(1), R(2), R(3), R(5), // |
+ B(JumpIfUndefined), U8(36), // |
+ B(Star), R(6), // |
+ B(StoreICSloppy), R(0), U8(2), U8(vector->GetIndex(slot4)), // |
+ B(LoadICSloppy), R(0), U8(2), U8(vector->GetIndex(slot2)), // |
+ B(Star), R(6), // |
+ B(LdaSmi8), U8(10), // |
+ B(TestEqual), R(6), // |
+ B(JumpIfFalse), U8(4), // |
+ B(Jump), U8(16), // |
+ B(LoadICSloppy), R(0), U8(2), U8(vector->GetIndex(slot3)), // |
+ B(Star), R(6), // |
+ B(LdaSmi8), U8(20), // |
+ B(TestEqual), R(6), // |
+ B(JumpIfFalse), U8(4), // |
+ B(Jump), U8(8), // |
+ B(ForInStep), R(5), // |
+ B(Star), R(5), // |
+ B(Jump), U8(-50), // |
+ B(LdaUndefined), // |
+ B(Return), // |
}, |
3, |
{InstanceType::FIXED_ARRAY_TYPE, InstanceType::FIXED_ARRAY_TYPE, |
InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE}}, |
{"var x = [ 10, 11, 12 ] ;\n" |
"for (x[0] in [1,2,3]) { return x[3]; }", |
- 5 * kPointerSize, |
+ 8 * kPointerSize, |
1, |
- 64, |
+ 63, |
{ |
- B(CreateArrayLiteral), U8(0), U8(0), U8(simple_flags), // |
- B(Star), R(0), // |
- B(CreateArrayLiteral), U8(1), U8(1), U8(simple_flags), // |
- B(JumpIfUndefined), U8(52), // |
- B(JumpIfNull), U8(50), // |
- B(ToObject), // |
- B(Star), R(1), // |
- B(CallRuntime), U16(Runtime::kGetPropertyNamesFast), R(1), U8(1), // |
- B(ForInPrepare), R(1), // |
- B(JumpIfUndefined), U8(38), // |
- B(Star), R(2), // |
- B(LdaZero), // |
- B(Star), R(1), // |
- B(ForInDone), R(2), // |
- B(JumpIfTrue), U8(29), // |
- B(ForInNext), R(2), R(1), // |
- B(JumpIfUndefined), U8(19), // |
- B(Star), R(3), // |
- B(LdaZero), // |
- B(Star), R(4), // |
- B(Ldar), R(3), // |
- B(KeyedStoreICSloppy), R(0), R(4), U8(vector->GetIndex(slot3)), // |
- B(LdaSmi8), U8(3), // |
- B(KeyedLoadICSloppy), R(0), U8(vector->GetIndex(slot2)), // |
- B(Return), // |
- B(Ldar), R(1), // |
- B(Inc), // |
- B(Jump), U8(-31), // |
- B(LdaUndefined), // |
- B(Return), // |
+ B(CreateArrayLiteral), U8(0), U8(0), U8(simple_flags), // |
+ B(Star), R(0), // |
+ B(CreateArrayLiteral), U8(1), U8(1), U8(simple_flags), // |
+ B(JumpIfUndefined), U8(51), // |
+ B(JumpIfNull), U8(49), // |
+ B(ToObject), // |
+ B(JumpIfNull), U8(46), // |
+ B(Star), R(1), // |
+ B(ForInPrepare), R(2), R(3), R(4), // |
+ B(LdaZero), // |
+ B(Star), R(5), // |
+ B(ForInDone), R(5), R(4), // |
+ B(JumpIfTrue), U8(32), // |
+ B(ForInNext), R(1), R(2), R(3), R(5), // |
+ B(JumpIfUndefined), U8(19), // |
+ B(Star), R(6), // |
+ B(LdaZero), // |
+ B(Star), R(7), // |
+ B(Ldar), R(6), // |
+ B(KeyedStoreICSloppy), R(0), R(7), U8(vector->GetIndex(slot3)), // |
+ B(LdaSmi8), U8(3), // |
+ B(KeyedLoadICSloppy), R(0), U8(vector->GetIndex(slot2)), // |
+ B(Return), // |
+ B(ForInStep), R(5), // |
+ B(Star), R(5), // |
+ B(Jump), U8(-33), // |
+ B(LdaUndefined), // |
+ B(Return), // |
}, |
2, |
{InstanceType::FIXED_ARRAY_TYPE, InstanceType::FIXED_ARRAY_TYPE}}, |