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

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

Issue 2039913002: Make api-arguments.h not include inline headers. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@local_cleanup-includes-type-feedback-vector
Patch Set: Addressed comments. Created 4 years, 6 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 | « BUILD.gn ('k') | src/api-arguments.cc » ('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 #ifndef V8_API_ARGUMENTS_H_ 5 #ifndef V8_API_ARGUMENTS_H_
6 #define V8_API_ARGUMENTS_H_ 6 #define V8_API_ARGUMENTS_H_
7 7
8 #include "src/api.h" 8 #include "src/api.h"
9 #include "src/isolate.h" 9 #include "src/isolate.h"
10 #include "src/tracing/trace-event.h"
11 #include "src/vm-state-inl.h"
12 10
13 namespace v8 { 11 namespace v8 {
14 namespace internal { 12 namespace internal {
15 13
16 // Custom arguments replicate a small segment of stack that can be 14 // Custom arguments replicate a small segment of stack that can be
17 // accessed through an Arguments object the same way the actual stack 15 // accessed through an Arguments object the same way the actual stack
18 // can. 16 // can.
19 template <int kArrayLength> 17 template <int kArrayLength>
20 class CustomArgumentsBase : public Relocatable { 18 class CustomArgumentsBase : public Relocatable {
21 public: 19 public:
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 /* 99 /*
102 * The following Call functions wrap the calling of all callbacks to handle 100 * The following Call functions wrap the calling of all callbacks to handle
103 * calling either the old or the new style callbacks depending on which one 101 * calling either the old or the new style callbacks depending on which one
104 * has been registered. 102 * has been registered.
105 * For old callbacks which return an empty handle, the ReturnValue is checked 103 * For old callbacks which return an empty handle, the ReturnValue is checked
106 * and used if it's been set to anything inside the callback. 104 * and used if it's been set to anything inside the callback.
107 * New style callbacks always use the return value. 105 * New style callbacks always use the return value.
108 */ 106 */
109 Handle<JSObject> Call(IndexedPropertyEnumeratorCallback f); 107 Handle<JSObject> Call(IndexedPropertyEnumeratorCallback f);
110 108
111 #define FOR_EACH_CALLBACK_TABLE_MAPPING_1_NAME(F) \ 109 inline Handle<Object> Call(AccessorNameGetterCallback f, Handle<Name> name);
112 F(AccessorNameGetterCallback, "get", v8::Value, Object) \ 110 inline Handle<Object> Call(GenericNamedPropertyQueryCallback f,
113 F(GenericNamedPropertyQueryCallback, "has", v8::Integer, Object) \ 111 Handle<Name> name);
114 F(GenericNamedPropertyDeleterCallback, "delete", v8::Boolean, Object) 112 inline Handle<Object> Call(GenericNamedPropertyDeleterCallback f,
113 Handle<Name> name);
115 114
116 #define WRITE_CALL_1_NAME(Function, type, ApiReturn, InternalReturn) \ 115 inline Handle<Object> Call(IndexedPropertyGetterCallback f, uint32_t index);
117 Handle<InternalReturn> Call(Function f, Handle<Name> name) { \ 116 inline Handle<Object> Call(IndexedPropertyQueryCallback f, uint32_t index);
118 Isolate* isolate = this->isolate(); \ 117 inline Handle<Object> Call(IndexedPropertyDeleterCallback f, uint32_t index);
119 RuntimeCallTimerScope timer(isolate, &RuntimeCallStats::Function); \
120 VMState<EXTERNAL> state(isolate); \
121 ExternalCallbackScope call_scope(isolate, FUNCTION_ADDR(f)); \
122 PropertyCallbackInfo<ApiReturn> info(begin()); \
123 LOG(isolate, \
124 ApiNamedPropertyAccess("interceptor-named-" type, holder(), *name)); \
125 f(v8::Utils::ToLocal(name), info); \
126 return GetReturnValue<InternalReturn>(isolate); \
127 }
128 118
129 FOR_EACH_CALLBACK_TABLE_MAPPING_1_NAME(WRITE_CALL_1_NAME) 119 inline Handle<Object> Call(GenericNamedPropertySetterCallback f,
120 Handle<Name> name, Handle<Object> value);
130 121
131 #undef FOR_EACH_CALLBACK_TABLE_MAPPING_1_NAME 122 inline Handle<Object> Call(IndexedPropertySetterCallback f, uint32_t index,
132 #undef WRITE_CALL_1_NAME 123 Handle<Object> value);
133 124
134 #define FOR_EACH_CALLBACK_TABLE_MAPPING_1_INDEX(F) \ 125 inline void Call(AccessorNameSetterCallback f, Handle<Name> name,
135 F(IndexedPropertyGetterCallback, "get", v8::Value, Object) \ 126 Handle<Object> value);
136 F(IndexedPropertyQueryCallback, "has", v8::Integer, Object) \
137 F(IndexedPropertyDeleterCallback, "delete", v8::Boolean, Object)
138
139 #define WRITE_CALL_1_INDEX(Function, type, ApiReturn, InternalReturn) \
140 Handle<InternalReturn> Call(Function f, uint32_t index) { \
141 Isolate* isolate = this->isolate(); \
142 RuntimeCallTimerScope timer(isolate, &RuntimeCallStats::Function); \
143 VMState<EXTERNAL> state(isolate); \
144 ExternalCallbackScope call_scope(isolate, FUNCTION_ADDR(f)); \
145 PropertyCallbackInfo<ApiReturn> info(begin()); \
146 LOG(isolate, ApiIndexedPropertyAccess("interceptor-indexed-" type, \
147 holder(), index)); \
148 f(index, info); \
149 return GetReturnValue<InternalReturn>(isolate); \
150 }
151
152 FOR_EACH_CALLBACK_TABLE_MAPPING_1_INDEX(WRITE_CALL_1_INDEX)
153
154 #undef FOR_EACH_CALLBACK_TABLE_MAPPING_1_INDEX
155 #undef WRITE_CALL_1_INDEX
156
157 Handle<Object> Call(GenericNamedPropertySetterCallback f, Handle<Name> name,
158 Handle<Object> value) {
159 Isolate* isolate = this->isolate();
160 RuntimeCallTimerScope timer(
161 isolate, &RuntimeCallStats::GenericNamedPropertySetterCallback);
162 VMState<EXTERNAL> state(isolate);
163 ExternalCallbackScope call_scope(isolate, FUNCTION_ADDR(f));
164 PropertyCallbackInfo<v8::Value> info(begin());
165 LOG(isolate,
166 ApiNamedPropertyAccess("interceptor-named-set", holder(), *name));
167 f(v8::Utils::ToLocal(name), v8::Utils::ToLocal(value), info);
168 return GetReturnValue<Object>(isolate);
169 }
170
171 Handle<Object> Call(IndexedPropertySetterCallback f, uint32_t index,
172 Handle<Object> value) {
173 Isolate* isolate = this->isolate();
174 RuntimeCallTimerScope timer(
175 isolate, &RuntimeCallStats::IndexedPropertySetterCallback);
176 VMState<EXTERNAL> state(isolate);
177 ExternalCallbackScope call_scope(isolate, FUNCTION_ADDR(f));
178 PropertyCallbackInfo<v8::Value> info(begin());
179 LOG(isolate,
180 ApiIndexedPropertyAccess("interceptor-indexed-set", holder(), index));
181 f(index, v8::Utils::ToLocal(value), info);
182 return GetReturnValue<Object>(isolate);
183 }
184
185 void Call(AccessorNameSetterCallback f, Handle<Name> name,
186 Handle<Object> value) {
187 Isolate* isolate = this->isolate();
188 RuntimeCallTimerScope timer(isolate,
189 &RuntimeCallStats::AccessorNameSetterCallback);
190 VMState<EXTERNAL> state(isolate);
191 ExternalCallbackScope call_scope(isolate, FUNCTION_ADDR(f));
192 PropertyCallbackInfo<void> info(begin());
193 LOG(isolate,
194 ApiNamedPropertyAccess("interceptor-named-set", holder(), *name));
195 f(v8::Utils::ToLocal(name), v8::Utils::ToLocal(value), info);
196 }
197 127
198 private: 128 private:
199 inline JSObject* holder() { 129 inline JSObject* holder() {
200 return JSObject::cast(this->begin()[T::kHolderIndex]); 130 return JSObject::cast(this->begin()[T::kHolderIndex]);
201 } 131 }
202 }; 132 };
203 133
204 class FunctionCallbackArguments 134 class FunctionCallbackArguments
205 : public CustomArguments<FunctionCallbackInfo<Value> > { 135 : public CustomArguments<FunctionCallbackInfo<Value> > {
206 public: 136 public:
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 182
253 private: 183 private:
254 internal::Object** argv_; 184 internal::Object** argv_;
255 int argc_; 185 int argc_;
256 }; 186 };
257 187
258 } // namespace internal 188 } // namespace internal
259 } // namespace v8 189 } // namespace v8
260 190
261 #endif // V8_API_ARGUMENTS_H_ 191 #endif // V8_API_ARGUMENTS_H_
OLDNEW
« no previous file with comments | « BUILD.gn ('k') | src/api-arguments.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698