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/interpreter/interpreter-assembler.h" | 5 #include "src/interpreter/interpreter-assembler.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 #include <ostream> | 8 #include <ostream> |
9 | 9 |
10 #include "src/code-factory.h" | 10 #include "src/code-factory.h" |
11 #include "src/frames.h" | 11 #include "src/frames.h" |
12 #include "src/interface-descriptors.h" | 12 #include "src/interface-descriptors.h" |
13 #include "src/interpreter/bytecodes.h" | 13 #include "src/interpreter/bytecodes.h" |
14 #include "src/interpreter/interpreter.h" | 14 #include "src/interpreter/interpreter.h" |
15 #include "src/machine-type.h" | 15 #include "src/machine-type.h" |
16 #include "src/macro-assembler.h" | 16 #include "src/macro-assembler.h" |
17 #include "src/zone.h" | 17 #include "src/zone.h" |
18 | 18 |
19 namespace v8 { | 19 namespace v8 { |
20 namespace internal { | 20 namespace internal { |
21 namespace interpreter { | 21 namespace interpreter { |
22 | 22 |
23 using compiler::Node; | 23 using compiler::Node; |
24 | 24 |
25 InterpreterAssembler::InterpreterAssembler(Isolate* isolate, Zone* zone, | 25 InterpreterAssembler::InterpreterAssembler(Isolate* isolate, Zone* zone, |
26 Bytecode bytecode, | 26 Bytecode bytecode, |
27 OperandScale operand_scale) | 27 OperandScale operand_scale) |
28 : CodeStubAssembler(isolate, zone, InterpreterDispatchDescriptor(isolate), | 28 : CodeStubAssembler(isolate, zone, InterpreterDispatchDescriptor(isolate), |
29 Code::ComputeFlags(Code::BYTECODE_HANDLER), | 29 Code::ComputeFlags(Code::BYTECODE_HANDLER), |
30 Bytecodes::ToString(bytecode), | 30 Bytecodes::ToString(bytecode), 0), |
31 Bytecodes::ReturnCount(bytecode)), | |
32 bytecode_(bytecode), | 31 bytecode_(bytecode), |
33 operand_scale_(operand_scale), | 32 operand_scale_(operand_scale), |
34 accumulator_(this, MachineRepresentation::kTagged), | 33 accumulator_(this, MachineRepresentation::kTagged), |
35 accumulator_use_(AccumulatorUse::kNone), | 34 accumulator_use_(AccumulatorUse::kNone), |
36 made_call_(false), | 35 made_call_(false), |
37 disable_stack_check_across_call_(false), | 36 disable_stack_check_across_call_(false), |
38 stack_pointer_before_call_(nullptr) { | 37 stack_pointer_before_call_(nullptr) { |
39 accumulator_.Bind( | 38 accumulator_.Bind( |
40 Parameter(InterpreterDispatchDescriptor::kAccumulatorParameter)); | 39 Parameter(InterpreterDispatchDescriptor::kAccumulatorParameter)); |
41 if (FLAG_trace_ignition) { | 40 if (FLAG_trace_ignition) { |
(...skipping 552 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
594 base_index = nullptr; | 593 base_index = nullptr; |
595 } | 594 } |
596 Node* target_index = IntPtrAdd(base_index, next_bytecode); | 595 Node* target_index = IntPtrAdd(base_index, next_bytecode); |
597 Node* target_code_entry = | 596 Node* target_code_entry = |
598 Load(MachineType::Pointer(), DispatchTableRawPointer(), | 597 Load(MachineType::Pointer(), DispatchTableRawPointer(), |
599 WordShl(target_index, kPointerSizeLog2)); | 598 WordShl(target_index, kPointerSizeLog2)); |
600 | 599 |
601 DispatchToBytecodeHandlerEntry(target_code_entry, next_bytecode_offset); | 600 DispatchToBytecodeHandlerEntry(target_code_entry, next_bytecode_offset); |
602 } | 601 } |
603 | 602 |
604 void InterpreterAssembler::UpdateInterruptBudgetOnReturn() { | 603 compiler::Node* InterpreterAssembler::InterpreterReturn() { |
605 // TODO(rmcilroy): Investigate whether it is worth supporting self | 604 // TODO(rmcilroy): Investigate whether it is worth supporting self |
606 // optimization of primitive functions like FullCodegen. | 605 // optimization of primitive functions like FullCodegen. |
607 | 606 |
608 // Update profiling count by -BytecodeOffset to simulate backedge to start of | 607 // Update profiling count by -BytecodeOffset to simulate backedge to start of |
609 // function. | 608 // function. |
610 Node* profiling_weight = | 609 Node* profiling_weight = |
611 Int32Sub(Int32Constant(kHeapObjectTag + BytecodeArray::kHeaderSize), | 610 Int32Sub(Int32Constant(kHeapObjectTag + BytecodeArray::kHeaderSize), |
612 BytecodeOffset()); | 611 BytecodeOffset()); |
613 UpdateInterruptBudget(profiling_weight); | 612 UpdateInterruptBudget(profiling_weight); |
| 613 |
| 614 Node* exit_trampoline_code_object = |
| 615 HeapConstant(isolate()->builtins()->InterpreterExitTrampoline()); |
| 616 return DispatchToBytecodeHandler(exit_trampoline_code_object); |
614 } | 617 } |
615 | 618 |
616 Node* InterpreterAssembler::StackCheckTriggeredInterrupt() { | 619 Node* InterpreterAssembler::StackCheckTriggeredInterrupt() { |
617 Node* sp = LoadStackPointer(); | 620 Node* sp = LoadStackPointer(); |
618 Node* stack_limit = Load( | 621 Node* stack_limit = Load( |
619 MachineType::Pointer(), | 622 MachineType::Pointer(), |
620 ExternalConstant(ExternalReference::address_of_stack_limit(isolate()))); | 623 ExternalConstant(ExternalReference::address_of_stack_limit(isolate()))); |
621 return UintPtrLessThan(sp, stack_limit); | 624 return UintPtrLessThan(sp, stack_limit); |
622 } | 625 } |
623 | 626 |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
762 Goto(&loop); | 765 Goto(&loop); |
763 } | 766 } |
764 Bind(&done_loop); | 767 Bind(&done_loop); |
765 | 768 |
766 return array; | 769 return array; |
767 } | 770 } |
768 | 771 |
769 } // namespace interpreter | 772 } // namespace interpreter |
770 } // namespace internal | 773 } // namespace internal |
771 } // namespace v8 | 774 } // namespace v8 |
OLD | NEW |