OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
337 | 337 |
338 | 338 |
339 // Implementations of ToLocal | 339 // Implementations of ToLocal |
340 | 340 |
341 #define MAKE_TO_LOCAL(Name, From, To) \ | 341 #define MAKE_TO_LOCAL(Name, From, To) \ |
342 Local<v8::To> Utils::Name(v8::internal::Handle<v8::internal::From> obj) { \ | 342 Local<v8::To> Utils::Name(v8::internal::Handle<v8::internal::From> obj) { \ |
343 return Convert<v8::internal::From, v8::To>(obj); \ | 343 return Convert<v8::internal::From, v8::To>(obj); \ |
344 } | 344 } |
345 | 345 |
346 | 346 |
347 #define MAKE_TO_LOCAL_TYPED_ARRAY(TypedArray, typeConst) \ | 347 #define MAKE_TO_LOCAL_TYPED_ARRAY(Type, typeName, TYPE, ctype, size) \ |
348 Local<v8::TypedArray> Utils::ToLocal##TypedArray( \ | 348 Local<v8::Type##Array> Utils::ToLocal##Type##Array( \ |
349 v8::internal::Handle<v8::internal::JSTypedArray> obj) { \ | 349 v8::internal::Handle<v8::internal::JSTypedArray> obj) { \ |
350 ASSERT(obj->type() == typeConst); \ | 350 ASSERT(obj->type() == kExternal##Type##Array); \ |
351 return Convert<v8::internal::JSTypedArray, v8::TypedArray>(obj); \ | 351 return Convert<v8::internal::JSTypedArray, v8::Type##Array>(obj); \ |
352 } | 352 } |
353 | 353 |
354 | 354 |
355 MAKE_TO_LOCAL(ToLocal, Context, Context) | 355 MAKE_TO_LOCAL(ToLocal, Context, Context) |
356 MAKE_TO_LOCAL(ToLocal, Object, Value) | 356 MAKE_TO_LOCAL(ToLocal, Object, Value) |
357 MAKE_TO_LOCAL(ToLocal, JSFunction, Function) | 357 MAKE_TO_LOCAL(ToLocal, JSFunction, Function) |
358 MAKE_TO_LOCAL(ToLocal, String, String) | 358 MAKE_TO_LOCAL(ToLocal, String, String) |
359 MAKE_TO_LOCAL(ToLocal, Symbol, Symbol) | 359 MAKE_TO_LOCAL(ToLocal, Symbol, Symbol) |
360 MAKE_TO_LOCAL(ToLocal, JSRegExp, RegExp) | 360 MAKE_TO_LOCAL(ToLocal, JSRegExp, RegExp) |
361 MAKE_TO_LOCAL(ToLocal, JSObject, Object) | 361 MAKE_TO_LOCAL(ToLocal, JSObject, Object) |
362 MAKE_TO_LOCAL(ToLocal, JSArray, Array) | 362 MAKE_TO_LOCAL(ToLocal, JSArray, Array) |
363 MAKE_TO_LOCAL(ToLocal, JSArrayBuffer, ArrayBuffer) | 363 MAKE_TO_LOCAL(ToLocal, JSArrayBuffer, ArrayBuffer) |
364 MAKE_TO_LOCAL(ToLocal, JSArrayBufferView, ArrayBufferView) | 364 MAKE_TO_LOCAL(ToLocal, JSArrayBufferView, ArrayBufferView) |
365 MAKE_TO_LOCAL(ToLocal, JSDataView, DataView) | 365 MAKE_TO_LOCAL(ToLocal, JSDataView, DataView) |
366 MAKE_TO_LOCAL(ToLocal, JSTypedArray, TypedArray) | 366 MAKE_TO_LOCAL(ToLocal, JSTypedArray, TypedArray) |
367 | 367 |
368 MAKE_TO_LOCAL_TYPED_ARRAY(Uint8Array, kExternalUnsignedByteArray) | 368 TYPED_ARRAYS(MAKE_TO_LOCAL_TYPED_ARRAY) |
369 MAKE_TO_LOCAL_TYPED_ARRAY(Uint8ClampedArray, kExternalPixelArray) | |
370 MAKE_TO_LOCAL_TYPED_ARRAY(Int8Array, kExternalByteArray) | |
371 MAKE_TO_LOCAL_TYPED_ARRAY(Uint16Array, kExternalUnsignedShortArray) | |
372 MAKE_TO_LOCAL_TYPED_ARRAY(Int16Array, kExternalShortArray) | |
373 MAKE_TO_LOCAL_TYPED_ARRAY(Uint32Array, kExternalUnsignedIntArray) | |
374 MAKE_TO_LOCAL_TYPED_ARRAY(Int32Array, kExternalIntArray) | |
375 MAKE_TO_LOCAL_TYPED_ARRAY(Float32Array, kExternalFloatArray) | |
376 MAKE_TO_LOCAL_TYPED_ARRAY(Float64Array, kExternalDoubleArray) | |
377 | 369 |
378 MAKE_TO_LOCAL(ToLocal, FunctionTemplateInfo, FunctionTemplate) | 370 MAKE_TO_LOCAL(ToLocal, FunctionTemplateInfo, FunctionTemplate) |
379 MAKE_TO_LOCAL(ToLocal, ObjectTemplateInfo, ObjectTemplate) | 371 MAKE_TO_LOCAL(ToLocal, ObjectTemplateInfo, ObjectTemplate) |
380 MAKE_TO_LOCAL(ToLocal, SignatureInfo, Signature) | 372 MAKE_TO_LOCAL(ToLocal, SignatureInfo, Signature) |
381 MAKE_TO_LOCAL(AccessorSignatureToLocal, FunctionTemplateInfo, AccessorSignature) | 373 MAKE_TO_LOCAL(AccessorSignatureToLocal, FunctionTemplateInfo, AccessorSignature) |
382 MAKE_TO_LOCAL(ToLocal, TypeSwitchInfo, TypeSwitch) | 374 MAKE_TO_LOCAL(ToLocal, TypeSwitchInfo, TypeSwitch) |
383 MAKE_TO_LOCAL(MessageToLocal, Object, Message) | 375 MAKE_TO_LOCAL(MessageToLocal, Object, Message) |
384 MAKE_TO_LOCAL(StackTraceToLocal, JSArray, StackTrace) | 376 MAKE_TO_LOCAL(StackTraceToLocal, JSArray, StackTrace) |
385 MAKE_TO_LOCAL(StackFrameToLocal, JSObject, StackFrame) | 377 MAKE_TO_LOCAL(StackFrameToLocal, JSObject, StackFrame) |
386 MAKE_TO_LOCAL(NumberToLocal, Object, Number) | 378 MAKE_TO_LOCAL(NumberToLocal, Object, Number) |
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
716 stress_type_ = stress_type; | 708 stress_type_ = stress_type; |
717 } | 709 } |
718 | 710 |
719 private: | 711 private: |
720 static v8::Testing::StressType stress_type_; | 712 static v8::Testing::StressType stress_type_; |
721 }; | 713 }; |
722 | 714 |
723 } } // namespace v8::internal | 715 } } // namespace v8::internal |
724 | 716 |
725 #endif // V8_API_H_ | 717 #endif // V8_API_H_ |
OLD | NEW |