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 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
375 _, code_target_matcher, | 375 _, code_target_matcher, |
376 IsParameter(InterpreterDispatchDescriptor::kAccumulatorParameter), | 376 IsParameter(InterpreterDispatchDescriptor::kAccumulatorParameter), |
377 next_bytecode_offset_matcher, _, | 377 next_bytecode_offset_matcher, _, |
378 IsParameter( | 378 IsParameter( |
379 InterpreterDispatchDescriptor::kDispatchTableParameter), | 379 InterpreterDispatchDescriptor::kDispatchTableParameter), |
380 _, _)); | 380 _, _)); |
381 } | 381 } |
382 } | 382 } |
383 } | 383 } |
384 | 384 |
| 385 TARGET_TEST_F(InterpreterAssemblerTest, InterpreterReturn) { |
| 386 // If debug code is enabled we emit extra code in InterpreterReturn. |
| 387 if (FLAG_debug_code) return; |
| 388 |
| 389 TRACED_FOREACH(interpreter::Bytecode, bytecode, kBytecodes) { |
| 390 InterpreterAssemblerForTest m(this, bytecode); |
| 391 Node* tail_call_node = m.InterpreterReturn(); |
| 392 |
| 393 Handle<HeapObject> exit_trampoline = |
| 394 isolate()->builtins()->InterpreterExitTrampoline(); |
| 395 Matcher<Node*> exit_trampoline_entry_matcher = |
| 396 IsIntPtrAdd(IsHeapConstant(exit_trampoline), |
| 397 IsIntPtrConstant(Code::kHeaderSize - kHeapObjectTag)); |
| 398 EXPECT_THAT( |
| 399 tail_call_node, |
| 400 IsTailCall( |
| 401 _, exit_trampoline_entry_matcher, |
| 402 IsParameter(InterpreterDispatchDescriptor::kAccumulatorParameter), |
| 403 IsParameter( |
| 404 InterpreterDispatchDescriptor::kBytecodeOffsetParameter), |
| 405 _, |
| 406 IsParameter(InterpreterDispatchDescriptor::kDispatchTableParameter), |
| 407 _, _)); |
| 408 } |
| 409 } |
| 410 |
385 TARGET_TEST_F(InterpreterAssemblerTest, BytecodeOperand) { | 411 TARGET_TEST_F(InterpreterAssemblerTest, BytecodeOperand) { |
386 static const OperandScale kOperandScales[] = { | 412 static const OperandScale kOperandScales[] = { |
387 OperandScale::kSingle, OperandScale::kDouble, OperandScale::kQuadruple}; | 413 OperandScale::kSingle, OperandScale::kDouble, OperandScale::kQuadruple}; |
388 TRACED_FOREACH(interpreter::Bytecode, bytecode, kBytecodes) { | 414 TRACED_FOREACH(interpreter::Bytecode, bytecode, kBytecodes) { |
389 TRACED_FOREACH(interpreter::OperandScale, operand_scale, kOperandScales) { | 415 TRACED_FOREACH(interpreter::OperandScale, operand_scale, kOperandScales) { |
390 InterpreterAssemblerForTest m(this, bytecode, operand_scale); | 416 InterpreterAssemblerForTest m(this, bytecode, operand_scale); |
391 int number_of_operands = | 417 int number_of_operands = |
392 interpreter::Bytecodes::NumberOfOperands(bytecode); | 418 interpreter::Bytecodes::NumberOfOperands(bytecode); |
393 for (int i = 0; i < number_of_operands; i++) { | 419 for (int i = 0; i < number_of_operands; i++) { |
394 int offset = interpreter::Bytecodes::GetOperandOffset(bytecode, i, | 420 int offset = interpreter::Bytecodes::GetOperandOffset(bytecode, i, |
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
701 feedback_vector, | 727 feedback_vector, |
702 m.IsLoad(MachineType::AnyTagged(), load_shared_function_info_matcher, | 728 m.IsLoad(MachineType::AnyTagged(), load_shared_function_info_matcher, |
703 IsIntPtrConstant(SharedFunctionInfo::kFeedbackVectorOffset - | 729 IsIntPtrConstant(SharedFunctionInfo::kFeedbackVectorOffset - |
704 kHeapObjectTag))); | 730 kHeapObjectTag))); |
705 } | 731 } |
706 } | 732 } |
707 | 733 |
708 } // namespace interpreter | 734 } // namespace interpreter |
709 } // namespace internal | 735 } // namespace internal |
710 } // namespace v8 | 736 } // namespace v8 |
OLD | NEW |