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 2547 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2558 | 2558 |
2559 | 2559 |
2560 #define TYPED_ARRAY_LIST(F) \ | 2560 #define TYPED_ARRAY_LIST(F) \ |
2561 F(Uint8Array, kExternalUnsignedByteArray) \ | 2561 F(Uint8Array, kExternalUnsignedByteArray) \ |
2562 F(Int8Array, kExternalByteArray) \ | 2562 F(Int8Array, kExternalByteArray) \ |
2563 F(Uint16Array, kExternalUnsignedShortArray) \ | 2563 F(Uint16Array, kExternalUnsignedShortArray) \ |
2564 F(Int16Array, kExternalShortArray) \ | 2564 F(Int16Array, kExternalShortArray) \ |
2565 F(Uint32Array, kExternalUnsignedIntArray) \ | 2565 F(Uint32Array, kExternalUnsignedIntArray) \ |
2566 F(Int32Array, kExternalIntArray) \ | 2566 F(Int32Array, kExternalIntArray) \ |
2567 F(Float32Array, kExternalFloatArray) \ | 2567 F(Float32Array, kExternalFloatArray) \ |
| 2568 F(Float32x4Array, kExternalFloat32x4Array) \ |
| 2569 F(Int32x4Array, kExternalInt32x4Array) \ |
2568 F(Float64Array, kExternalDoubleArray) \ | 2570 F(Float64Array, kExternalDoubleArray) \ |
2569 F(Uint8ClampedArray, kExternalPixelArray) | 2571 F(Uint8ClampedArray, kExternalPixelArray) |
2570 | 2572 |
2571 | 2573 |
2572 #define VALUE_IS_TYPED_ARRAY(TypedArray, type_const) \ | 2574 #define VALUE_IS_TYPED_ARRAY(TypedArray, type_const) \ |
2573 bool Value::Is##TypedArray() const { \ | 2575 bool Value::Is##TypedArray() const { \ |
2574 i::Handle<i::Object> obj = Utils::OpenHandle(this); \ | 2576 i::Handle<i::Object> obj = Utils::OpenHandle(this); \ |
2575 if (!obj->IsJSTypedArray()) return false; \ | 2577 if (!obj->IsJSTypedArray()) return false; \ |
2576 return i::JSTypedArray::cast(*obj)->type() == type_const; \ | 2578 return i::JSTypedArray::cast(*obj)->type() == type_const; \ |
2577 } | 2579 } |
(...skipping 1290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3868 break; | 3870 break; |
3869 case kExternalIntArray: | 3871 case kExternalIntArray: |
3870 return i::EXTERNAL_INT_ELEMENTS; | 3872 return i::EXTERNAL_INT_ELEMENTS; |
3871 break; | 3873 break; |
3872 case kExternalUnsignedIntArray: | 3874 case kExternalUnsignedIntArray: |
3873 return i::EXTERNAL_UNSIGNED_INT_ELEMENTS; | 3875 return i::EXTERNAL_UNSIGNED_INT_ELEMENTS; |
3874 break; | 3876 break; |
3875 case kExternalFloatArray: | 3877 case kExternalFloatArray: |
3876 return i::EXTERNAL_FLOAT_ELEMENTS; | 3878 return i::EXTERNAL_FLOAT_ELEMENTS; |
3877 break; | 3879 break; |
| 3880 case kExternalFloat32x4Array: |
| 3881 return i::EXTERNAL_FLOAT32x4_ELEMENTS; |
| 3882 break; |
| 3883 case kExternalInt32x4Array: |
| 3884 return i::EXTERNAL_INT32x4_ELEMENTS; |
| 3885 break; |
3878 case kExternalDoubleArray: | 3886 case kExternalDoubleArray: |
3879 return i::EXTERNAL_DOUBLE_ELEMENTS; | 3887 return i::EXTERNAL_DOUBLE_ELEMENTS; |
3880 break; | 3888 break; |
3881 case kExternalPixelArray: | 3889 case kExternalPixelArray: |
3882 return i::EXTERNAL_PIXEL_ELEMENTS; | 3890 return i::EXTERNAL_PIXEL_ELEMENTS; |
3883 break; | 3891 break; |
3884 } | 3892 } |
3885 UNREACHABLE(); | 3893 UNREACHABLE(); |
3886 return i::DICTIONARY_ELEMENTS; | 3894 return i::DICTIONARY_ELEMENTS; |
3887 } | 3895 } |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4018 case i::EXTERNAL_SHORT_ARRAY_TYPE: | 4026 case i::EXTERNAL_SHORT_ARRAY_TYPE: |
4019 return kExternalShortArray; | 4027 return kExternalShortArray; |
4020 case i::EXTERNAL_UNSIGNED_SHORT_ARRAY_TYPE: | 4028 case i::EXTERNAL_UNSIGNED_SHORT_ARRAY_TYPE: |
4021 return kExternalUnsignedShortArray; | 4029 return kExternalUnsignedShortArray; |
4022 case i::EXTERNAL_INT_ARRAY_TYPE: | 4030 case i::EXTERNAL_INT_ARRAY_TYPE: |
4023 return kExternalIntArray; | 4031 return kExternalIntArray; |
4024 case i::EXTERNAL_UNSIGNED_INT_ARRAY_TYPE: | 4032 case i::EXTERNAL_UNSIGNED_INT_ARRAY_TYPE: |
4025 return kExternalUnsignedIntArray; | 4033 return kExternalUnsignedIntArray; |
4026 case i::EXTERNAL_FLOAT_ARRAY_TYPE: | 4034 case i::EXTERNAL_FLOAT_ARRAY_TYPE: |
4027 return kExternalFloatArray; | 4035 return kExternalFloatArray; |
| 4036 case i::EXTERNAL_FLOAT32x4_ARRAY_TYPE: |
| 4037 return kExternalFloat32x4Array; |
| 4038 case i::EXTERNAL_INT32x4_ARRAY_TYPE: |
| 4039 return kExternalInt32x4Array; |
4028 case i::EXTERNAL_DOUBLE_ARRAY_TYPE: | 4040 case i::EXTERNAL_DOUBLE_ARRAY_TYPE: |
4029 return kExternalDoubleArray; | 4041 return kExternalDoubleArray; |
4030 case i::EXTERNAL_PIXEL_ARRAY_TYPE: | 4042 case i::EXTERNAL_PIXEL_ARRAY_TYPE: |
4031 return kExternalPixelArray; | 4043 return kExternalPixelArray; |
4032 default: | 4044 default: |
4033 return static_cast<ExternalArrayType>(-1); | 4045 return static_cast<ExternalArrayType>(-1); |
4034 } | 4046 } |
4035 } | 4047 } |
4036 | 4048 |
4037 | 4049 |
(...skipping 2251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6289 TYPED_ARRAY_NEW(Uint16Array, uint16_t, kExternalUnsignedShortArray, | 6301 TYPED_ARRAY_NEW(Uint16Array, uint16_t, kExternalUnsignedShortArray, |
6290 i::EXTERNAL_UNSIGNED_SHORT_ELEMENTS) | 6302 i::EXTERNAL_UNSIGNED_SHORT_ELEMENTS) |
6291 TYPED_ARRAY_NEW(Int16Array, int16_t, kExternalShortArray, | 6303 TYPED_ARRAY_NEW(Int16Array, int16_t, kExternalShortArray, |
6292 i::EXTERNAL_SHORT_ELEMENTS) | 6304 i::EXTERNAL_SHORT_ELEMENTS) |
6293 TYPED_ARRAY_NEW(Uint32Array, uint32_t, kExternalUnsignedIntArray, | 6305 TYPED_ARRAY_NEW(Uint32Array, uint32_t, kExternalUnsignedIntArray, |
6294 i::EXTERNAL_UNSIGNED_INT_ELEMENTS) | 6306 i::EXTERNAL_UNSIGNED_INT_ELEMENTS) |
6295 TYPED_ARRAY_NEW(Int32Array, int32_t, kExternalIntArray, | 6307 TYPED_ARRAY_NEW(Int32Array, int32_t, kExternalIntArray, |
6296 i::EXTERNAL_INT_ELEMENTS) | 6308 i::EXTERNAL_INT_ELEMENTS) |
6297 TYPED_ARRAY_NEW(Float32Array, float, kExternalFloatArray, | 6309 TYPED_ARRAY_NEW(Float32Array, float, kExternalFloatArray, |
6298 i::EXTERNAL_FLOAT_ELEMENTS) | 6310 i::EXTERNAL_FLOAT_ELEMENTS) |
| 6311 TYPED_ARRAY_NEW(Float32x4Array, i::float32x4_value_t, kExternalFloat32x4Array, |
| 6312 i::EXTERNAL_FLOAT32x4_ELEMENTS) |
| 6313 TYPED_ARRAY_NEW(Int32x4Array, i::int32x4_value_t, kExternalInt32x4Array, |
| 6314 i::EXTERNAL_INT32x4_ELEMENTS) |
6299 TYPED_ARRAY_NEW(Float64Array, double, kExternalDoubleArray, | 6315 TYPED_ARRAY_NEW(Float64Array, double, kExternalDoubleArray, |
6300 i::EXTERNAL_DOUBLE_ELEMENTS) | 6316 i::EXTERNAL_DOUBLE_ELEMENTS) |
6301 | 6317 |
6302 #undef TYPED_ARRAY_NEW | 6318 #undef TYPED_ARRAY_NEW |
6303 | 6319 |
6304 Local<DataView> DataView::New(Handle<ArrayBuffer> array_buffer, | 6320 Local<DataView> DataView::New(Handle<ArrayBuffer> array_buffer, |
6305 size_t byte_offset, size_t byte_length) { | 6321 size_t byte_offset, size_t byte_length) { |
6306 i::Isolate* isolate = i::Isolate::Current(); | 6322 i::Isolate* isolate = i::Isolate::Current(); |
6307 EnsureInitializedForIsolate( | 6323 EnsureInitializedForIsolate( |
6308 isolate, "v8::DataView::New(void*, size_t, size_t)"); | 6324 isolate, "v8::DataView::New(void*, size_t, size_t)"); |
(...skipping 1472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7781 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); | 7797 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); |
7782 Address callback_address = | 7798 Address callback_address = |
7783 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 7799 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
7784 VMState<EXTERNAL> state(isolate); | 7800 VMState<EXTERNAL> state(isolate); |
7785 ExternalCallbackScope call_scope(isolate, callback_address); | 7801 ExternalCallbackScope call_scope(isolate, callback_address); |
7786 callback(info); | 7802 callback(info); |
7787 } | 7803 } |
7788 | 7804 |
7789 | 7805 |
7790 } } // namespace v8::internal | 7806 } } // namespace v8::internal |
OLD | NEW |