| OLD | NEW |
| 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/debug/debug-interface.h" | 10 #include "src/debug/debug-interface.h" |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 V(Function, JSReceiver) \ | 104 V(Function, JSReceiver) \ |
| 105 V(Message, JSMessageObject) \ | 105 V(Message, JSMessageObject) \ |
| 106 V(Context, Context) \ | 106 V(Context, Context) \ |
| 107 V(External, Object) \ | 107 V(External, Object) \ |
| 108 V(StackTrace, JSArray) \ | 108 V(StackTrace, JSArray) \ |
| 109 V(StackFrame, JSObject) \ | 109 V(StackFrame, JSObject) \ |
| 110 V(Proxy, JSProxy) \ | 110 V(Proxy, JSProxy) \ |
| 111 V(NativeWeakMap, JSWeakMap) \ | 111 V(NativeWeakMap, JSWeakMap) \ |
| 112 V(debug::GeneratorObject, JSGeneratorObject) \ | 112 V(debug::GeneratorObject, JSGeneratorObject) \ |
| 113 V(debug::Script, Script) \ | 113 V(debug::Script, Script) \ |
| 114 V(Promise, JSPromise) | 114 V(Promise, JSPromise) \ |
| 115 V(DictionarySchema, DictionarySchema) |
| 115 | 116 |
| 116 class Utils { | 117 class Utils { |
| 117 public: | 118 public: |
| 118 static inline bool ApiCheck(bool condition, | 119 static inline bool ApiCheck(bool condition, |
| 119 const char* location, | 120 const char* location, |
| 120 const char* message) { | 121 const char* message) { |
| 121 if (!condition) Utils::ReportApiFailure(location, message); | 122 if (!condition) Utils::ReportApiFailure(location, message); |
| 122 return condition; | 123 return condition; |
| 123 } | 124 } |
| 124 static void ReportOOMFailure(const char* location, bool is_heap_oom); | 125 static void ReportOOMFailure(const char* location, bool is_heap_oom); |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 static inline Local<Signature> SignatureToLocal( | 203 static inline Local<Signature> SignatureToLocal( |
| 203 v8::internal::Handle<v8::internal::FunctionTemplateInfo> obj); | 204 v8::internal::Handle<v8::internal::FunctionTemplateInfo> obj); |
| 204 static inline Local<AccessorSignature> AccessorSignatureToLocal( | 205 static inline Local<AccessorSignature> AccessorSignatureToLocal( |
| 205 v8::internal::Handle<v8::internal::FunctionTemplateInfo> obj); | 206 v8::internal::Handle<v8::internal::FunctionTemplateInfo> obj); |
| 206 static inline Local<External> ExternalToLocal( | 207 static inline Local<External> ExternalToLocal( |
| 207 v8::internal::Handle<v8::internal::JSObject> obj); | 208 v8::internal::Handle<v8::internal::JSObject> obj); |
| 208 static inline Local<NativeWeakMap> NativeWeakMapToLocal( | 209 static inline Local<NativeWeakMap> NativeWeakMapToLocal( |
| 209 v8::internal::Handle<v8::internal::JSWeakMap> obj); | 210 v8::internal::Handle<v8::internal::JSWeakMap> obj); |
| 210 static inline Local<Function> CallableToLocal( | 211 static inline Local<Function> CallableToLocal( |
| 211 v8::internal::Handle<v8::internal::JSReceiver> obj); | 212 v8::internal::Handle<v8::internal::JSReceiver> obj); |
| 213 static inline Local<DictionarySchema> ToLocal( |
| 214 v8::internal::Handle<v8::internal::DictionarySchema> obj); |
| 212 | 215 |
| 213 #define DECLARE_OPEN_HANDLE(From, To) \ | 216 #define DECLARE_OPEN_HANDLE(From, To) \ |
| 214 static inline v8::internal::Handle<v8::internal::To> \ | 217 static inline v8::internal::Handle<v8::internal::To> \ |
| 215 OpenHandle(const From* that, bool allow_empty_handle = false); | 218 OpenHandle(const From* that, bool allow_empty_handle = false); |
| 216 | 219 |
| 217 OPEN_HANDLE_LIST(DECLARE_OPEN_HANDLE) | 220 OPEN_HANDLE_LIST(DECLARE_OPEN_HANDLE) |
| 218 | 221 |
| 219 #undef DECLARE_OPEN_HANDLE | 222 #undef DECLARE_OPEN_HANDLE |
| 220 | 223 |
| 221 template<class From, class To> | 224 template<class From, class To> |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 318 MAKE_TO_LOCAL(MessageToLocal, Object, Message) | 321 MAKE_TO_LOCAL(MessageToLocal, Object, Message) |
| 319 MAKE_TO_LOCAL(PromiseToLocal, JSObject, Promise) | 322 MAKE_TO_LOCAL(PromiseToLocal, JSObject, Promise) |
| 320 MAKE_TO_LOCAL(StackTraceToLocal, JSArray, StackTrace) | 323 MAKE_TO_LOCAL(StackTraceToLocal, JSArray, StackTrace) |
| 321 MAKE_TO_LOCAL(StackFrameToLocal, JSObject, StackFrame) | 324 MAKE_TO_LOCAL(StackFrameToLocal, JSObject, StackFrame) |
| 322 MAKE_TO_LOCAL(NumberToLocal, Object, Number) | 325 MAKE_TO_LOCAL(NumberToLocal, Object, Number) |
| 323 MAKE_TO_LOCAL(IntegerToLocal, Object, Integer) | 326 MAKE_TO_LOCAL(IntegerToLocal, Object, Integer) |
| 324 MAKE_TO_LOCAL(Uint32ToLocal, Object, Uint32) | 327 MAKE_TO_LOCAL(Uint32ToLocal, Object, Uint32) |
| 325 MAKE_TO_LOCAL(ExternalToLocal, JSObject, External) | 328 MAKE_TO_LOCAL(ExternalToLocal, JSObject, External) |
| 326 MAKE_TO_LOCAL(NativeWeakMapToLocal, JSWeakMap, NativeWeakMap) | 329 MAKE_TO_LOCAL(NativeWeakMapToLocal, JSWeakMap, NativeWeakMap) |
| 327 MAKE_TO_LOCAL(CallableToLocal, JSReceiver, Function) | 330 MAKE_TO_LOCAL(CallableToLocal, JSReceiver, Function) |
| 331 MAKE_TO_LOCAL(ToLocal, DictionarySchema, DictionarySchema) |
| 328 | 332 |
| 329 #undef MAKE_TO_LOCAL_TYPED_ARRAY | 333 #undef MAKE_TO_LOCAL_TYPED_ARRAY |
| 330 #undef MAKE_TO_LOCAL | 334 #undef MAKE_TO_LOCAL |
| 331 | 335 |
| 332 | 336 |
| 333 // Implementations of OpenHandle | 337 // Implementations of OpenHandle |
| 334 | 338 |
| 335 #define MAKE_OPEN_HANDLE(From, To) \ | 339 #define MAKE_OPEN_HANDLE(From, To) \ |
| 336 v8::internal::Handle<v8::internal::To> Utils::OpenHandle( \ | 340 v8::internal::Handle<v8::internal::To> Utils::OpenHandle( \ |
| 337 const v8::From* that, bool allow_empty_handle) { \ | 341 const v8::From* that, bool allow_empty_handle) { \ |
| (...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 664 } | 668 } |
| 665 | 669 |
| 666 private: | 670 private: |
| 667 static v8::Testing::StressType stress_type_; | 671 static v8::Testing::StressType stress_type_; |
| 668 }; | 672 }; |
| 669 | 673 |
| 670 } // namespace internal | 674 } // namespace internal |
| 671 } // namespace v8 | 675 } // namespace v8 |
| 672 | 676 |
| 673 #endif // V8_API_H_ | 677 #endif // V8_API_H_ |
| OLD | NEW |