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

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: Remove unused bailout reason, rebase on master. Created 4 years, 8 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 <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
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_ignition_count_handler_dispatches) {
48 IncrementDispatchCounter();
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 547 matching lines...) Expand 10 before | Expand all | Expand 10 after
603 Node* profiling_weight = 607 Node* profiling_weight =
604 Int32Sub(Int32Constant(kHeapObjectTag + BytecodeArray::kHeaderSize), 608 Int32Sub(Int32Constant(kHeapObjectTag + BytecodeArray::kHeaderSize),
605 BytecodeOffset()); 609 BytecodeOffset());
606 UpdateInterruptBudget(profiling_weight); 610 UpdateInterruptBudget(profiling_weight);
607 611
608 Node* exit_trampoline_code_object = 612 Node* exit_trampoline_code_object =
609 HeapConstant(isolate()->builtins()->InterpreterExitTrampoline()); 613 HeapConstant(isolate()->builtins()->InterpreterExitTrampoline());
610 DispatchToBytecodeHandler(exit_trampoline_code_object); 614 DispatchToBytecodeHandler(exit_trampoline_code_object);
611 } 615 }
612 616
617 void InterpreterAssembler::IncrementDispatchCounter() {
rmcilroy 2016/04/05 10:00:46 nit - could you move this to be near TraceBytecode
Stefano Sanfilippo 2016/04/05 14:01:46 Done.
618 Node* counters = ExternalConstant(
619 ExternalReference::interpreter_handlers_dispatch_counters(isolate()));
620 Node* counter_offset =
621 IntPtrConstant(static_cast<int>(bytecode_) * sizeof(uint32_t));
622 Node* old_counter = Load(MachineType::Uint32(), counters, counter_offset);
623
624 CodeStubAssembler::Label counter_ok(this);
625 CodeStubAssembler::Label counter_saturated(this);
626 CodeStubAssembler::Label end(this);
627
628 Node* counter_reached_max = Word32Equal(
629 old_counter, Int32Constant(std::numeric_limits<uint32_t>::max()));
630 Branch(counter_reached_max, &counter_saturated, &counter_ok);
631 Bind(&counter_ok);
632 Node* new_counter = Int32Add(old_counter, Int32Constant(1));
633 StoreNoWriteBarrier(MachineRepresentation::kWord32, counters, counter_offset,
634 new_counter);
635 Goto(&end);
636 Bind(&counter_saturated);
637 Goto(&end);
638 Bind(&end);
639 }
640
613 void InterpreterAssembler::StackCheck() { 641 void InterpreterAssembler::StackCheck() {
614 CodeStubAssembler::Label end(this); 642 CodeStubAssembler::Label end(this);
615 CodeStubAssembler::Label ok(this); 643 CodeStubAssembler::Label ok(this);
616 CodeStubAssembler::Label stack_guard(this); 644 CodeStubAssembler::Label stack_guard(this);
617 645
618 Node* sp = LoadStackPointer(); 646 Node* sp = LoadStackPointer();
619 Node* stack_limit = Load( 647 Node* stack_limit = Load(
620 MachineType::Pointer(), 648 MachineType::Pointer(),
621 ExternalConstant(ExternalReference::address_of_stack_limit(isolate()))); 649 ExternalConstant(ExternalReference::address_of_stack_limit(isolate())));
622 Node* condition = UintPtrGreaterThanOrEqual(sp, stack_limit); 650 Node* condition = UintPtrGreaterThanOrEqual(sp, stack_limit);
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
667 V8_TARGET_ARCH_S390 695 V8_TARGET_ARCH_S390
668 return true; 696 return true;
669 #else 697 #else
670 #error "Unknown Architecture" 698 #error "Unknown Architecture"
671 #endif 699 #endif
672 } 700 }
673 701
674 } // namespace interpreter 702 } // namespace interpreter
675 } // namespace internal 703 } // namespace internal
676 } // namespace v8 704 } // namespace v8
OLDNEW
« src/interpreter/interpreter-assembler.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