Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(214)

Side by Side Diff: src/interpreter/interpreter-assembler.cc

Issue 1817033002: [Interpreter] Add dispatch counters for each bytecode. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@fix-abort
Patch Set: Rebase on master. Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <ostream> 7 #include <ostream>
8 8
9 #include "src/code-factory.h" 9 #include "src/code-factory.h"
10 #include "src/frames.h" 10 #include "src/frames.h"
(...skipping 25 matching lines...) Expand all
36 disable_stack_check_across_call_(false), 36 disable_stack_check_across_call_(false),
37 stack_pointer_before_call_(nullptr) { 37 stack_pointer_before_call_(nullptr) {
38 accumulator_.Bind( 38 accumulator_.Bind(
39 Parameter(InterpreterDispatchDescriptor::kAccumulatorParameter)); 39 Parameter(InterpreterDispatchDescriptor::kAccumulatorParameter));
40 context_.Bind(Parameter(InterpreterDispatchDescriptor::kContextParameter)); 40 context_.Bind(Parameter(InterpreterDispatchDescriptor::kContextParameter));
41 bytecode_array_.Bind( 41 bytecode_array_.Bind(
42 Parameter(InterpreterDispatchDescriptor::kBytecodeArrayParameter)); 42 Parameter(InterpreterDispatchDescriptor::kBytecodeArrayParameter));
43 if (FLAG_trace_ignition) { 43 if (FLAG_trace_ignition) {
44 TraceBytecode(Runtime::kInterpreterTraceBytecodeEntry); 44 TraceBytecode(Runtime::kInterpreterTraceBytecodeEntry);
45 } 45 }
46 if (FLAG_ignition_count_handler_dispatches) {
47 IncrementDispatchCounter();
48 }
46 } 49 }
47 50
48 InterpreterAssembler::~InterpreterAssembler() {} 51 InterpreterAssembler::~InterpreterAssembler() {}
49 52
50 Node* InterpreterAssembler::GetAccumulator() { return accumulator_.value(); } 53 Node* InterpreterAssembler::GetAccumulator() { return accumulator_.value(); }
51 54
52 void InterpreterAssembler::SetAccumulator(Node* value) { 55 void InterpreterAssembler::SetAccumulator(Node* value) {
53 accumulator_.Bind(value); 56 accumulator_.Bind(value);
54 } 57 }
55 58
(...skipping 547 matching lines...) Expand 10 before | Expand all | Expand 10 after
603 Node* profiling_weight = 606 Node* profiling_weight =
604 Int32Sub(Int32Constant(kHeapObjectTag + BytecodeArray::kHeaderSize), 607 Int32Sub(Int32Constant(kHeapObjectTag + BytecodeArray::kHeaderSize),
605 BytecodeOffset()); 608 BytecodeOffset());
606 UpdateInterruptBudget(profiling_weight); 609 UpdateInterruptBudget(profiling_weight);
607 610
608 Node* exit_trampoline_code_object = 611 Node* exit_trampoline_code_object =
609 HeapConstant(isolate()->builtins()->InterpreterExitTrampoline()); 612 HeapConstant(isolate()->builtins()->InterpreterExitTrampoline());
610 DispatchToBytecodeHandler(exit_trampoline_code_object); 613 DispatchToBytecodeHandler(exit_trampoline_code_object);
611 } 614 }
612 615
616 void InterpreterAssembler::IncrementDispatchCounter() {
617 Node* counters = ExternalConstant(
618 ExternalReference::interpreter_handlers_dispatch_counters(isolate()));
619 Node* counter_offset =
620 IntPtrConstant(static_cast<int>(bytecode_) * sizeof(uint32_t));
621 Node* old_counter = Load(MachineType::Uint32(), counters, counter_offset);
622 Node* new_counter = Int32Add(old_counter, Int32Constant(1));
623
624 if (FLAG_debug_code) { // overflow checking on counters
625 CodeStubAssembler::Label after_overflow_detection(this);
626 CodeStubAssembler::Label overflow_detected(this);
627 CodeStubAssembler::Label end(this);
628
629 Node* new_counter_is_zero = Word32Equal(new_counter, Int32Constant(0));
630 Branch(new_counter_is_zero, &overflow_detected, &after_overflow_detection);
631 Bind(&overflow_detected);
632 Abort(BailoutReason::kInterpreterHandlersDispatchCounterOverflow);
633 Goto(&end);
634 Bind(&after_overflow_detection);
635 Goto(&end);
636 Bind(&end);
637 }
638
639 StoreNoWriteBarrier(MachineRepresentation::kWord32, counters, counter_offset,
640 new_counter);
641 }
642
613 void InterpreterAssembler::StackCheck() { 643 void InterpreterAssembler::StackCheck() {
614 CodeStubAssembler::Label end(this); 644 CodeStubAssembler::Label end(this);
615 CodeStubAssembler::Label ok(this); 645 CodeStubAssembler::Label ok(this);
616 CodeStubAssembler::Label stack_guard(this); 646 CodeStubAssembler::Label stack_guard(this);
617 647
618 Node* sp = LoadStackPointer(); 648 Node* sp = LoadStackPointer();
619 Node* stack_limit = Load( 649 Node* stack_limit = Load(
620 MachineType::Pointer(), 650 MachineType::Pointer(),
621 ExternalConstant(ExternalReference::address_of_stack_limit(isolate()))); 651 ExternalConstant(ExternalReference::address_of_stack_limit(isolate())));
622 Node* condition = UintPtrGreaterThanOrEqual(sp, stack_limit); 652 Node* condition = UintPtrGreaterThanOrEqual(sp, stack_limit);
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
667 V8_TARGET_ARCH_S390 697 V8_TARGET_ARCH_S390
668 return true; 698 return true;
669 #else 699 #else
670 #error "Unknown Architecture" 700 #error "Unknown Architecture"
671 #endif 701 #endif
672 } 702 }
673 703
674 } // namespace interpreter 704 } // namespace interpreter
675 } // namespace internal 705 } // namespace internal
676 } // namespace v8 706 } // namespace v8
OLDNEW
« src/interpreter/interpreter.h ('K') | « src/interpreter/interpreter-assembler.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698