OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 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-pipeline.h" | 7 #include "src/interpreter/bytecode-pipeline.h" |
8 #include "src/interpreter/bytecode-register-allocator.h" | 8 #include "src/interpreter/bytecode-register-allocator.h" |
9 #include "src/isolate.h" | 9 #include "src/isolate.h" |
10 #include "test/unittests/test-utils.h" | 10 #include "test/unittests/test-utils.h" |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 TEST_F(BytecodeNodeTest, Constructor2) { | 61 TEST_F(BytecodeNodeTest, Constructor2) { |
62 uint32_t operands[] = {0x11}; | 62 uint32_t operands[] = {0x11}; |
63 BytecodeNode node(Bytecode::kJumpIfTrue, operands[0]); | 63 BytecodeNode node(Bytecode::kJumpIfTrue, operands[0]); |
64 CHECK_EQ(node.bytecode(), Bytecode::kJumpIfTrue); | 64 CHECK_EQ(node.bytecode(), Bytecode::kJumpIfTrue); |
65 CHECK_EQ(node.operand_count(), 1); | 65 CHECK_EQ(node.operand_count(), 1); |
66 CHECK_EQ(node.operand(0), operands[0]); | 66 CHECK_EQ(node.operand(0), operands[0]); |
67 CHECK(!node.source_info().is_valid()); | 67 CHECK(!node.source_info().is_valid()); |
68 } | 68 } |
69 | 69 |
70 TEST_F(BytecodeNodeTest, Constructor3) { | 70 TEST_F(BytecodeNodeTest, Constructor3) { |
71 uint32_t operands[] = {0x11}; | 71 uint32_t operands[] = {0x11, 0x22}; |
72 BytecodeNode node(Bytecode::kLdaGlobal, operands[0]); | 72 BytecodeNode node(Bytecode::kLdaGlobal, operands[0], operands[1]); |
73 CHECK_EQ(node.bytecode(), Bytecode::kLdaGlobal); | 73 CHECK_EQ(node.bytecode(), Bytecode::kLdaGlobal); |
74 CHECK_EQ(node.operand_count(), 1); | 74 CHECK_EQ(node.operand_count(), 2); |
75 CHECK_EQ(node.operand(0), operands[0]); | 75 CHECK_EQ(node.operand(0), operands[0]); |
| 76 CHECK_EQ(node.operand(1), operands[1]); |
76 CHECK(!node.source_info().is_valid()); | 77 CHECK(!node.source_info().is_valid()); |
77 } | 78 } |
78 | 79 |
79 TEST_F(BytecodeNodeTest, Constructor4) { | 80 TEST_F(BytecodeNodeTest, Constructor4) { |
80 uint32_t operands[] = {0x11, 0x22, 0x33}; | 81 uint32_t operands[] = {0x11, 0x22, 0x33}; |
81 BytecodeNode node(Bytecode::kLdaNamedProperty, operands[0], operands[1], | 82 BytecodeNode node(Bytecode::kLdaNamedProperty, operands[0], operands[1], |
82 operands[2]); | 83 operands[2]); |
83 CHECK_EQ(node.operand_count(), 3); | 84 CHECK_EQ(node.operand_count(), 3); |
84 CHECK_EQ(node.bytecode(), Bytecode::kLdaNamedProperty); | 85 CHECK_EQ(node.bytecode(), Bytecode::kLdaNamedProperty); |
85 CHECK_EQ(node.operand(0), operands[0]); | 86 CHECK_EQ(node.operand(0), operands[0]); |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 clone.set_bytecode(Bytecode::kJump, 0x01aabbcc); | 160 clone.set_bytecode(Bytecode::kJump, 0x01aabbcc); |
160 CHECK_EQ(clone.bytecode(), Bytecode::kJump); | 161 CHECK_EQ(clone.bytecode(), Bytecode::kJump); |
161 CHECK_EQ(clone.operand_count(), 1); | 162 CHECK_EQ(clone.operand_count(), 1); |
162 CHECK_EQ(clone.operand(0), 0x01aabbccu); | 163 CHECK_EQ(clone.operand(0), 0x01aabbccu); |
163 CHECK_EQ(clone.source_info(), source_info); | 164 CHECK_EQ(clone.source_info(), source_info); |
164 } | 165 } |
165 | 166 |
166 } // namespace interpreter | 167 } // namespace interpreter |
167 } // namespace internal | 168 } // namespace internal |
168 } // namespace v8 | 169 } // namespace v8 |
OLD | NEW |