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

Side by Side Diff: src/vm-state-inl.h

Issue 1771323003: [counter] reducing the overhead of RuntimeCallTimerScope (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: further reducing overhead 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
« no previous file with comments | « src/d8.cc ('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 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 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 #ifndef V8_VM_STATE_INL_H_ 5 #ifndef V8_VM_STATE_INL_H_
6 #define V8_VM_STATE_INL_H_ 6 #define V8_VM_STATE_INL_H_
7 7
8 #include "src/vm-state.h" 8 #include "src/vm-state.h"
9 #include "src/log.h" 9 #include "src/log.h"
10 #include "src/simulator.h" 10 #include "src/simulator.h"
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 VMState<Tag>::~VMState() { 51 VMState<Tag>::~VMState() {
52 if (FLAG_log_timer_events && previous_tag_ != EXTERNAL && Tag == EXTERNAL) { 52 if (FLAG_log_timer_events && previous_tag_ != EXTERNAL && Tag == EXTERNAL) {
53 LOG(isolate_, TimerEvent(Logger::END, TimerEventExternal::name())); 53 LOG(isolate_, TimerEvent(Logger::END, TimerEventExternal::name()));
54 } 54 }
55 isolate_->set_current_vm_state(previous_tag_); 55 isolate_->set_current_vm_state(previous_tag_);
56 } 56 }
57 57
58 ExternalCallbackScope::ExternalCallbackScope(Isolate* isolate, Address callback) 58 ExternalCallbackScope::ExternalCallbackScope(Isolate* isolate, Address callback)
59 : isolate_(isolate), 59 : isolate_(isolate),
60 callback_(callback), 60 callback_(callback),
61 previous_scope_(isolate->external_callback_scope()), 61 previous_scope_(isolate->external_callback_scope()) {
62 timer_(&isolate->counters()->runtime_call_stats()->ExternalCallback,
63 isolate->counters()->runtime_call_stats()->current_timer()) {
64 #ifdef USE_SIMULATOR 62 #ifdef USE_SIMULATOR
65 scope_address_ = Simulator::current(isolate)->get_sp(); 63 scope_address_ = Simulator::current(isolate)->get_sp();
66 #endif 64 #endif
67 isolate_->set_external_callback_scope(this); 65 isolate_->set_external_callback_scope(this);
68 if (FLAG_runtime_call_stats) { 66 if (FLAG_runtime_call_stats) {
69 isolate_->counters()->runtime_call_stats()->Enter(&timer_); 67 RuntimeCallStats* stats = isolate->counters()->runtime_call_stats();
68 timer_.Initialize(&stats->ExternalCallback, stats->current_timer());
69 stats->Enter(&timer_);
70 } 70 }
71 } 71 }
72 72
73 ExternalCallbackScope::~ExternalCallbackScope() { 73 ExternalCallbackScope::~ExternalCallbackScope() {
74 if (FLAG_runtime_call_stats) { 74 if (FLAG_runtime_call_stats) {
75 isolate_->counters()->runtime_call_stats()->Leave(&timer_); 75 isolate_->counters()->runtime_call_stats()->Leave(&timer_);
76 } 76 }
77 isolate_->set_external_callback_scope(previous_scope_); 77 isolate_->set_external_callback_scope(previous_scope_);
78 } 78 }
79 79
80 Address ExternalCallbackScope::scope_address() { 80 Address ExternalCallbackScope::scope_address() {
81 #ifdef USE_SIMULATOR 81 #ifdef USE_SIMULATOR
82 return scope_address_; 82 return scope_address_;
83 #else 83 #else
84 return reinterpret_cast<Address>(this); 84 return reinterpret_cast<Address>(this);
85 #endif 85 #endif
86 } 86 }
87 87
88 88
89 } // namespace internal 89 } // namespace internal
90 } // namespace v8 90 } // namespace v8
91 91
92 #endif // V8_VM_STATE_INL_H_ 92 #endif // V8_VM_STATE_INL_H_
OLDNEW
« no previous file with comments | « src/d8.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698