Chromium Code Reviews| 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 "test/unittests/interpreter/interpreter-assembler-unittest.h" | 5 #include "test/unittests/interpreter/interpreter-assembler-unittest.h" |
| 6 | 6 |
| 7 #include "src/code-factory.h" | 7 #include "src/code-factory.h" |
| 8 #include "src/compiler/graph.h" | 8 #include "src/compiler/graph.h" |
| 9 #include "src/compiler/node.h" | 9 #include "src/compiler/node.h" |
| 10 #include "src/interface-descriptors.h" | 10 #include "src/interface-descriptors.h" |
| (...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 309 } | 309 } |
| 310 return nullptr; | 310 return nullptr; |
| 311 } | 311 } |
| 312 | 312 |
| 313 TARGET_TEST_F(InterpreterAssemblerTest, Dispatch) { | 313 TARGET_TEST_F(InterpreterAssemblerTest, Dispatch) { |
| 314 TRACED_FOREACH(interpreter::Bytecode, bytecode, kBytecodes) { | 314 TRACED_FOREACH(interpreter::Bytecode, bytecode, kBytecodes) { |
| 315 InterpreterAssemblerForTest m(this, bytecode); | 315 InterpreterAssemblerForTest m(this, bytecode); |
| 316 Node* tail_call_node = m.Dispatch(); | 316 Node* tail_call_node = m.Dispatch(); |
| 317 | 317 |
| 318 OperandScale operand_scale = OperandScale::kSingle; | 318 OperandScale operand_scale = OperandScale::kSingle; |
| 319 bool has_star_lookahead = | |
| 320 interpreter::Bytecodes::IsStarLookahead(bytecode, operand_scale); | |
|
rmcilroy
2016/07/20 10:34:12
nit - just inline this into if block below
klaasb
2016/07/20 11:22:55
Done.
| |
| 321 | |
| 319 Matcher<Node*> next_bytecode_offset_matcher = IsIntPtrAdd( | 322 Matcher<Node*> next_bytecode_offset_matcher = IsIntPtrAdd( |
| 320 IsParameter(InterpreterDispatchDescriptor::kBytecodeOffsetParameter), | 323 IsParameter(InterpreterDispatchDescriptor::kBytecodeOffsetParameter), |
| 321 IsIntPtrConstant( | 324 IsIntPtrConstant( |
| 322 interpreter::Bytecodes::Size(bytecode, operand_scale))); | 325 interpreter::Bytecodes::Size(bytecode, operand_scale))); |
| 323 Matcher<Node*> target_bytecode_matcher = m.IsLoad( | 326 Matcher<Node*> target_bytecode_matcher = m.IsLoad( |
| 324 MachineType::Uint8(), | 327 MachineType::Uint8(), |
| 325 IsParameter(InterpreterDispatchDescriptor::kBytecodeArrayParameter), | 328 IsParameter(InterpreterDispatchDescriptor::kBytecodeArrayParameter), |
| 326 next_bytecode_offset_matcher); | 329 next_bytecode_offset_matcher); |
| 327 if (kPointerSize == 8) { | 330 if (kPointerSize == 8) { |
| 328 target_bytecode_matcher = IsChangeUint32ToUint64(target_bytecode_matcher); | 331 target_bytecode_matcher = IsChangeUint32ToUint64(target_bytecode_matcher); |
| 329 } | 332 } |
| 330 Matcher<Node*> code_target_matcher = m.IsLoad( | 333 Matcher<Node*> code_target_matcher = m.IsLoad( |
| 331 MachineType::Pointer(), | 334 MachineType::Pointer(), |
| 332 IsParameter(InterpreterDispatchDescriptor::kDispatchTableParameter), | 335 IsParameter(InterpreterDispatchDescriptor::kDispatchTableParameter), |
| 333 IsWordShl(target_bytecode_matcher, IsIntPtrConstant(kPointerSizeLog2))); | 336 IsWordShl(target_bytecode_matcher, IsIntPtrConstant(kPointerSizeLog2))); |
| 334 | 337 |
| 338 if (has_star_lookahead) { | |
| 339 Matcher<Node*> after_lookahead_offset = | |
| 340 IsIntPtrAdd(next_bytecode_offset_matcher, | |
| 341 IsIntPtrConstant(interpreter::Bytecodes::Size( | |
| 342 Bytecode::kStar, operand_scale))); | |
| 343 next_bytecode_offset_matcher = | |
| 344 IsPhi(MachineType::PointerRepresentation(), | |
| 345 next_bytecode_offset_matcher, after_lookahead_offset, _); | |
| 346 Matcher<Node*> after_lookahead_bytecode = m.IsLoad( | |
| 347 MachineType::Uint8(), | |
| 348 IsParameter(InterpreterDispatchDescriptor::kBytecodeArrayParameter), | |
| 349 after_lookahead_offset); | |
| 350 if (kPointerSize == 8) { | |
| 351 after_lookahead_bytecode = | |
| 352 IsChangeUint32ToUint64(after_lookahead_bytecode); | |
| 353 } | |
| 354 target_bytecode_matcher = | |
| 355 IsPhi(MachineRepresentation::kWord8, target_bytecode_matcher, | |
| 356 after_lookahead_bytecode, _); | |
| 357 code_target_matcher = m.IsLoad( | |
| 358 MachineType::Pointer(), | |
| 359 IsParameter(InterpreterDispatchDescriptor::kDispatchTableParameter), | |
| 360 IsWordShl(target_bytecode_matcher, | |
| 361 IsIntPtrConstant(kPointerSizeLog2))); | |
| 362 } | |
| 363 | |
| 335 EXPECT_THAT( | 364 EXPECT_THAT( |
| 336 tail_call_node, | 365 tail_call_node, |
| 337 IsTailCall( | 366 IsTailCall( |
| 338 _, code_target_matcher, | 367 _, code_target_matcher, |
| 339 IsParameter(InterpreterDispatchDescriptor::kAccumulatorParameter), | 368 IsParameter(InterpreterDispatchDescriptor::kAccumulatorParameter), |
| 340 next_bytecode_offset_matcher, | 369 next_bytecode_offset_matcher, |
| 341 IsParameter(InterpreterDispatchDescriptor::kBytecodeArrayParameter), | 370 IsParameter(InterpreterDispatchDescriptor::kBytecodeArrayParameter), |
| 342 IsParameter(InterpreterDispatchDescriptor::kDispatchTableParameter), | 371 IsParameter(InterpreterDispatchDescriptor::kDispatchTableParameter), |
| 343 _, _)); | 372 _, _)); |
| 344 } | 373 } |
| (...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 703 EXPECT_THAT(feedback_vector, | 732 EXPECT_THAT(feedback_vector, |
| 704 m.IsLoad(MachineType::AnyTagged(), load_literals_matcher, | 733 m.IsLoad(MachineType::AnyTagged(), load_literals_matcher, |
| 705 IsIntPtrConstant(LiteralsArray::kFeedbackVectorOffset - | 734 IsIntPtrConstant(LiteralsArray::kFeedbackVectorOffset - |
| 706 kHeapObjectTag))); | 735 kHeapObjectTag))); |
| 707 } | 736 } |
| 708 } | 737 } |
| 709 | 738 |
| 710 } // namespace interpreter | 739 } // namespace interpreter |
| 711 } // namespace internal | 740 } // namespace internal |
| 712 } // namespace v8 | 741 } // namespace v8 |
| OLD | NEW |