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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 .BinaryOperation(Token::Value::ADD, reg_0, 3) | 55 .BinaryOperation(Token::Value::ADD, reg_0, 3) |
56 .StoreAccumulatorInRegister(param) | 56 .StoreAccumulatorInRegister(param) |
57 .CallRuntimeForPair(Runtime::kLoadLookupSlotForCall, param, 1, reg_0) | 57 .CallRuntimeForPair(Runtime::kLoadLookupSlotForCall, param, 1, reg_0) |
58 .ForInPrepare(reg_0, reg_0) | 58 .ForInPrepare(reg_0, reg_0) |
59 .CallRuntime(Runtime::kLoadIC_Miss, reg_0, 1) | 59 .CallRuntime(Runtime::kLoadIC_Miss, reg_0, 1) |
60 .Debugger() | 60 .Debugger() |
61 .LoadGlobal(0x10000000, TypeofMode::NOT_INSIDE_TYPEOF) | 61 .LoadGlobal(0x10000000, TypeofMode::NOT_INSIDE_TYPEOF) |
62 .Return(); | 62 .Return(); |
63 | 63 |
64 // Test iterator sees the expected output from the builder. | 64 // Test iterator sees the expected output from the builder. |
65 BytecodeArrayIterator iterator(builder.ToBytecodeArray()); | 65 BytecodeArrayIterator iterator(builder.ToBytecodeArray(isolate())); |
66 const int kPrefixByteSize = 1; | 66 const int kPrefixByteSize = 1; |
67 int offset = 0; | 67 int offset = 0; |
68 | 68 |
69 CHECK_EQ(iterator.current_bytecode(), Bytecode::kLdaConstant); | 69 CHECK_EQ(iterator.current_bytecode(), Bytecode::kLdaConstant); |
70 CHECK_EQ(iterator.current_offset(), offset); | 70 CHECK_EQ(iterator.current_offset(), offset); |
71 CHECK_EQ(iterator.current_operand_scale(), OperandScale::kSingle); | 71 CHECK_EQ(iterator.current_operand_scale(), OperandScale::kSingle); |
72 CHECK(iterator.GetConstantForIndexOperand(0).is_identical_to(heap_num_0)); | 72 CHECK(iterator.GetConstantForIndexOperand(0).is_identical_to(heap_num_0)); |
73 CHECK(!iterator.done()); | 73 CHECK(!iterator.done()); |
74 offset += Bytecodes::Size(Bytecode::kLdaConstant, OperandScale::kSingle); | 74 offset += Bytecodes::Size(Bytecode::kLdaConstant, OperandScale::kSingle); |
75 iterator.Advance(); | 75 iterator.Advance(); |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 CHECK_EQ(iterator.current_offset(), offset); | 276 CHECK_EQ(iterator.current_offset(), offset); |
277 CHECK_EQ(iterator.current_operand_scale(), OperandScale::kSingle); | 277 CHECK_EQ(iterator.current_operand_scale(), OperandScale::kSingle); |
278 CHECK(!iterator.done()); | 278 CHECK(!iterator.done()); |
279 iterator.Advance(); | 279 iterator.Advance(); |
280 CHECK(iterator.done()); | 280 CHECK(iterator.done()); |
281 } | 281 } |
282 | 282 |
283 } // namespace interpreter | 283 } // namespace interpreter |
284 } // namespace internal | 284 } // namespace internal |
285 } // namespace v8 | 285 } // namespace v8 |
OLD | NEW |