| OLD | NEW | 
|---|
| 1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 the V8 project authors. All rights reserved. | 
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be | 
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. | 
| 4 | 4 | 
| 5 #include "src/v8.h" | 5 #include "src/v8.h" | 
| 6 | 6 | 
| 7 #include "src/interpreter/bytecode-array-builder.h" | 7 #include "src/interpreter/bytecode-array-builder.h" | 
| 8 #include "src/interpreter/bytecode-array-iterator.h" | 8 #include "src/interpreter/bytecode-array-iterator.h" | 
| 9 #include "test/unittests/test-utils.h" | 9 #include "test/unittests/test-utils.h" | 
| 10 | 10 | 
| (...skipping 24 matching lines...) Expand all  Loading... | 
| 35   Handle<String> name = factory->NewStringFromStaticChars("abc"); | 35   Handle<String> name = factory->NewStringFromStaticChars("abc"); | 
| 36   int name_index = 3; | 36   int name_index = 3; | 
| 37   int feedback_slot = 97; | 37   int feedback_slot = 97; | 
| 38 | 38 | 
| 39   builder.LoadLiteral(heap_num_0) | 39   builder.LoadLiteral(heap_num_0) | 
| 40       .LoadLiteral(heap_num_1) | 40       .LoadLiteral(heap_num_1) | 
| 41       .LoadLiteral(zero) | 41       .LoadLiteral(zero) | 
| 42       .LoadLiteral(smi_0) | 42       .LoadLiteral(smi_0) | 
| 43       .LoadLiteral(smi_1) | 43       .LoadLiteral(smi_1) | 
| 44       .LoadAccumulatorWithRegister(reg_0) | 44       .LoadAccumulatorWithRegister(reg_0) | 
| 45       .LoadNamedProperty(reg_1, name, feedback_slot, LanguageMode::SLOPPY) | 45       .LoadNamedProperty(reg_1, name, feedback_slot) | 
| 46       .StoreAccumulatorInRegister(reg_2) | 46       .StoreAccumulatorInRegister(reg_2) | 
| 47       .CallRuntime(Runtime::kLoadIC_Miss, reg_0, 1) | 47       .CallRuntime(Runtime::kLoadIC_Miss, reg_0, 1) | 
| 48       .Debugger() | 48       .Debugger() | 
| 49       .Return(); | 49       .Return(); | 
| 50 | 50 | 
| 51   // Test iterator sees the expected output from the builder. | 51   // Test iterator sees the expected output from the builder. | 
| 52   BytecodeArrayIterator iterator(builder.ToBytecodeArray()); | 52   BytecodeArrayIterator iterator(builder.ToBytecodeArray()); | 
| 53   CHECK_EQ(iterator.current_bytecode(), Bytecode::kLdaConstant); | 53   CHECK_EQ(iterator.current_bytecode(), Bytecode::kLdaConstant); | 
| 54   CHECK(iterator.GetConstantForIndexOperand(0).is_identical_to(heap_num_0)); | 54   CHECK(iterator.GetConstantForIndexOperand(0).is_identical_to(heap_num_0)); | 
| 55   CHECK(!iterator.done()); | 55   CHECK(!iterator.done()); | 
| (...skipping 16 matching lines...) Expand all  Loading... | 
| 72   CHECK_EQ(iterator.current_bytecode(), Bytecode::kLdaConstant); | 72   CHECK_EQ(iterator.current_bytecode(), Bytecode::kLdaConstant); | 
| 73   CHECK_EQ(*iterator.GetConstantForIndexOperand(0), smi_1); | 73   CHECK_EQ(*iterator.GetConstantForIndexOperand(0), smi_1); | 
| 74   CHECK(!iterator.done()); | 74   CHECK(!iterator.done()); | 
| 75   iterator.Advance(); | 75   iterator.Advance(); | 
| 76 | 76 | 
| 77   CHECK_EQ(iterator.current_bytecode(), Bytecode::kLdar); | 77   CHECK_EQ(iterator.current_bytecode(), Bytecode::kLdar); | 
| 78   CHECK_EQ(iterator.GetRegisterOperand(0).index(), reg_0.index()); | 78   CHECK_EQ(iterator.GetRegisterOperand(0).index(), reg_0.index()); | 
| 79   CHECK(!iterator.done()); | 79   CHECK(!iterator.done()); | 
| 80   iterator.Advance(); | 80   iterator.Advance(); | 
| 81 | 81 | 
| 82   CHECK_EQ(iterator.current_bytecode(), Bytecode::kLoadICSloppy); | 82   CHECK_EQ(iterator.current_bytecode(), Bytecode::kLoadIC); | 
| 83   CHECK_EQ(iterator.GetRegisterOperand(0).index(), reg_1.index()); | 83   CHECK_EQ(iterator.GetRegisterOperand(0).index(), reg_1.index()); | 
| 84   CHECK_EQ(iterator.GetIndexOperand(1), name_index); | 84   CHECK_EQ(iterator.GetIndexOperand(1), name_index); | 
| 85   CHECK_EQ(iterator.GetIndexOperand(2), feedback_slot); | 85   CHECK_EQ(iterator.GetIndexOperand(2), feedback_slot); | 
| 86   CHECK(!iterator.done()); | 86   CHECK(!iterator.done()); | 
| 87   iterator.Advance(); | 87   iterator.Advance(); | 
| 88 | 88 | 
| 89   CHECK_EQ(iterator.current_bytecode(), Bytecode::kStar); | 89   CHECK_EQ(iterator.current_bytecode(), Bytecode::kStar); | 
| 90   CHECK_EQ(iterator.GetRegisterOperand(0).index(), reg_2.index()); | 90   CHECK_EQ(iterator.GetRegisterOperand(0).index(), reg_2.index()); | 
| 91   CHECK(!iterator.done()); | 91   CHECK(!iterator.done()); | 
| 92   iterator.Advance(); | 92   iterator.Advance(); | 
| (...skipping 12 matching lines...) Expand all  Loading... | 
| 105 | 105 | 
| 106   CHECK_EQ(iterator.current_bytecode(), Bytecode::kReturn); | 106   CHECK_EQ(iterator.current_bytecode(), Bytecode::kReturn); | 
| 107   CHECK(!iterator.done()); | 107   CHECK(!iterator.done()); | 
| 108   iterator.Advance(); | 108   iterator.Advance(); | 
| 109   CHECK(iterator.done()); | 109   CHECK(iterator.done()); | 
| 110 } | 110 } | 
| 111 | 111 | 
| 112 }  // namespace interpreter | 112 }  // namespace interpreter | 
| 113 }  // namespace internal | 113 }  // namespace internal | 
| 114 }  // namespace v8 | 114 }  // namespace v8 | 
| OLD | NEW | 
|---|