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

Side by Side Diff: src/log-inl.h

Issue 988893003: Implement tracing interface for v8 (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Remove v8-tracing in favor of v8-platform, make passing Isolate* explicit, still WIP Created 5 years, 2 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 2006-2009 the V8 project authors. All rights reserved. 1 // Copyright 2006-2009 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_LOG_INL_H_ 5 #ifndef V8_LOG_INL_H_
6 #define V8_LOG_INL_H_ 6 #define V8_LOG_INL_H_
7 7
8 #include "src/log.h" 8 #include "src/log.h"
9 #include "src/isolate.h" 9 #include "src/isolate.h"
10 #include "src/objects-inl.h" 10 #include "src/objects-inl.h"
11 #include "src/tracing/trace-event.h"
11 12
12 namespace v8 { 13 namespace v8 {
13 namespace internal { 14 namespace internal {
14 15
15 Logger::LogEventsAndTags Logger::ToNativeByScript(Logger::LogEventsAndTags tag, 16 Logger::LogEventsAndTags Logger::ToNativeByScript(Logger::LogEventsAndTags tag,
16 Script* script) { 17 Script* script) {
17 if ((tag == FUNCTION_TAG || tag == LAZY_COMPILE_TAG || tag == SCRIPT_TAG) 18 if ((tag == FUNCTION_TAG || tag == LAZY_COMPILE_TAG || tag == SCRIPT_TAG)
18 && script->type()->value() == Script::TYPE_NATIVE) { 19 && script->type()->value() == Script::TYPE_NATIVE) {
19 switch (tag) { 20 switch (tag) {
20 case FUNCTION_TAG: return NATIVE_FUNCTION_TAG; 21 case FUNCTION_TAG: return NATIVE_FUNCTION_TAG;
21 case LAZY_COMPILE_TAG: return NATIVE_LAZY_COMPILE_TAG; 22 case LAZY_COMPILE_TAG: return NATIVE_LAZY_COMPILE_TAG;
22 case SCRIPT_TAG: return NATIVE_SCRIPT_TAG; 23 case SCRIPT_TAG: return NATIVE_SCRIPT_TAG;
23 default: return tag; 24 default: return tag;
24 } 25 }
25 } else { 26 } else {
26 return tag; 27 return tag;
27 } 28 }
28 } 29 }
29 30
30 31
31 void Logger::CallEventLogger(Isolate* isolate, const char* name, StartEnd se, 32 void Logger::CallEventLogger(Isolate* isolate, const char* name, StartEnd se,
32 bool expose_to_api) { 33 bool expose_to_api) {
33 if (isolate->event_logger() != NULL) { 34 if (isolate->event_logger() != NULL) {
34 if (isolate->event_logger() == DefaultEventLoggerSentinel) { 35 if (isolate->event_logger() == DefaultEventLoggerSentinel) {
35 LOG(isolate, TimerEvent(se, name)); 36 LOG(isolate, TimerEvent(se, name));
36 } else if (expose_to_api) { 37 } else if (expose_to_api) {
37 isolate->event_logger()(name, se); 38 isolate->event_logger()(name, se);
39 if (se == START) {
40 TRACE_EVENT_BEGIN_WITH_CONTEXT_ID0("v8", name, (uint64_t)isolate);
41 } else {
42 TRACE_EVENT_END_WITH_CONTEXT_ID0("v8", name, (uint64_t)isolate);
noordhuis 2015/10/07 18:31:54 Style: use static_cast/reinterpret_cast here. Sho
fmeawad 2015/11/19 02:00:47 Done.
43 }
38 } 44 }
39 } 45 }
40 } 46 }
41 } } // namespace v8::internal 47 } } // namespace v8::internal
42 48
43 #endif // V8_LOG_INL_H_ 49 #endif // V8_LOG_INL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698