| 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), 0), | 30 Bytecodes::ToString(bytecode), |
| 31 Bytecodes::ReturnCount(bytecode)), |
| 31 bytecode_(bytecode), | 32 bytecode_(bytecode), |
| 32 operand_scale_(operand_scale), | 33 operand_scale_(operand_scale), |
| 33 accumulator_(this, MachineRepresentation::kTagged), | 34 accumulator_(this, MachineRepresentation::kTagged), |
| 34 accumulator_use_(AccumulatorUse::kNone), | 35 accumulator_use_(AccumulatorUse::kNone), |
| 35 made_call_(false), | 36 made_call_(false), |
| 36 disable_stack_check_across_call_(false), | 37 disable_stack_check_across_call_(false), |
| 37 stack_pointer_before_call_(nullptr) { | 38 stack_pointer_before_call_(nullptr) { |
| 38 accumulator_.Bind( | 39 accumulator_.Bind( |
| 39 Parameter(InterpreterDispatchDescriptor::kAccumulatorParameter)); | 40 Parameter(InterpreterDispatchDescriptor::kAccumulatorParameter)); |
| 40 if (FLAG_trace_ignition) { | 41 if (FLAG_trace_ignition) { |
| (...skipping 552 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 593 base_index = nullptr; | 594 base_index = nullptr; |
| 594 } | 595 } |
| 595 Node* target_index = IntPtrAdd(base_index, next_bytecode); | 596 Node* target_index = IntPtrAdd(base_index, next_bytecode); |
| 596 Node* target_code_entry = | 597 Node* target_code_entry = |
| 597 Load(MachineType::Pointer(), DispatchTableRawPointer(), | 598 Load(MachineType::Pointer(), DispatchTableRawPointer(), |
| 598 WordShl(target_index, kPointerSizeLog2)); | 599 WordShl(target_index, kPointerSizeLog2)); |
| 599 | 600 |
| 600 DispatchToBytecodeHandlerEntry(target_code_entry, next_bytecode_offset); | 601 DispatchToBytecodeHandlerEntry(target_code_entry, next_bytecode_offset); |
| 601 } | 602 } |
| 602 | 603 |
| 603 compiler::Node* InterpreterAssembler::InterpreterReturn() { | 604 void InterpreterAssembler::UpdateInterruptBudgetOnReturn() { |
| 604 // TODO(rmcilroy): Investigate whether it is worth supporting self | 605 // TODO(rmcilroy): Investigate whether it is worth supporting self |
| 605 // optimization of primitive functions like FullCodegen. | 606 // optimization of primitive functions like FullCodegen. |
| 606 | 607 |
| 607 // Update profiling count by -BytecodeOffset to simulate backedge to start of | 608 // Update profiling count by -BytecodeOffset to simulate backedge to start of |
| 608 // function. | 609 // function. |
| 609 Node* profiling_weight = | 610 Node* profiling_weight = |
| 610 Int32Sub(Int32Constant(kHeapObjectTag + BytecodeArray::kHeaderSize), | 611 Int32Sub(Int32Constant(kHeapObjectTag + BytecodeArray::kHeaderSize), |
| 611 BytecodeOffset()); | 612 BytecodeOffset()); |
| 612 UpdateInterruptBudget(profiling_weight); | 613 UpdateInterruptBudget(profiling_weight); |
| 613 | |
| 614 Node* exit_trampoline_code_object = | |
| 615 HeapConstant(isolate()->builtins()->InterpreterExitTrampoline()); | |
| 616 return DispatchToBytecodeHandler(exit_trampoline_code_object); | |
| 617 } | 614 } |
| 618 | 615 |
| 619 Node* InterpreterAssembler::StackCheckTriggeredInterrupt() { | 616 Node* InterpreterAssembler::StackCheckTriggeredInterrupt() { |
| 620 Node* sp = LoadStackPointer(); | 617 Node* sp = LoadStackPointer(); |
| 621 Node* stack_limit = Load( | 618 Node* stack_limit = Load( |
| 622 MachineType::Pointer(), | 619 MachineType::Pointer(), |
| 623 ExternalConstant(ExternalReference::address_of_stack_limit(isolate()))); | 620 ExternalConstant(ExternalReference::address_of_stack_limit(isolate()))); |
| 624 return UintPtrLessThan(sp, stack_limit); | 621 return UintPtrLessThan(sp, stack_limit); |
| 625 } | 622 } |
| 626 | 623 |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 765 Goto(&loop); | 762 Goto(&loop); |
| 766 } | 763 } |
| 767 Bind(&done_loop); | 764 Bind(&done_loop); |
| 768 | 765 |
| 769 return array; | 766 return array; |
| 770 } | 767 } |
| 771 | 768 |
| 772 } // namespace interpreter | 769 } // namespace interpreter |
| 773 } // namespace internal | 770 } // namespace internal |
| 774 } // namespace v8 | 771 } // namespace v8 |
| OLD | NEW |