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 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 CHECK(!iterator.done()); | 222 CHECK(!iterator.done()); |
223 offset += Bytecodes::Size(Bytecode::kStar, OperandScale::kSingle); | 223 offset += Bytecodes::Size(Bytecode::kStar, OperandScale::kSingle); |
224 iterator.Advance(); | 224 iterator.Advance(); |
225 | 225 |
226 CHECK_EQ(iterator.current_bytecode(), Bytecode::kCallRuntimeForPair); | 226 CHECK_EQ(iterator.current_bytecode(), Bytecode::kCallRuntimeForPair); |
227 CHECK_EQ(iterator.current_offset(), offset); | 227 CHECK_EQ(iterator.current_offset(), offset); |
228 CHECK_EQ(iterator.current_operand_scale(), OperandScale::kSingle); | 228 CHECK_EQ(iterator.current_operand_scale(), OperandScale::kSingle); |
229 CHECK_EQ(iterator.GetRuntimeIdOperand(0), Runtime::kLoadLookupSlotForCall); | 229 CHECK_EQ(iterator.GetRuntimeIdOperand(0), Runtime::kLoadLookupSlotForCall); |
230 CHECK_EQ(iterator.GetRegisterOperand(1).index(), param.index()); | 230 CHECK_EQ(iterator.GetRegisterOperand(1).index(), param.index()); |
231 CHECK_EQ(iterator.GetRegisterOperandRange(1), 1); | 231 CHECK_EQ(iterator.GetRegisterOperandRange(1), 1); |
232 CHECK_EQ(iterator.GetRegisterCountOperand(2), 1); | 232 CHECK_EQ(iterator.GetRegisterCountOperand(2), 1u); |
233 CHECK_EQ(iterator.GetRegisterOperand(3).index(), reg_0.index()); | 233 CHECK_EQ(iterator.GetRegisterOperand(3).index(), reg_0.index()); |
234 CHECK_EQ(iterator.GetRegisterOperandRange(3), 2); | 234 CHECK_EQ(iterator.GetRegisterOperandRange(3), 2); |
235 CHECK(!iterator.done()); | 235 CHECK(!iterator.done()); |
236 offset += | 236 offset += |
237 Bytecodes::Size(Bytecode::kCallRuntimeForPair, OperandScale::kSingle); | 237 Bytecodes::Size(Bytecode::kCallRuntimeForPair, OperandScale::kSingle); |
238 iterator.Advance(); | 238 iterator.Advance(); |
239 | 239 |
240 CHECK_EQ(iterator.current_bytecode(), Bytecode::kForInPrepare); | 240 CHECK_EQ(iterator.current_bytecode(), Bytecode::kForInPrepare); |
241 CHECK_EQ(iterator.current_offset(), offset); | 241 CHECK_EQ(iterator.current_offset(), offset); |
242 CHECK_EQ(iterator.current_operand_scale(), OperandScale::kSingle); | 242 CHECK_EQ(iterator.current_operand_scale(), OperandScale::kSingle); |
243 CHECK_EQ(iterator.GetRegisterOperand(0).index(), reg_0.index()); | 243 CHECK_EQ(iterator.GetRegisterOperand(0).index(), reg_0.index()); |
244 CHECK_EQ(iterator.GetRegisterOperandRange(0), 1); | 244 CHECK_EQ(iterator.GetRegisterOperandRange(0), 1); |
245 CHECK_EQ(iterator.GetRegisterOperand(1).index(), reg_0.index()); | 245 CHECK_EQ(iterator.GetRegisterOperand(1).index(), reg_0.index()); |
246 CHECK_EQ(iterator.GetRegisterOperandRange(1), 3); | 246 CHECK_EQ(iterator.GetRegisterOperandRange(1), 3); |
247 CHECK(!iterator.done()); | 247 CHECK(!iterator.done()); |
248 offset += Bytecodes::Size(Bytecode::kForInPrepare, OperandScale::kSingle); | 248 offset += Bytecodes::Size(Bytecode::kForInPrepare, OperandScale::kSingle); |
249 iterator.Advance(); | 249 iterator.Advance(); |
250 | 250 |
251 CHECK_EQ(iterator.current_bytecode(), Bytecode::kCallRuntime); | 251 CHECK_EQ(iterator.current_bytecode(), Bytecode::kCallRuntime); |
252 CHECK_EQ(iterator.current_offset(), offset); | 252 CHECK_EQ(iterator.current_offset(), offset); |
253 CHECK_EQ(iterator.current_operand_scale(), OperandScale::kSingle); | 253 CHECK_EQ(iterator.current_operand_scale(), OperandScale::kSingle); |
254 CHECK_EQ(iterator.GetRuntimeIdOperand(0), Runtime::kLoadIC_Miss); | 254 CHECK_EQ(iterator.GetRuntimeIdOperand(0), Runtime::kLoadIC_Miss); |
255 CHECK_EQ(iterator.GetRegisterOperand(1).index(), reg_0.index()); | 255 CHECK_EQ(iterator.GetRegisterOperand(1).index(), reg_0.index()); |
256 CHECK_EQ(iterator.GetRegisterCountOperand(2), 1); | 256 CHECK_EQ(iterator.GetRegisterCountOperand(2), 1u); |
257 CHECK(!iterator.done()); | 257 CHECK(!iterator.done()); |
258 offset += Bytecodes::Size(Bytecode::kCallRuntime, OperandScale::kSingle); | 258 offset += Bytecodes::Size(Bytecode::kCallRuntime, OperandScale::kSingle); |
259 iterator.Advance(); | 259 iterator.Advance(); |
260 | 260 |
261 CHECK_EQ(iterator.current_bytecode(), Bytecode::kDebugger); | 261 CHECK_EQ(iterator.current_bytecode(), Bytecode::kDebugger); |
262 CHECK_EQ(iterator.current_offset(), offset); | 262 CHECK_EQ(iterator.current_offset(), offset); |
263 CHECK_EQ(iterator.current_operand_scale(), OperandScale::kSingle); | 263 CHECK_EQ(iterator.current_operand_scale(), OperandScale::kSingle); |
264 CHECK(!iterator.done()); | 264 CHECK(!iterator.done()); |
265 offset += Bytecodes::Size(Bytecode::kDebugger, OperandScale::kSingle); | 265 offset += Bytecodes::Size(Bytecode::kDebugger, OperandScale::kSingle); |
266 iterator.Advance(); | 266 iterator.Advance(); |
267 | 267 |
268 CHECK_EQ(iterator.current_bytecode(), Bytecode::kLdaGlobal); | 268 CHECK_EQ(iterator.current_bytecode(), Bytecode::kLdaGlobal); |
269 CHECK_EQ(iterator.current_offset(), offset); | 269 CHECK_EQ(iterator.current_offset(), offset); |
270 CHECK_EQ(iterator.current_operand_scale(), OperandScale::kQuadruple); | 270 CHECK_EQ(iterator.current_operand_scale(), OperandScale::kQuadruple); |
271 CHECK_EQ(iterator.current_bytecode_size(), 6); | 271 CHECK_EQ(iterator.current_bytecode_size(), 6); |
272 CHECK_EQ(iterator.GetIndexOperand(0), 0x10000000); | 272 CHECK_EQ(iterator.GetIndexOperand(0), 0x10000000u); |
273 offset += Bytecodes::Size(Bytecode::kLdaGlobal, OperandScale::kQuadruple) + | 273 offset += Bytecodes::Size(Bytecode::kLdaGlobal, OperandScale::kQuadruple) + |
274 kPrefixByteSize; | 274 kPrefixByteSize; |
275 iterator.Advance(); | 275 iterator.Advance(); |
276 | 276 |
277 CHECK_EQ(iterator.current_bytecode(), Bytecode::kReturn); | 277 CHECK_EQ(iterator.current_bytecode(), Bytecode::kReturn); |
278 CHECK_EQ(iterator.current_offset(), offset); | 278 CHECK_EQ(iterator.current_offset(), offset); |
279 CHECK_EQ(iterator.current_operand_scale(), OperandScale::kSingle); | 279 CHECK_EQ(iterator.current_operand_scale(), OperandScale::kSingle); |
280 CHECK(!iterator.done()); | 280 CHECK(!iterator.done()); |
281 iterator.Advance(); | 281 iterator.Advance(); |
282 CHECK(iterator.done()); | 282 CHECK(iterator.done()); |
283 } | 283 } |
284 | 284 |
285 } // namespace interpreter | 285 } // namespace interpreter |
286 } // namespace internal | 286 } // namespace internal |
287 } // namespace v8 | 287 } // namespace v8 |
OLD | NEW |