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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 Extension* extension() { return extension_; } | 128 Extension* extension() { return extension_; } |
129 RegisteredExtension* next() { return next_; } | 129 RegisteredExtension* next() { return next_; } |
130 static RegisteredExtension* first_extension() { return first_extension_; } | 130 static RegisteredExtension* first_extension() { return first_extension_; } |
131 private: | 131 private: |
132 Extension* extension_; | 132 Extension* extension_; |
133 RegisteredExtension* next_; | 133 RegisteredExtension* next_; |
134 static RegisteredExtension* first_extension_; | 134 static RegisteredExtension* first_extension_; |
135 }; | 135 }; |
136 | 136 |
137 | 137 |
138 #define OPEN_HANDLE_LIST(V) \ | 138 #define OPEN_HANDLE_LIST(V) \ |
139 V(Template, TemplateInfo) \ | 139 V(Template, TemplateInfo) \ |
140 V(FunctionTemplate, FunctionTemplateInfo) \ | 140 V(FunctionTemplate, FunctionTemplateInfo) \ |
141 V(ObjectTemplate, ObjectTemplateInfo) \ | 141 V(ObjectTemplate, ObjectTemplateInfo) \ |
142 V(Signature, SignatureInfo) \ | 142 V(Signature, SignatureInfo) \ |
143 V(AccessorSignature, FunctionTemplateInfo) \ | 143 V(AccessorSignature, FunctionTemplateInfo) \ |
144 V(TypeSwitch, TypeSwitchInfo) \ | 144 V(TypeSwitch, TypeSwitchInfo) \ |
145 V(Data, Object) \ | 145 V(Data, Object) \ |
146 V(RegExp, JSRegExp) \ | 146 V(RegExp, JSRegExp) \ |
147 V(Object, JSObject) \ | 147 V(Object, JSObject) \ |
148 V(Array, JSArray) \ | 148 V(Array, JSArray) \ |
149 V(ArrayBuffer, JSArrayBuffer) \ | 149 V(ArrayBuffer, JSArrayBuffer) \ |
150 V(ArrayBufferView, JSArrayBufferView) \ | 150 V(ArrayBufferView, JSArrayBufferView) \ |
151 V(TypedArray, JSTypedArray) \ | 151 V(TypedArray, JSTypedArray) \ |
152 V(Uint8Array, JSTypedArray) \ | 152 V(Uint8Array, JSTypedArray) \ |
153 V(Uint8ClampedArray, JSTypedArray) \ | 153 V(Uint8ClampedArray, JSTypedArray) \ |
154 V(Int8Array, JSTypedArray) \ | 154 V(Int8Array, JSTypedArray) \ |
155 V(Uint16Array, JSTypedArray) \ | 155 V(Uint16Array, JSTypedArray) \ |
156 V(Int16Array, JSTypedArray) \ | 156 V(Int16Array, JSTypedArray) \ |
157 V(Uint32Array, JSTypedArray) \ | 157 V(Uint32Array, JSTypedArray) \ |
158 V(Int32Array, JSTypedArray) \ | 158 V(Int32Array, JSTypedArray) \ |
159 V(Float32Array, JSTypedArray) \ | 159 V(Float32Array, JSTypedArray) \ |
160 V(Float64Array, JSTypedArray) \ | 160 V(Float64Array, JSTypedArray) \ |
161 V(DataView, JSDataView) \ | 161 V(DataView, JSDataView) \ |
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(DeclaredAccessorDescriptor, DeclaredAccessorDescriptor) | |
174 | |
175 | 173 |
176 class Utils { | 174 class Utils { |
177 public: | 175 public: |
178 static inline bool ApiCheck(bool condition, | 176 static inline bool ApiCheck(bool condition, |
179 const char* location, | 177 const char* location, |
180 const char* message) { | 178 const char* message) { |
181 if (!condition) Utils::ReportApiFailure(location, message); | 179 if (!condition) Utils::ReportApiFailure(location, message); |
182 return condition; | 180 return condition; |
183 } | 181 } |
184 | 182 |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 static inline Local<ObjectTemplate> ToLocal( | 248 static inline Local<ObjectTemplate> ToLocal( |
251 v8::internal::Handle<v8::internal::ObjectTemplateInfo> obj); | 249 v8::internal::Handle<v8::internal::ObjectTemplateInfo> obj); |
252 static inline Local<Signature> ToLocal( | 250 static inline Local<Signature> ToLocal( |
253 v8::internal::Handle<v8::internal::SignatureInfo> obj); | 251 v8::internal::Handle<v8::internal::SignatureInfo> obj); |
254 static inline Local<AccessorSignature> AccessorSignatureToLocal( | 252 static inline Local<AccessorSignature> AccessorSignatureToLocal( |
255 v8::internal::Handle<v8::internal::FunctionTemplateInfo> obj); | 253 v8::internal::Handle<v8::internal::FunctionTemplateInfo> obj); |
256 static inline Local<TypeSwitch> ToLocal( | 254 static inline Local<TypeSwitch> ToLocal( |
257 v8::internal::Handle<v8::internal::TypeSwitchInfo> obj); | 255 v8::internal::Handle<v8::internal::TypeSwitchInfo> obj); |
258 static inline Local<External> ExternalToLocal( | 256 static inline Local<External> ExternalToLocal( |
259 v8::internal::Handle<v8::internal::JSObject> obj); | 257 v8::internal::Handle<v8::internal::JSObject> obj); |
260 static inline Local<DeclaredAccessorDescriptor> ToLocal( | |
261 v8::internal::Handle<v8::internal::DeclaredAccessorDescriptor> obj); | |
262 | 258 |
263 #define DECLARE_OPEN_HANDLE(From, To) \ | 259 #define DECLARE_OPEN_HANDLE(From, To) \ |
264 static inline v8::internal::Handle<v8::internal::To> \ | 260 static inline v8::internal::Handle<v8::internal::To> \ |
265 OpenHandle(const From* that, bool allow_empty_handle = false); | 261 OpenHandle(const From* that, bool allow_empty_handle = false); |
266 | 262 |
267 OPEN_HANDLE_LIST(DECLARE_OPEN_HANDLE) | 263 OPEN_HANDLE_LIST(DECLARE_OPEN_HANDLE) |
268 | 264 |
269 #undef DECLARE_OPEN_HANDLE | 265 #undef DECLARE_OPEN_HANDLE |
270 | 266 |
271 template<class From, class To> | 267 template<class From, class To> |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
358 MAKE_TO_LOCAL(AccessorSignatureToLocal, FunctionTemplateInfo, AccessorSignature) | 354 MAKE_TO_LOCAL(AccessorSignatureToLocal, FunctionTemplateInfo, AccessorSignature) |
359 MAKE_TO_LOCAL(ToLocal, TypeSwitchInfo, TypeSwitch) | 355 MAKE_TO_LOCAL(ToLocal, TypeSwitchInfo, TypeSwitch) |
360 MAKE_TO_LOCAL(MessageToLocal, Object, Message) | 356 MAKE_TO_LOCAL(MessageToLocal, Object, Message) |
361 MAKE_TO_LOCAL(PromiseToLocal, JSObject, Promise) | 357 MAKE_TO_LOCAL(PromiseToLocal, JSObject, Promise) |
362 MAKE_TO_LOCAL(StackTraceToLocal, JSArray, StackTrace) | 358 MAKE_TO_LOCAL(StackTraceToLocal, JSArray, StackTrace) |
363 MAKE_TO_LOCAL(StackFrameToLocal, JSObject, StackFrame) | 359 MAKE_TO_LOCAL(StackFrameToLocal, JSObject, StackFrame) |
364 MAKE_TO_LOCAL(NumberToLocal, Object, Number) | 360 MAKE_TO_LOCAL(NumberToLocal, Object, Number) |
365 MAKE_TO_LOCAL(IntegerToLocal, Object, Integer) | 361 MAKE_TO_LOCAL(IntegerToLocal, Object, Integer) |
366 MAKE_TO_LOCAL(Uint32ToLocal, Object, Uint32) | 362 MAKE_TO_LOCAL(Uint32ToLocal, Object, Uint32) |
367 MAKE_TO_LOCAL(ExternalToLocal, JSObject, External) | 363 MAKE_TO_LOCAL(ExternalToLocal, JSObject, External) |
368 MAKE_TO_LOCAL(ToLocal, DeclaredAccessorDescriptor, DeclaredAccessorDescriptor) | |
369 | 364 |
370 #undef MAKE_TO_LOCAL_TYPED_ARRAY | 365 #undef MAKE_TO_LOCAL_TYPED_ARRAY |
371 #undef MAKE_TO_LOCAL | 366 #undef MAKE_TO_LOCAL |
372 | 367 |
373 | 368 |
374 // Implementations of OpenHandle | 369 // Implementations of OpenHandle |
375 | 370 |
376 #define MAKE_OPEN_HANDLE(From, To) \ | 371 #define MAKE_OPEN_HANDLE(From, To) \ |
377 v8::internal::Handle<v8::internal::To> Utils::OpenHandle( \ | 372 v8::internal::Handle<v8::internal::To> Utils::OpenHandle( \ |
378 const v8::From* that, bool allow_empty_handle) { \ | 373 const v8::From* that, bool allow_empty_handle) { \ |
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
693 stress_type_ = stress_type; | 688 stress_type_ = stress_type; |
694 } | 689 } |
695 | 690 |
696 private: | 691 private: |
697 static v8::Testing::StressType stress_type_; | 692 static v8::Testing::StressType stress_type_; |
698 }; | 693 }; |
699 | 694 |
700 } } // namespace v8::internal | 695 } } // namespace v8::internal |
701 | 696 |
702 #endif // V8_API_H_ | 697 #endif // V8_API_H_ |
OLD | NEW |