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

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: 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
« src/d8.cc ('K') | « src/interpreter/interpreter-assembler.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 23 matching lines...) Expand all
34 disable_stack_check_across_call_(false), 34 disable_stack_check_across_call_(false),
35 stack_pointer_before_call_(nullptr) { 35 stack_pointer_before_call_(nullptr) {
36 accumulator_.Bind( 36 accumulator_.Bind(
37 Parameter(InterpreterDispatchDescriptor::kAccumulatorParameter)); 37 Parameter(InterpreterDispatchDescriptor::kAccumulatorParameter));
38 context_.Bind(Parameter(InterpreterDispatchDescriptor::kContextParameter)); 38 context_.Bind(Parameter(InterpreterDispatchDescriptor::kContextParameter));
39 bytecode_array_.Bind( 39 bytecode_array_.Bind(
40 Parameter(InterpreterDispatchDescriptor::kBytecodeArrayParameter)); 40 Parameter(InterpreterDispatchDescriptor::kBytecodeArrayParameter));
41 if (FLAG_trace_ignition) { 41 if (FLAG_trace_ignition) {
42 TraceBytecode(Runtime::kInterpreterTraceBytecodeEntry); 42 TraceBytecode(Runtime::kInterpreterTraceBytecodeEntry);
43 } 43 }
44 if (FLAG_ignition_count_handler_dispatches) {
45 IncrementDispatchCounter();
46 }
44 } 47 }
45 48
46 InterpreterAssembler::~InterpreterAssembler() {} 49 InterpreterAssembler::~InterpreterAssembler() {}
47 50
48 Node* InterpreterAssembler::GetAccumulator() { return accumulator_.value(); } 51 Node* InterpreterAssembler::GetAccumulator() { return accumulator_.value(); }
49 52
50 void InterpreterAssembler::SetAccumulator(Node* value) { 53 void InterpreterAssembler::SetAccumulator(Node* value) {
51 accumulator_.Bind(value); 54 accumulator_.Bind(value);
52 } 55 }
53 56
(...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after
473 Node* profiling_weight = 476 Node* profiling_weight =
474 Int32Sub(Int32Constant(kHeapObjectTag + BytecodeArray::kHeaderSize), 477 Int32Sub(Int32Constant(kHeapObjectTag + BytecodeArray::kHeaderSize),
475 BytecodeOffset()); 478 BytecodeOffset());
476 UpdateInterruptBudget(profiling_weight); 479 UpdateInterruptBudget(profiling_weight);
477 480
478 Node* exit_trampoline_code_object = 481 Node* exit_trampoline_code_object =
479 HeapConstant(isolate()->builtins()->InterpreterExitTrampoline()); 482 HeapConstant(isolate()->builtins()->InterpreterExitTrampoline());
480 DispatchToBytecodeHandler(exit_trampoline_code_object); 483 DispatchToBytecodeHandler(exit_trampoline_code_object);
481 } 484 }
482 485
486 void InterpreterAssembler::IncrementDispatchCounter() {
487 Node* counters = ExternalConstant(
488 ExternalReference::interpreter_handlers_dispatch_counters(isolate()));
489 Node* counter_offset =
490 IntPtrConstant(static_cast<int>(bytecode_) * sizeof(uint32_t));
491 Node* old_counter = Load(MachineType::Uint32(), counters, counter_offset);
492 Node* new_counter = Int32Add(old_counter, Int32Constant(1));
493
494 if (FLAG_debug_code) { // overflow checking on counters
495 CodeStubAssembler::Label after_overflow_detection(this);
496 CodeStubAssembler::Label overflow_detected(this);
497 CodeStubAssembler::Label end(this);
498
499 Node* new_counter_is_zero = Word32Equal(new_counter, Int32Constant(0));
500 Branch(new_counter_is_zero, &overflow_detected, &after_overflow_detection);
501 Bind(&overflow_detected);
502 Abort(BailoutReason::kInterpreterHandlersDispatchCounterOverflow);
503 Goto(&end);
504 Bind(&after_overflow_detection);
505 Goto(&end);
506 Bind(&end);
507 }
508
509 StoreNoWriteBarrier(MachineRepresentation::kWord32, counters, counter_offset,
510 new_counter);
511 }
512
483 void InterpreterAssembler::StackCheck() { 513 void InterpreterAssembler::StackCheck() {
484 CodeStubAssembler::Label end(this); 514 CodeStubAssembler::Label end(this);
485 CodeStubAssembler::Label ok(this); 515 CodeStubAssembler::Label ok(this);
486 CodeStubAssembler::Label stack_guard(this); 516 CodeStubAssembler::Label stack_guard(this);
487 517
488 Node* sp = LoadStackPointer(); 518 Node* sp = LoadStackPointer();
489 Node* stack_limit = Load( 519 Node* stack_limit = Load(
490 MachineType::Pointer(), 520 MachineType::Pointer(),
491 ExternalConstant(ExternalReference::address_of_stack_limit(isolate()))); 521 ExternalConstant(ExternalReference::address_of_stack_limit(isolate())));
492 Node* condition = UintPtrGreaterThanOrEqual(sp, stack_limit); 522 Node* condition = UintPtrGreaterThanOrEqual(sp, stack_limit);
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
537 V8_TARGET_ARCH_S390 567 V8_TARGET_ARCH_S390
538 return true; 568 return true;
539 #else 569 #else
540 #error "Unknown Architecture" 570 #error "Unknown Architecture"
541 #endif 571 #endif
542 } 572 }
543 573
544 } // namespace interpreter 574 } // namespace interpreter
545 } // namespace internal 575 } // namespace internal
546 } // namespace v8 576 } // namespace v8
OLDNEW
« src/d8.cc ('K') | « src/interpreter/interpreter-assembler.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698