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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 TEST_F(BytecodeNodeTest, Constructor2) { | 67 TEST_F(BytecodeNodeTest, Constructor2) { |
68 uint32_t operands[] = {0x11}; | 68 uint32_t operands[] = {0x11}; |
69 BytecodeNode node(Bytecode::kJumpIfTrue, operands[0]); | 69 BytecodeNode node(Bytecode::kJumpIfTrue, operands[0]); |
70 CHECK_EQ(node.bytecode(), Bytecode::kJumpIfTrue); | 70 CHECK_EQ(node.bytecode(), Bytecode::kJumpIfTrue); |
71 CHECK_EQ(node.operand_count(), 1); | 71 CHECK_EQ(node.operand_count(), 1); |
72 CHECK_EQ(node.operand(0), operands[0]); | 72 CHECK_EQ(node.operand(0), operands[0]); |
73 CHECK(!node.source_info().is_valid()); | 73 CHECK(!node.source_info().is_valid()); |
74 } | 74 } |
75 | 75 |
76 TEST_F(BytecodeNodeTest, Constructor3) { | 76 TEST_F(BytecodeNodeTest, Constructor3) { |
77 uint32_t operands[] = {0x11, 0x22}; | 77 uint32_t operands[] = {0x11}; |
78 BytecodeNode node(Bytecode::kLdaGlobal, operands[0], operands[1]); | 78 BytecodeNode node(Bytecode::kLdaGlobal, operands[0]); |
79 CHECK_EQ(node.bytecode(), Bytecode::kLdaGlobal); | 79 CHECK_EQ(node.bytecode(), Bytecode::kLdaGlobal); |
80 CHECK_EQ(node.operand_count(), 2); | 80 CHECK_EQ(node.operand_count(), 1); |
81 CHECK_EQ(node.operand(0), operands[0]); | 81 CHECK_EQ(node.operand(0), operands[0]); |
82 CHECK_EQ(node.operand(1), operands[1]); | |
83 CHECK(!node.source_info().is_valid()); | 82 CHECK(!node.source_info().is_valid()); |
84 } | 83 } |
85 | 84 |
86 TEST_F(BytecodeNodeTest, Constructor4) { | 85 TEST_F(BytecodeNodeTest, Constructor4) { |
87 uint32_t operands[] = {0x11, 0x22, 0x33}; | 86 uint32_t operands[] = {0x11, 0x22, 0x33}; |
88 BytecodeNode node(Bytecode::kLdaNamedProperty, operands[0], operands[1], | 87 BytecodeNode node(Bytecode::kLdaNamedProperty, operands[0], operands[1], |
89 operands[2]); | 88 operands[2]); |
90 CHECK_EQ(node.operand_count(), 3); | 89 CHECK_EQ(node.operand_count(), 3); |
91 CHECK_EQ(node.bytecode(), Bytecode::kLdaNamedProperty); | 90 CHECK_EQ(node.bytecode(), Bytecode::kLdaNamedProperty); |
92 CHECK_EQ(node.operand(0), operands[0]); | 91 CHECK_EQ(node.operand(0), operands[0]); |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 clone.set_bytecode(Bytecode::kJump, 0x01aabbcc); | 176 clone.set_bytecode(Bytecode::kJump, 0x01aabbcc); |
178 CHECK_EQ(clone.bytecode(), Bytecode::kJump); | 177 CHECK_EQ(clone.bytecode(), Bytecode::kJump); |
179 CHECK_EQ(clone.operand_count(), 1); | 178 CHECK_EQ(clone.operand_count(), 1); |
180 CHECK_EQ(clone.operand(0), 0x01aabbcc); | 179 CHECK_EQ(clone.operand(0), 0x01aabbcc); |
181 CHECK_EQ(clone.source_info(), source_info); | 180 CHECK_EQ(clone.source_info(), source_info); |
182 } | 181 } |
183 | 182 |
184 } // namespace interpreter | 183 } // namespace interpreter |
185 } // namespace internal | 184 } // namespace internal |
186 } // namespace v8 | 185 } // namespace v8 |
OLD | NEW |