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

Side by Side Diff: src/api-arguments-inl.h

Issue 2187693002: [Tracing] Embed V8 runtime call stats into tracing. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix memory leak Created 4 years, 4 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/api-arguments.cc ('k') | src/arguments.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 the V8 project authors. All rights reserved. 1 // Copyright 2016 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/api-arguments.h" 5 #include "src/api-arguments.h"
6 6
7 #include "src/tracing/trace-event.h" 7 #include "src/tracing/trace-event.h"
8 #include "src/vm-state-inl.h" 8 #include "src/vm-state-inl.h"
9 9
10 namespace v8 { 10 namespace v8 {
11 namespace internal { 11 namespace internal {
12 12
13 #define FOR_EACH_CALLBACK_TABLE_MAPPING_1_NAME(F) \ 13 #define FOR_EACH_CALLBACK_TABLE_MAPPING_1_NAME(F) \
14 F(AccessorNameGetterCallback, "get", v8::Value, Object) \ 14 F(AccessorNameGetterCallback, "get", v8::Value, Object) \
15 F(GenericNamedPropertyQueryCallback, "has", v8::Integer, Object) \ 15 F(GenericNamedPropertyQueryCallback, "has", v8::Integer, Object) \
16 F(GenericNamedPropertyDeleterCallback, "delete", v8::Boolean, Object) 16 F(GenericNamedPropertyDeleterCallback, "delete", v8::Boolean, Object)
17 17
18 #define WRITE_CALL_1_NAME(Function, type, ApiReturn, InternalReturn) \ 18 #define WRITE_CALL_1_NAME(Function, type, ApiReturn, InternalReturn) \
19 Handle<InternalReturn> PropertyCallbackArguments::Call(Function f, \ 19 Handle<InternalReturn> PropertyCallbackArguments::Call(Function f, \
20 Handle<Name> name) { \ 20 Handle<Name> name) { \
21 Isolate* isolate = this->isolate(); \ 21 Isolate* isolate = this->isolate(); \
22 RuntimeCallTimerScope timer(isolate, &RuntimeCallStats::Function); \ 22 RuntimeCallTimerScope timer(isolate, &RuntimeCallStats::Function); \
23 TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_SCOPED( \
24 isolate, &tracing::TraceEventStatsTable::Function); \
23 VMState<EXTERNAL> state(isolate); \ 25 VMState<EXTERNAL> state(isolate); \
24 ExternalCallbackScope call_scope(isolate, FUNCTION_ADDR(f)); \ 26 ExternalCallbackScope call_scope(isolate, FUNCTION_ADDR(f)); \
25 PropertyCallbackInfo<ApiReturn> info(begin()); \ 27 PropertyCallbackInfo<ApiReturn> info(begin()); \
26 LOG(isolate, \ 28 LOG(isolate, \
27 ApiNamedPropertyAccess("interceptor-named-" type, holder(), *name)); \ 29 ApiNamedPropertyAccess("interceptor-named-" type, holder(), *name)); \
28 f(v8::Utils::ToLocal(name), info); \ 30 f(v8::Utils::ToLocal(name), info); \
29 return GetReturnValue<InternalReturn>(isolate); \ 31 return GetReturnValue<InternalReturn>(isolate); \
30 } 32 }
31 33
32 FOR_EACH_CALLBACK_TABLE_MAPPING_1_NAME(WRITE_CALL_1_NAME) 34 FOR_EACH_CALLBACK_TABLE_MAPPING_1_NAME(WRITE_CALL_1_NAME)
33 35
34 #undef FOR_EACH_CALLBACK_TABLE_MAPPING_1_NAME 36 #undef FOR_EACH_CALLBACK_TABLE_MAPPING_1_NAME
35 #undef WRITE_CALL_1_NAME 37 #undef WRITE_CALL_1_NAME
36 38
37 #define FOR_EACH_CALLBACK_TABLE_MAPPING_1_INDEX(F) \ 39 #define FOR_EACH_CALLBACK_TABLE_MAPPING_1_INDEX(F) \
38 F(IndexedPropertyGetterCallback, "get", v8::Value, Object) \ 40 F(IndexedPropertyGetterCallback, "get", v8::Value, Object) \
39 F(IndexedPropertyQueryCallback, "has", v8::Integer, Object) \ 41 F(IndexedPropertyQueryCallback, "has", v8::Integer, Object) \
40 F(IndexedPropertyDeleterCallback, "delete", v8::Boolean, Object) 42 F(IndexedPropertyDeleterCallback, "delete", v8::Boolean, Object)
41 43
42 #define WRITE_CALL_1_INDEX(Function, type, ApiReturn, InternalReturn) \ 44 #define WRITE_CALL_1_INDEX(Function, type, ApiReturn, InternalReturn) \
43 Handle<InternalReturn> PropertyCallbackArguments::Call(Function f, \ 45 Handle<InternalReturn> PropertyCallbackArguments::Call(Function f, \
44 uint32_t index) { \ 46 uint32_t index) { \
45 Isolate* isolate = this->isolate(); \ 47 Isolate* isolate = this->isolate(); \
46 RuntimeCallTimerScope timer(isolate, &RuntimeCallStats::Function); \ 48 RuntimeCallTimerScope timer(isolate, &RuntimeCallStats::Function); \
49 TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_SCOPED( \
50 isolate, &tracing::TraceEventStatsTable::Function); \
47 VMState<EXTERNAL> state(isolate); \ 51 VMState<EXTERNAL> state(isolate); \
48 ExternalCallbackScope call_scope(isolate, FUNCTION_ADDR(f)); \ 52 ExternalCallbackScope call_scope(isolate, FUNCTION_ADDR(f)); \
49 PropertyCallbackInfo<ApiReturn> info(begin()); \ 53 PropertyCallbackInfo<ApiReturn> info(begin()); \
50 LOG(isolate, ApiIndexedPropertyAccess("interceptor-indexed-" type, \ 54 LOG(isolate, ApiIndexedPropertyAccess("interceptor-indexed-" type, \
51 holder(), index)); \ 55 holder(), index)); \
52 f(index, info); \ 56 f(index, info); \
53 return GetReturnValue<InternalReturn>(isolate); \ 57 return GetReturnValue<InternalReturn>(isolate); \
54 } 58 }
55 59
56 FOR_EACH_CALLBACK_TABLE_MAPPING_1_INDEX(WRITE_CALL_1_INDEX) 60 FOR_EACH_CALLBACK_TABLE_MAPPING_1_INDEX(WRITE_CALL_1_INDEX)
57 61
58 #undef FOR_EACH_CALLBACK_TABLE_MAPPING_1_INDEX 62 #undef FOR_EACH_CALLBACK_TABLE_MAPPING_1_INDEX
59 #undef WRITE_CALL_1_INDEX 63 #undef WRITE_CALL_1_INDEX
60 64
61 Handle<Object> PropertyCallbackArguments::Call( 65 Handle<Object> PropertyCallbackArguments::Call(
62 GenericNamedPropertySetterCallback f, Handle<Name> name, 66 GenericNamedPropertySetterCallback f, Handle<Name> name,
63 Handle<Object> value) { 67 Handle<Object> value) {
64 Isolate* isolate = this->isolate(); 68 Isolate* isolate = this->isolate();
65 RuntimeCallTimerScope timer( 69 RuntimeCallTimerScope timer(
66 isolate, &RuntimeCallStats::GenericNamedPropertySetterCallback); 70 isolate, &RuntimeCallStats::GenericNamedPropertySetterCallback);
71 TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_SCOPED(
72 isolate,
73 &tracing::TraceEventStatsTable::GenericNamedPropertySetterCallback);
67 VMState<EXTERNAL> state(isolate); 74 VMState<EXTERNAL> state(isolate);
68 ExternalCallbackScope call_scope(isolate, FUNCTION_ADDR(f)); 75 ExternalCallbackScope call_scope(isolate, FUNCTION_ADDR(f));
69 PropertyCallbackInfo<v8::Value> info(begin()); 76 PropertyCallbackInfo<v8::Value> info(begin());
70 LOG(isolate, 77 LOG(isolate,
71 ApiNamedPropertyAccess("interceptor-named-set", holder(), *name)); 78 ApiNamedPropertyAccess("interceptor-named-set", holder(), *name));
72 f(v8::Utils::ToLocal(name), v8::Utils::ToLocal(value), info); 79 f(v8::Utils::ToLocal(name), v8::Utils::ToLocal(value), info);
73 return GetReturnValue<Object>(isolate); 80 return GetReturnValue<Object>(isolate);
74 } 81 }
75 82
76 Handle<Object> PropertyCallbackArguments::Call(IndexedPropertySetterCallback f, 83 Handle<Object> PropertyCallbackArguments::Call(IndexedPropertySetterCallback f,
77 uint32_t index, 84 uint32_t index,
78 Handle<Object> value) { 85 Handle<Object> value) {
79 Isolate* isolate = this->isolate(); 86 Isolate* isolate = this->isolate();
80 RuntimeCallTimerScope timer(isolate, 87 RuntimeCallTimerScope timer(isolate,
81 &RuntimeCallStats::IndexedPropertySetterCallback); 88 &RuntimeCallStats::IndexedPropertySetterCallback);
89 TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_SCOPED(
90 isolate, &tracing::TraceEventStatsTable::IndexedPropertySetterCallback);
82 VMState<EXTERNAL> state(isolate); 91 VMState<EXTERNAL> state(isolate);
83 ExternalCallbackScope call_scope(isolate, FUNCTION_ADDR(f)); 92 ExternalCallbackScope call_scope(isolate, FUNCTION_ADDR(f));
84 PropertyCallbackInfo<v8::Value> info(begin()); 93 PropertyCallbackInfo<v8::Value> info(begin());
85 LOG(isolate, 94 LOG(isolate,
86 ApiIndexedPropertyAccess("interceptor-indexed-set", holder(), index)); 95 ApiIndexedPropertyAccess("interceptor-indexed-set", holder(), index));
87 f(index, v8::Utils::ToLocal(value), info); 96 f(index, v8::Utils::ToLocal(value), info);
88 return GetReturnValue<Object>(isolate); 97 return GetReturnValue<Object>(isolate);
89 } 98 }
90 99
91 void PropertyCallbackArguments::Call(AccessorNameSetterCallback f, 100 void PropertyCallbackArguments::Call(AccessorNameSetterCallback f,
92 Handle<Name> name, Handle<Object> value) { 101 Handle<Name> name, Handle<Object> value) {
93 Isolate* isolate = this->isolate(); 102 Isolate* isolate = this->isolate();
94 RuntimeCallTimerScope timer(isolate, 103 RuntimeCallTimerScope timer(isolate,
95 &RuntimeCallStats::AccessorNameSetterCallback); 104 &RuntimeCallStats::AccessorNameSetterCallback);
105 TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_SCOPED(
106 isolate, &tracing::TraceEventStatsTable::AccessorNameSetterCallback);
96 VMState<EXTERNAL> state(isolate); 107 VMState<EXTERNAL> state(isolate);
97 ExternalCallbackScope call_scope(isolate, FUNCTION_ADDR(f)); 108 ExternalCallbackScope call_scope(isolate, FUNCTION_ADDR(f));
98 PropertyCallbackInfo<void> info(begin()); 109 PropertyCallbackInfo<void> info(begin());
99 LOG(isolate, 110 LOG(isolate,
100 ApiNamedPropertyAccess("interceptor-named-set", holder(), *name)); 111 ApiNamedPropertyAccess("interceptor-named-set", holder(), *name));
101 f(v8::Utils::ToLocal(name), v8::Utils::ToLocal(value), info); 112 f(v8::Utils::ToLocal(name), v8::Utils::ToLocal(value), info);
102 } 113 }
103 114
104 } // namespace internal 115 } // namespace internal
105 } // namespace v8 116 } // namespace v8
OLDNEW
« no previous file with comments | « src/api-arguments.cc ('k') | src/arguments.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698