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 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 TEST_F(BytecodeNodeTest, NoEqualityWithDifferentSourceInfo) { | 127 TEST_F(BytecodeNodeTest, NoEqualityWithDifferentSourceInfo) { |
128 uint32_t operands[] = {0x71, 0xa5, 0x5a, 0xfc}; | 128 uint32_t operands[] = {0x71, 0xa5, 0x5a, 0xfc}; |
129 BytecodeSourceInfo source_info(77, true); | 129 BytecodeSourceInfo source_info(77, true); |
130 BytecodeNode node(Bytecode::kForInNext, operands[0], operands[1], operands[2], | 130 BytecodeNode node(Bytecode::kForInNext, operands[0], operands[1], operands[2], |
131 operands[3], source_info); | 131 operands[3], source_info); |
132 BytecodeNode other(Bytecode::kForInNext, operands[0], operands[1], | 132 BytecodeNode other(Bytecode::kForInNext, operands[0], operands[1], |
133 operands[2], operands[3]); | 133 operands[2], operands[3]); |
134 CHECK_NE(node, other); | 134 CHECK_NE(node, other); |
135 } | 135 } |
136 | 136 |
137 TEST_F(BytecodeNodeTest, SetBytecode0) { | |
138 uint32_t operands[] = {0x71, 0xa5, 0x5a, 0xfc}; | |
139 BytecodeSourceInfo source_info(77, false); | |
140 BytecodeNode node(Bytecode::kForInNext, operands[0], operands[1], operands[2], | |
141 operands[3], source_info); | |
142 CHECK_EQ(node.source_info(), source_info); | |
143 | |
144 BytecodeNode clone(Bytecode::kIllegal); | |
145 clone = node; | |
146 clone.set_bytecode(Bytecode::kNop); | |
147 CHECK_EQ(clone.bytecode(), Bytecode::kNop); | |
148 CHECK_EQ(clone.operand_count(), 0); | |
149 CHECK_EQ(clone.source_info(), source_info); | |
150 } | |
151 | |
152 TEST_F(BytecodeNodeTest, SetBytecode1) { | |
153 uint32_t operands[] = {0x71, 0xa5, 0x5a, 0xfc}; | |
154 BytecodeSourceInfo source_info(77, false); | |
155 BytecodeNode node(Bytecode::kForInNext, operands[0], operands[1], operands[2], | |
156 operands[3], source_info); | |
157 | |
158 BytecodeNode clone(Bytecode::kIllegal); | |
159 clone = node; | |
160 clone.set_bytecode(Bytecode::kJump, 0x01aabbcc); | |
161 CHECK_EQ(clone.bytecode(), Bytecode::kJump); | |
162 CHECK_EQ(clone.operand_count(), 1); | |
163 CHECK_EQ(clone.operand(0), 0x01aabbccu); | |
164 CHECK_EQ(clone.source_info(), source_info); | |
165 } | |
166 | |
167 } // namespace interpreter | 137 } // namespace interpreter |
168 } // namespace internal | 138 } // namespace internal |
169 } // namespace v8 | 139 } // namespace v8 |
OLD | NEW |