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

Side by Side Diff: src/api.h

Issue 1423723002: Map v8::Function to JSReceiver + IsCallable (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: updates 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
« no previous file with comments | « no previous file | src/api.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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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_H_ 5 #ifndef V8_API_H_
6 #define V8_API_H_ 6 #define V8_API_H_
7 7
8 #include "include/v8-testing.h" 8 #include "include/v8-testing.h"
9 #include "src/contexts.h" 9 #include "src/contexts.h"
10 #include "src/factory.h" 10 #include "src/factory.h"
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 V(Int32Array, JSTypedArray) \ 161 V(Int32Array, JSTypedArray) \
162 V(Float32Array, JSTypedArray) \ 162 V(Float32Array, JSTypedArray) \
163 V(Float64Array, JSTypedArray) \ 163 V(Float64Array, JSTypedArray) \
164 V(DataView, JSDataView) \ 164 V(DataView, JSDataView) \
165 V(SharedArrayBuffer, JSArrayBuffer) \ 165 V(SharedArrayBuffer, JSArrayBuffer) \
166 V(Name, Name) \ 166 V(Name, Name) \
167 V(String, String) \ 167 V(String, String) \
168 V(Symbol, Symbol) \ 168 V(Symbol, Symbol) \
169 V(Script, JSFunction) \ 169 V(Script, JSFunction) \
170 V(UnboundScript, SharedFunctionInfo) \ 170 V(UnboundScript, SharedFunctionInfo) \
171 V(Function, JSFunction) \ 171 V(Function, JSReceiver) \
172 V(Message, JSMessageObject) \ 172 V(Message, JSMessageObject) \
173 V(Context, Context) \ 173 V(Context, Context) \
174 V(External, Object) \ 174 V(External, Object) \
175 V(StackTrace, JSArray) \ 175 V(StackTrace, JSArray) \
176 V(StackFrame, JSObject) \ 176 V(StackFrame, JSObject) \
177 V(NativeWeakMap, JSWeakMap) 177 V(NativeWeakMap, JSWeakMap)
178 178
179 class Utils { 179 class Utils {
180 public: 180 public:
181 static inline bool ApiCheck(bool condition, 181 static inline bool ApiCheck(bool condition,
182 const char* location, 182 const char* location,
183 const char* message) { 183 const char* message) {
184 if (!condition) Utils::ReportApiFailure(location, message); 184 if (!condition) Utils::ReportApiFailure(location, message);
185 return condition; 185 return condition;
186 } 186 }
187 187
188 static Local<FunctionTemplate> ToFunctionTemplate(NeanderObject obj); 188 static Local<FunctionTemplate> ToFunctionTemplate(NeanderObject obj);
189 static Local<ObjectTemplate> ToObjectTemplate(NeanderObject obj); 189 static Local<ObjectTemplate> ToObjectTemplate(NeanderObject obj);
190 190
191 static inline Local<Context> ToLocal( 191 static inline Local<Context> ToLocal(
192 v8::internal::Handle<v8::internal::Context> obj); 192 v8::internal::Handle<v8::internal::Context> obj);
193 static inline Local<Value> ToLocal( 193 static inline Local<Value> ToLocal(
194 v8::internal::Handle<v8::internal::Object> obj); 194 v8::internal::Handle<v8::internal::Object> obj);
195 static inline Local<Function> ToLocal(
196 v8::internal::Handle<v8::internal::JSFunction> obj);
197 static inline Local<Name> ToLocal( 195 static inline Local<Name> ToLocal(
198 v8::internal::Handle<v8::internal::Name> obj); 196 v8::internal::Handle<v8::internal::Name> obj);
199 static inline Local<String> ToLocal( 197 static inline Local<String> ToLocal(
200 v8::internal::Handle<v8::internal::String> obj); 198 v8::internal::Handle<v8::internal::String> obj);
201 static inline Local<Symbol> ToLocal( 199 static inline Local<Symbol> ToLocal(
202 v8::internal::Handle<v8::internal::Symbol> obj); 200 v8::internal::Handle<v8::internal::Symbol> obj);
203 static inline Local<RegExp> ToLocal( 201 static inline Local<RegExp> ToLocal(
204 v8::internal::Handle<v8::internal::JSRegExp> obj); 202 v8::internal::Handle<v8::internal::JSRegExp> obj);
205 static inline Local<Object> ToLocal( 203 static inline Local<Object> ToLocal(
206 v8::internal::Handle<v8::internal::JSObject> obj); 204 v8::internal::Handle<v8::internal::JSObject> obj);
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 static inline Local<Signature> SignatureToLocal( 260 static inline Local<Signature> SignatureToLocal(
263 v8::internal::Handle<v8::internal::FunctionTemplateInfo> obj); 261 v8::internal::Handle<v8::internal::FunctionTemplateInfo> obj);
264 static inline Local<AccessorSignature> AccessorSignatureToLocal( 262 static inline Local<AccessorSignature> AccessorSignatureToLocal(
265 v8::internal::Handle<v8::internal::FunctionTemplateInfo> obj); 263 v8::internal::Handle<v8::internal::FunctionTemplateInfo> obj);
266 static inline Local<TypeSwitch> ToLocal( 264 static inline Local<TypeSwitch> ToLocal(
267 v8::internal::Handle<v8::internal::TypeSwitchInfo> obj); 265 v8::internal::Handle<v8::internal::TypeSwitchInfo> obj);
268 static inline Local<External> ExternalToLocal( 266 static inline Local<External> ExternalToLocal(
269 v8::internal::Handle<v8::internal::JSObject> obj); 267 v8::internal::Handle<v8::internal::JSObject> obj);
270 static inline Local<NativeWeakMap> NativeWeakMapToLocal( 268 static inline Local<NativeWeakMap> NativeWeakMapToLocal(
271 v8::internal::Handle<v8::internal::JSWeakMap> obj); 269 v8::internal::Handle<v8::internal::JSWeakMap> obj);
270 static inline Local<Function> FunctionToLocal(
271 v8::internal::Handle<v8::internal::JSReceiver> obj);
272 272
273 #define DECLARE_OPEN_HANDLE(From, To) \ 273 #define DECLARE_OPEN_HANDLE(From, To) \
274 static inline v8::internal::Handle<v8::internal::To> \ 274 static inline v8::internal::Handle<v8::internal::To> \
275 OpenHandle(const From* that, bool allow_empty_handle = false); 275 OpenHandle(const From* that, bool allow_empty_handle = false);
276 276
277 OPEN_HANDLE_LIST(DECLARE_OPEN_HANDLE) 277 OPEN_HANDLE_LIST(DECLARE_OPEN_HANDLE)
278 278
279 #undef DECLARE_OPEN_HANDLE 279 #undef DECLARE_OPEN_HANDLE
280 280
281 template<class From, class To> 281 template<class From, class To>
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
342 #define MAKE_TO_LOCAL_TYPED_ARRAY(Type, typeName, TYPE, ctype, size) \ 342 #define MAKE_TO_LOCAL_TYPED_ARRAY(Type, typeName, TYPE, ctype, size) \
343 Local<v8::Type##Array> Utils::ToLocal##Type##Array( \ 343 Local<v8::Type##Array> Utils::ToLocal##Type##Array( \
344 v8::internal::Handle<v8::internal::JSTypedArray> obj) { \ 344 v8::internal::Handle<v8::internal::JSTypedArray> obj) { \
345 DCHECK(obj->type() == v8::internal::kExternal##Type##Array); \ 345 DCHECK(obj->type() == v8::internal::kExternal##Type##Array); \
346 return Convert<v8::internal::JSTypedArray, v8::Type##Array>(obj); \ 346 return Convert<v8::internal::JSTypedArray, v8::Type##Array>(obj); \
347 } 347 }
348 348
349 349
350 MAKE_TO_LOCAL(ToLocal, Context, Context) 350 MAKE_TO_LOCAL(ToLocal, Context, Context)
351 MAKE_TO_LOCAL(ToLocal, Object, Value) 351 MAKE_TO_LOCAL(ToLocal, Object, Value)
352 MAKE_TO_LOCAL(ToLocal, JSFunction, Function)
353 MAKE_TO_LOCAL(ToLocal, Name, Name) 352 MAKE_TO_LOCAL(ToLocal, Name, Name)
354 MAKE_TO_LOCAL(ToLocal, String, String) 353 MAKE_TO_LOCAL(ToLocal, String, String)
355 MAKE_TO_LOCAL(ToLocal, Symbol, Symbol) 354 MAKE_TO_LOCAL(ToLocal, Symbol, Symbol)
356 MAKE_TO_LOCAL(ToLocal, JSRegExp, RegExp) 355 MAKE_TO_LOCAL(ToLocal, JSRegExp, RegExp)
357 MAKE_TO_LOCAL(ToLocal, JSObject, Object) 356 MAKE_TO_LOCAL(ToLocal, JSObject, Object)
358 MAKE_TO_LOCAL(ToLocal, JSArray, Array) 357 MAKE_TO_LOCAL(ToLocal, JSArray, Array)
359 MAKE_TO_LOCAL(ToLocal, JSMap, Map) 358 MAKE_TO_LOCAL(ToLocal, JSMap, Map)
360 MAKE_TO_LOCAL(ToLocal, JSSet, Set) 359 MAKE_TO_LOCAL(ToLocal, JSSet, Set)
361 MAKE_TO_LOCAL(ToLocal, JSArrayBuffer, ArrayBuffer) 360 MAKE_TO_LOCAL(ToLocal, JSArrayBuffer, ArrayBuffer)
362 MAKE_TO_LOCAL(ToLocal, JSArrayBufferView, ArrayBufferView) 361 MAKE_TO_LOCAL(ToLocal, JSArrayBufferView, ArrayBufferView)
(...skipping 10 matching lines...) Expand all
373 MAKE_TO_LOCAL(ToLocal, TypeSwitchInfo, TypeSwitch) 372 MAKE_TO_LOCAL(ToLocal, TypeSwitchInfo, TypeSwitch)
374 MAKE_TO_LOCAL(MessageToLocal, Object, Message) 373 MAKE_TO_LOCAL(MessageToLocal, Object, Message)
375 MAKE_TO_LOCAL(PromiseToLocal, JSObject, Promise) 374 MAKE_TO_LOCAL(PromiseToLocal, JSObject, Promise)
376 MAKE_TO_LOCAL(StackTraceToLocal, JSArray, StackTrace) 375 MAKE_TO_LOCAL(StackTraceToLocal, JSArray, StackTrace)
377 MAKE_TO_LOCAL(StackFrameToLocal, JSObject, StackFrame) 376 MAKE_TO_LOCAL(StackFrameToLocal, JSObject, StackFrame)
378 MAKE_TO_LOCAL(NumberToLocal, Object, Number) 377 MAKE_TO_LOCAL(NumberToLocal, Object, Number)
379 MAKE_TO_LOCAL(IntegerToLocal, Object, Integer) 378 MAKE_TO_LOCAL(IntegerToLocal, Object, Integer)
380 MAKE_TO_LOCAL(Uint32ToLocal, Object, Uint32) 379 MAKE_TO_LOCAL(Uint32ToLocal, Object, Uint32)
381 MAKE_TO_LOCAL(ExternalToLocal, JSObject, External) 380 MAKE_TO_LOCAL(ExternalToLocal, JSObject, External)
382 MAKE_TO_LOCAL(NativeWeakMapToLocal, JSWeakMap, NativeWeakMap) 381 MAKE_TO_LOCAL(NativeWeakMapToLocal, JSWeakMap, NativeWeakMap)
382 MAKE_TO_LOCAL(FunctionToLocal, JSReceiver, Function)
383 383
384 #undef MAKE_TO_LOCAL_TYPED_ARRAY 384 #undef MAKE_TO_LOCAL_TYPED_ARRAY
385 #undef MAKE_TO_LOCAL 385 #undef MAKE_TO_LOCAL
386 386
387 387
388 // Implementations of OpenHandle 388 // Implementations of OpenHandle
389 389
390 #define MAKE_OPEN_HANDLE(From, To) \ 390 #define MAKE_OPEN_HANDLE(From, To) \
391 v8::internal::Handle<v8::internal::To> Utils::OpenHandle( \ 391 v8::internal::Handle<v8::internal::To> Utils::OpenHandle( \
392 const v8::From* that, bool allow_empty_handle) { \ 392 const v8::From* that, bool allow_empty_handle) { \
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
639 } 639 }
640 640
641 private: 641 private:
642 static v8::Testing::StressType stress_type_; 642 static v8::Testing::StressType stress_type_;
643 }; 643 };
644 644
645 } // namespace internal 645 } // namespace internal
646 } // namespace v8 646 } // namespace v8
647 647
648 #endif // V8_API_H_ 648 #endif // V8_API_H_
OLDNEW
« no previous file with comments | « no previous file | src/api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698