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 <ostream> | 8 #include <ostream> |
8 | 9 |
9 #include "src/code-factory.h" | 10 #include "src/code-factory.h" |
10 #include "src/frames.h" | 11 #include "src/frames.h" |
11 #include "src/interface-descriptors.h" | 12 #include "src/interface-descriptors.h" |
12 #include "src/interpreter/bytecodes.h" | 13 #include "src/interpreter/bytecodes.h" |
13 #include "src/interpreter/interpreter.h" | 14 #include "src/interpreter/interpreter.h" |
14 #include "src/machine-type.h" | 15 #include "src/machine-type.h" |
15 #include "src/macro-assembler.h" | 16 #include "src/macro-assembler.h" |
16 #include "src/zone.h" | 17 #include "src/zone.h" |
(...skipping 19 matching lines...) Expand all Loading... |
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 context_.Bind(Parameter(InterpreterDispatchDescriptor::kContextParameter)); | 41 context_.Bind(Parameter(InterpreterDispatchDescriptor::kContextParameter)); |
41 bytecode_array_.Bind( | 42 bytecode_array_.Bind( |
42 Parameter(InterpreterDispatchDescriptor::kBytecodeArrayParameter)); | 43 Parameter(InterpreterDispatchDescriptor::kBytecodeArrayParameter)); |
43 if (FLAG_trace_ignition) { | 44 if (FLAG_trace_ignition) { |
44 TraceBytecode(Runtime::kInterpreterTraceBytecodeEntry); | 45 TraceBytecode(Runtime::kInterpreterTraceBytecodeEntry); |
45 } | 46 } |
| 47 if (FLAG_trace_ignition_dispatches) { |
| 48 TraceBytecodeDispatch(); |
| 49 } |
46 } | 50 } |
47 | 51 |
48 InterpreterAssembler::~InterpreterAssembler() {} | 52 InterpreterAssembler::~InterpreterAssembler() {} |
49 | 53 |
50 Node* InterpreterAssembler::GetAccumulator() { return accumulator_.value(); } | 54 Node* InterpreterAssembler::GetAccumulator() { return accumulator_.value(); } |
51 | 55 |
52 void InterpreterAssembler::SetAccumulator(Node* value) { | 56 void InterpreterAssembler::SetAccumulator(Node* value) { |
53 accumulator_.Bind(value); | 57 accumulator_.Bind(value); |
54 } | 58 } |
55 | 59 |
(...skipping 594 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
650 Bind(&match); | 654 Bind(&match); |
651 Goto(&end); | 655 Goto(&end); |
652 Bind(&end); | 656 Bind(&end); |
653 } | 657 } |
654 | 658 |
655 void InterpreterAssembler::TraceBytecode(Runtime::FunctionId function_id) { | 659 void InterpreterAssembler::TraceBytecode(Runtime::FunctionId function_id) { |
656 CallRuntime(function_id, GetContext(), BytecodeArrayTaggedPointer(), | 660 CallRuntime(function_id, GetContext(), BytecodeArrayTaggedPointer(), |
657 SmiTag(BytecodeOffset()), GetAccumulator()); | 661 SmiTag(BytecodeOffset()), GetAccumulator()); |
658 } | 662 } |
659 | 663 |
| 664 void InterpreterAssembler::TraceBytecodeDispatch() { |
| 665 Node* counters = ExternalConstant( |
| 666 ExternalReference::interpreter_dispatch_counters(isolate())); |
| 667 Node* counter_offset = |
| 668 IntPtrConstant(static_cast<int>(bytecode_) * sizeof(uintptr_t)); |
| 669 Node* old_counter = Load(MachineType::IntPtr(), counters, counter_offset); |
| 670 |
| 671 CodeStubAssembler::Label counter_ok(this); |
| 672 CodeStubAssembler::Label counter_saturated(this); |
| 673 CodeStubAssembler::Label end(this); |
| 674 |
| 675 Node* counter_reached_max = WordEqual( |
| 676 old_counter, IntPtrConstant(std::numeric_limits<uintptr_t>::max())); |
| 677 Branch(counter_reached_max, &counter_saturated, &counter_ok); |
| 678 Bind(&counter_ok); |
| 679 Node* new_counter = IntPtrAdd(old_counter, IntPtrConstant(1)); |
| 680 StoreNoWriteBarrier(kPointerSize == 8 ? MachineRepresentation::kWord64 |
| 681 : MachineRepresentation::kWord32, |
| 682 counters, counter_offset, new_counter); |
| 683 Goto(&end); |
| 684 Bind(&counter_saturated); |
| 685 Goto(&end); |
| 686 Bind(&end); |
| 687 } |
| 688 |
660 // static | 689 // static |
661 bool InterpreterAssembler::TargetSupportsUnalignedAccess() { | 690 bool InterpreterAssembler::TargetSupportsUnalignedAccess() { |
662 #if V8_TARGET_ARCH_MIPS || V8_TARGET_ARCH_MIPS64 | 691 #if V8_TARGET_ARCH_MIPS || V8_TARGET_ARCH_MIPS64 |
663 return false; | 692 return false; |
664 #elif V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_ARM64 || V8_TARGET_ARCH_PPC | 693 #elif V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_ARM64 || V8_TARGET_ARCH_PPC |
665 return CpuFeatures::IsSupported(UNALIGNED_ACCESSES); | 694 return CpuFeatures::IsSupported(UNALIGNED_ACCESSES); |
666 #elif V8_TARGET_ARCH_IA32 || V8_TARGET_ARCH_X64 || V8_TARGET_ARCH_X87 || \ | 695 #elif V8_TARGET_ARCH_IA32 || V8_TARGET_ARCH_X64 || V8_TARGET_ARCH_X87 || \ |
667 V8_TARGET_ARCH_S390 | 696 V8_TARGET_ARCH_S390 |
668 return true; | 697 return true; |
669 #else | 698 #else |
670 #error "Unknown Architecture" | 699 #error "Unknown Architecture" |
671 #endif | 700 #endif |
672 } | 701 } |
673 | 702 |
674 } // namespace interpreter | 703 } // namespace interpreter |
675 } // namespace internal | 704 } // namespace internal |
676 } // namespace v8 | 705 } // namespace v8 |
OLD | NEW |