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

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

Issue 2296243002: [RuntimeCallStats] Move tracing runtime instrumentation closer to the original version. (Closed)
Patch Set: Rebase Created 4 years, 3 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); \
25 VMState<EXTERNAL> state(isolate); \ 23 VMState<EXTERNAL> state(isolate); \
26 ExternalCallbackScope call_scope(isolate, FUNCTION_ADDR(f)); \ 24 ExternalCallbackScope call_scope(isolate, FUNCTION_ADDR(f)); \
27 PropertyCallbackInfo<ApiReturn> info(begin()); \ 25 PropertyCallbackInfo<ApiReturn> info(begin()); \
28 LOG(isolate, \ 26 LOG(isolate, \
29 ApiNamedPropertyAccess("interceptor-named-" type, holder(), *name)); \ 27 ApiNamedPropertyAccess("interceptor-named-" type, holder(), *name)); \
30 f(v8::Utils::ToLocal(name), info); \ 28 f(v8::Utils::ToLocal(name), info); \
31 return GetReturnValue<InternalReturn>(isolate); \ 29 return GetReturnValue<InternalReturn>(isolate); \
32 } 30 }
33 31
34 FOR_EACH_CALLBACK_TABLE_MAPPING_1_NAME(WRITE_CALL_1_NAME) 32 FOR_EACH_CALLBACK_TABLE_MAPPING_1_NAME(WRITE_CALL_1_NAME)
35 33
36 #undef FOR_EACH_CALLBACK_TABLE_MAPPING_1_NAME 34 #undef FOR_EACH_CALLBACK_TABLE_MAPPING_1_NAME
37 #undef WRITE_CALL_1_NAME 35 #undef WRITE_CALL_1_NAME
38 36
39 #define FOR_EACH_CALLBACK_TABLE_MAPPING_1_INDEX(F) \ 37 #define FOR_EACH_CALLBACK_TABLE_MAPPING_1_INDEX(F) \
40 F(IndexedPropertyGetterCallback, "get", v8::Value, Object) \ 38 F(IndexedPropertyGetterCallback, "get", v8::Value, Object) \
41 F(IndexedPropertyQueryCallback, "has", v8::Integer, Object) \ 39 F(IndexedPropertyQueryCallback, "has", v8::Integer, Object) \
42 F(IndexedPropertyDeleterCallback, "delete", v8::Boolean, Object) 40 F(IndexedPropertyDeleterCallback, "delete", v8::Boolean, Object)
43 41
44 #define WRITE_CALL_1_INDEX(Function, type, ApiReturn, InternalReturn) \ 42 #define WRITE_CALL_1_INDEX(Function, type, ApiReturn, InternalReturn) \
45 Handle<InternalReturn> PropertyCallbackArguments::Call(Function f, \ 43 Handle<InternalReturn> PropertyCallbackArguments::Call(Function f, \
46 uint32_t index) { \ 44 uint32_t index) { \
47 Isolate* isolate = this->isolate(); \ 45 Isolate* isolate = this->isolate(); \
48 RuntimeCallTimerScope timer(isolate, &RuntimeCallStats::Function); \ 46 RuntimeCallTimerScope timer(isolate, &RuntimeCallStats::Function); \
49 TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_SCOPED( \
50 isolate, &tracing::TraceEventStatsTable::Function); \
51 VMState<EXTERNAL> state(isolate); \ 47 VMState<EXTERNAL> state(isolate); \
52 ExternalCallbackScope call_scope(isolate, FUNCTION_ADDR(f)); \ 48 ExternalCallbackScope call_scope(isolate, FUNCTION_ADDR(f)); \
53 PropertyCallbackInfo<ApiReturn> info(begin()); \ 49 PropertyCallbackInfo<ApiReturn> info(begin()); \
54 LOG(isolate, ApiIndexedPropertyAccess("interceptor-indexed-" type, \ 50 LOG(isolate, ApiIndexedPropertyAccess("interceptor-indexed-" type, \
55 holder(), index)); \ 51 holder(), index)); \
56 f(index, info); \ 52 f(index, info); \
57 return GetReturnValue<InternalReturn>(isolate); \ 53 return GetReturnValue<InternalReturn>(isolate); \
58 } 54 }
59 55
60 FOR_EACH_CALLBACK_TABLE_MAPPING_1_INDEX(WRITE_CALL_1_INDEX) 56 FOR_EACH_CALLBACK_TABLE_MAPPING_1_INDEX(WRITE_CALL_1_INDEX)
61 57
62 #undef FOR_EACH_CALLBACK_TABLE_MAPPING_1_INDEX 58 #undef FOR_EACH_CALLBACK_TABLE_MAPPING_1_INDEX
63 #undef WRITE_CALL_1_INDEX 59 #undef WRITE_CALL_1_INDEX
64 60
65 Handle<Object> PropertyCallbackArguments::Call( 61 Handle<Object> PropertyCallbackArguments::Call(
66 GenericNamedPropertySetterCallback f, Handle<Name> name, 62 GenericNamedPropertySetterCallback f, Handle<Name> name,
67 Handle<Object> value) { 63 Handle<Object> value) {
68 Isolate* isolate = this->isolate(); 64 Isolate* isolate = this->isolate();
69 RuntimeCallTimerScope timer( 65 RuntimeCallTimerScope timer(
70 isolate, &RuntimeCallStats::GenericNamedPropertySetterCallback); 66 isolate, &RuntimeCallStats::GenericNamedPropertySetterCallback);
71 TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_SCOPED(
72 isolate,
73 &tracing::TraceEventStatsTable::GenericNamedPropertySetterCallback);
74 VMState<EXTERNAL> state(isolate); 67 VMState<EXTERNAL> state(isolate);
75 ExternalCallbackScope call_scope(isolate, FUNCTION_ADDR(f)); 68 ExternalCallbackScope call_scope(isolate, FUNCTION_ADDR(f));
76 PropertyCallbackInfo<v8::Value> info(begin()); 69 PropertyCallbackInfo<v8::Value> info(begin());
77 LOG(isolate, 70 LOG(isolate,
78 ApiNamedPropertyAccess("interceptor-named-set", holder(), *name)); 71 ApiNamedPropertyAccess("interceptor-named-set", holder(), *name));
79 f(v8::Utils::ToLocal(name), v8::Utils::ToLocal(value), info); 72 f(v8::Utils::ToLocal(name), v8::Utils::ToLocal(value), info);
80 return GetReturnValue<Object>(isolate); 73 return GetReturnValue<Object>(isolate);
81 } 74 }
82 75
83 Handle<Object> PropertyCallbackArguments::Call( 76 Handle<Object> PropertyCallbackArguments::Call(
84 GenericNamedPropertyDefinerCallback f, Handle<Name> name, 77 GenericNamedPropertyDefinerCallback f, Handle<Name> name,
85 const v8::PropertyDescriptor& desc) { 78 const v8::PropertyDescriptor& desc) {
86 Isolate* isolate = this->isolate(); 79 Isolate* isolate = this->isolate();
87 RuntimeCallTimerScope timer( 80 RuntimeCallTimerScope timer(
88 isolate, &RuntimeCallStats::GenericNamedPropertyDefinerCallback); 81 isolate, &RuntimeCallStats::GenericNamedPropertyDefinerCallback);
89 TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_SCOPED(
90 isolate,
91 &tracing::TraceEventStatsTable::GenericNamedPropertyDefinerCallback);
92 VMState<EXTERNAL> state(isolate); 82 VMState<EXTERNAL> state(isolate);
93 ExternalCallbackScope call_scope(isolate, FUNCTION_ADDR(f)); 83 ExternalCallbackScope call_scope(isolate, FUNCTION_ADDR(f));
94 PropertyCallbackInfo<v8::Value> info(begin()); 84 PropertyCallbackInfo<v8::Value> info(begin());
95 LOG(isolate, 85 LOG(isolate,
96 ApiNamedPropertyAccess("interceptor-named-define", holder(), *name)); 86 ApiNamedPropertyAccess("interceptor-named-define", holder(), *name));
97 f(v8::Utils::ToLocal(name), desc, info); 87 f(v8::Utils::ToLocal(name), desc, info);
98 return GetReturnValue<Object>(isolate); 88 return GetReturnValue<Object>(isolate);
99 } 89 }
100 90
101 Handle<Object> PropertyCallbackArguments::Call(IndexedPropertySetterCallback f, 91 Handle<Object> PropertyCallbackArguments::Call(IndexedPropertySetterCallback f,
102 uint32_t index, 92 uint32_t index,
103 Handle<Object> value) { 93 Handle<Object> value) {
104 Isolate* isolate = this->isolate(); 94 Isolate* isolate = this->isolate();
105 RuntimeCallTimerScope timer(isolate, 95 RuntimeCallTimerScope timer(isolate,
106 &RuntimeCallStats::IndexedPropertySetterCallback); 96 &RuntimeCallStats::IndexedPropertySetterCallback);
107 TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_SCOPED(
108 isolate, &tracing::TraceEventStatsTable::IndexedPropertySetterCallback);
109 VMState<EXTERNAL> state(isolate); 97 VMState<EXTERNAL> state(isolate);
110 ExternalCallbackScope call_scope(isolate, FUNCTION_ADDR(f)); 98 ExternalCallbackScope call_scope(isolate, FUNCTION_ADDR(f));
111 PropertyCallbackInfo<v8::Value> info(begin()); 99 PropertyCallbackInfo<v8::Value> info(begin());
112 LOG(isolate, 100 LOG(isolate,
113 ApiIndexedPropertyAccess("interceptor-indexed-set", holder(), index)); 101 ApiIndexedPropertyAccess("interceptor-indexed-set", holder(), index));
114 f(index, v8::Utils::ToLocal(value), info); 102 f(index, v8::Utils::ToLocal(value), info);
115 return GetReturnValue<Object>(isolate); 103 return GetReturnValue<Object>(isolate);
116 } 104 }
117 105
118 Handle<Object> PropertyCallbackArguments::Call( 106 Handle<Object> PropertyCallbackArguments::Call(
119 IndexedPropertyDefinerCallback f, uint32_t index, 107 IndexedPropertyDefinerCallback f, uint32_t index,
120 const v8::PropertyDescriptor& desc) { 108 const v8::PropertyDescriptor& desc) {
121 Isolate* isolate = this->isolate(); 109 Isolate* isolate = this->isolate();
122 RuntimeCallTimerScope timer( 110 RuntimeCallTimerScope timer(
123 isolate, &RuntimeCallStats::IndexedPropertyDefinerCallback); 111 isolate, &RuntimeCallStats::IndexedPropertyDefinerCallback);
124 TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_SCOPED(
125 isolate, &tracing::TraceEventStatsTable::IndexedPropertyDefinerCallback);
126 VMState<EXTERNAL> state(isolate); 112 VMState<EXTERNAL> state(isolate);
127 ExternalCallbackScope call_scope(isolate, FUNCTION_ADDR(f)); 113 ExternalCallbackScope call_scope(isolate, FUNCTION_ADDR(f));
128 PropertyCallbackInfo<v8::Value> info(begin()); 114 PropertyCallbackInfo<v8::Value> info(begin());
129 LOG(isolate, 115 LOG(isolate,
130 ApiIndexedPropertyAccess("interceptor-indexed-define", holder(), index)); 116 ApiIndexedPropertyAccess("interceptor-indexed-define", holder(), index));
131 f(index, desc, info); 117 f(index, desc, info);
132 return GetReturnValue<Object>(isolate); 118 return GetReturnValue<Object>(isolate);
133 } 119 }
134 120
135 void PropertyCallbackArguments::Call(AccessorNameSetterCallback f, 121 void PropertyCallbackArguments::Call(AccessorNameSetterCallback f,
136 Handle<Name> name, Handle<Object> value) { 122 Handle<Name> name, Handle<Object> value) {
137 Isolate* isolate = this->isolate(); 123 Isolate* isolate = this->isolate();
138 RuntimeCallTimerScope timer(isolate, 124 RuntimeCallTimerScope timer(isolate,
139 &RuntimeCallStats::AccessorNameSetterCallback); 125 &RuntimeCallStats::AccessorNameSetterCallback);
140 TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_SCOPED(
141 isolate, &tracing::TraceEventStatsTable::AccessorNameSetterCallback);
142 VMState<EXTERNAL> state(isolate); 126 VMState<EXTERNAL> state(isolate);
143 ExternalCallbackScope call_scope(isolate, FUNCTION_ADDR(f)); 127 ExternalCallbackScope call_scope(isolate, FUNCTION_ADDR(f));
144 PropertyCallbackInfo<void> info(begin()); 128 PropertyCallbackInfo<void> info(begin());
145 LOG(isolate, 129 LOG(isolate,
146 ApiNamedPropertyAccess("interceptor-named-set", holder(), *name)); 130 ApiNamedPropertyAccess("interceptor-named-set", holder(), *name));
147 f(v8::Utils::ToLocal(name), v8::Utils::ToLocal(value), info); 131 f(v8::Utils::ToLocal(name), v8::Utils::ToLocal(value), info);
148 } 132 }
149 133
150 } // namespace internal 134 } // namespace internal
151 } // namespace v8 135 } // 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