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 "src/v8.h" | 8 #include "src/v8.h" |
9 | 9 |
10 #include "include/v8-testing.h" | 10 #include "include/v8-testing.h" |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 V(Name, Name) \ | 162 V(Name, Name) \ |
163 V(String, String) \ | 163 V(String, String) \ |
164 V(Symbol, Symbol) \ | 164 V(Symbol, Symbol) \ |
165 V(Script, JSFunction) \ | 165 V(Script, JSFunction) \ |
166 V(UnboundScript, SharedFunctionInfo) \ | 166 V(UnboundScript, SharedFunctionInfo) \ |
167 V(Function, JSFunction) \ | 167 V(Function, JSFunction) \ |
168 V(Message, JSMessageObject) \ | 168 V(Message, JSMessageObject) \ |
169 V(Context, Context) \ | 169 V(Context, Context) \ |
170 V(External, Object) \ | 170 V(External, Object) \ |
171 V(StackTrace, JSArray) \ | 171 V(StackTrace, JSArray) \ |
172 V(StackFrame, JSObject) | 172 V(StackFrame, JSObject) \ |
| 173 V(NativeWeakMap, JSWeakMap) |
173 | 174 |
174 class Utils { | 175 class Utils { |
175 public: | 176 public: |
176 static inline bool ApiCheck(bool condition, | 177 static inline bool ApiCheck(bool condition, |
177 const char* location, | 178 const char* location, |
178 const char* message) { | 179 const char* message) { |
179 if (!condition) Utils::ReportApiFailure(location, message); | 180 if (!condition) Utils::ReportApiFailure(location, message); |
180 return condition; | 181 return condition; |
181 } | 182 } |
182 | 183 |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 static inline Local<ObjectTemplate> ToLocal( | 249 static inline Local<ObjectTemplate> ToLocal( |
249 v8::internal::Handle<v8::internal::ObjectTemplateInfo> obj); | 250 v8::internal::Handle<v8::internal::ObjectTemplateInfo> obj); |
250 static inline Local<Signature> SignatureToLocal( | 251 static inline Local<Signature> SignatureToLocal( |
251 v8::internal::Handle<v8::internal::FunctionTemplateInfo> obj); | 252 v8::internal::Handle<v8::internal::FunctionTemplateInfo> obj); |
252 static inline Local<AccessorSignature> AccessorSignatureToLocal( | 253 static inline Local<AccessorSignature> AccessorSignatureToLocal( |
253 v8::internal::Handle<v8::internal::FunctionTemplateInfo> obj); | 254 v8::internal::Handle<v8::internal::FunctionTemplateInfo> obj); |
254 static inline Local<TypeSwitch> ToLocal( | 255 static inline Local<TypeSwitch> ToLocal( |
255 v8::internal::Handle<v8::internal::TypeSwitchInfo> obj); | 256 v8::internal::Handle<v8::internal::TypeSwitchInfo> obj); |
256 static inline Local<External> ExternalToLocal( | 257 static inline Local<External> ExternalToLocal( |
257 v8::internal::Handle<v8::internal::JSObject> obj); | 258 v8::internal::Handle<v8::internal::JSObject> obj); |
| 259 static inline Local<NativeWeakMap> NativeWeakMapToLocal( |
| 260 v8::internal::Handle<v8::internal::JSWeakMap> obj); |
258 | 261 |
259 #define DECLARE_OPEN_HANDLE(From, To) \ | 262 #define DECLARE_OPEN_HANDLE(From, To) \ |
260 static inline v8::internal::Handle<v8::internal::To> \ | 263 static inline v8::internal::Handle<v8::internal::To> \ |
261 OpenHandle(const From* that, bool allow_empty_handle = false); | 264 OpenHandle(const From* that, bool allow_empty_handle = false); |
262 | 265 |
263 OPEN_HANDLE_LIST(DECLARE_OPEN_HANDLE) | 266 OPEN_HANDLE_LIST(DECLARE_OPEN_HANDLE) |
264 | 267 |
265 #undef DECLARE_OPEN_HANDLE | 268 #undef DECLARE_OPEN_HANDLE |
266 | 269 |
267 template<class From, class To> | 270 template<class From, class To> |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
354 MAKE_TO_LOCAL(AccessorSignatureToLocal, FunctionTemplateInfo, AccessorSignature) | 357 MAKE_TO_LOCAL(AccessorSignatureToLocal, FunctionTemplateInfo, AccessorSignature) |
355 MAKE_TO_LOCAL(ToLocal, TypeSwitchInfo, TypeSwitch) | 358 MAKE_TO_LOCAL(ToLocal, TypeSwitchInfo, TypeSwitch) |
356 MAKE_TO_LOCAL(MessageToLocal, Object, Message) | 359 MAKE_TO_LOCAL(MessageToLocal, Object, Message) |
357 MAKE_TO_LOCAL(PromiseToLocal, JSObject, Promise) | 360 MAKE_TO_LOCAL(PromiseToLocal, JSObject, Promise) |
358 MAKE_TO_LOCAL(StackTraceToLocal, JSArray, StackTrace) | 361 MAKE_TO_LOCAL(StackTraceToLocal, JSArray, StackTrace) |
359 MAKE_TO_LOCAL(StackFrameToLocal, JSObject, StackFrame) | 362 MAKE_TO_LOCAL(StackFrameToLocal, JSObject, StackFrame) |
360 MAKE_TO_LOCAL(NumberToLocal, Object, Number) | 363 MAKE_TO_LOCAL(NumberToLocal, Object, Number) |
361 MAKE_TO_LOCAL(IntegerToLocal, Object, Integer) | 364 MAKE_TO_LOCAL(IntegerToLocal, Object, Integer) |
362 MAKE_TO_LOCAL(Uint32ToLocal, Object, Uint32) | 365 MAKE_TO_LOCAL(Uint32ToLocal, Object, Uint32) |
363 MAKE_TO_LOCAL(ExternalToLocal, JSObject, External) | 366 MAKE_TO_LOCAL(ExternalToLocal, JSObject, External) |
| 367 MAKE_TO_LOCAL(NativeWeakMapToLocal, JSWeakMap, NativeWeakMap) |
364 | 368 |
365 #undef MAKE_TO_LOCAL_TYPED_ARRAY | 369 #undef MAKE_TO_LOCAL_TYPED_ARRAY |
366 #undef MAKE_TO_LOCAL | 370 #undef MAKE_TO_LOCAL |
367 | 371 |
368 | 372 |
369 // Implementations of OpenHandle | 373 // Implementations of OpenHandle |
370 | 374 |
371 #define MAKE_OPEN_HANDLE(From, To) \ | 375 #define MAKE_OPEN_HANDLE(From, To) \ |
372 v8::internal::Handle<v8::internal::To> Utils::OpenHandle( \ | 376 v8::internal::Handle<v8::internal::To> Utils::OpenHandle( \ |
373 const v8::From* that, bool allow_empty_handle) { \ | 377 const v8::From* that, bool allow_empty_handle) { \ |
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
688 stress_type_ = stress_type; | 692 stress_type_ = stress_type; |
689 } | 693 } |
690 | 694 |
691 private: | 695 private: |
692 static v8::Testing::StressType stress_type_; | 696 static v8::Testing::StressType stress_type_; |
693 }; | 697 }; |
694 | 698 |
695 } } // namespace v8::internal | 699 } } // namespace v8::internal |
696 | 700 |
697 #endif // V8_API_H_ | 701 #endif // V8_API_H_ |
OLD | NEW |