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 2413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2424 | 2424 |
2425 | 2425 |
2426 #define TYPED_ARRAY_LIST(F) \ | 2426 #define TYPED_ARRAY_LIST(F) \ |
2427 F(Uint8Array, kExternalUnsignedByteArray) \ | 2427 F(Uint8Array, kExternalUnsignedByteArray) \ |
2428 F(Int8Array, kExternalByteArray) \ | 2428 F(Int8Array, kExternalByteArray) \ |
2429 F(Uint16Array, kExternalUnsignedShortArray) \ | 2429 F(Uint16Array, kExternalUnsignedShortArray) \ |
2430 F(Int16Array, kExternalShortArray) \ | 2430 F(Int16Array, kExternalShortArray) \ |
2431 F(Uint32Array, kExternalUnsignedIntArray) \ | 2431 F(Uint32Array, kExternalUnsignedIntArray) \ |
2432 F(Int32Array, kExternalIntArray) \ | 2432 F(Int32Array, kExternalIntArray) \ |
2433 F(Float32Array, kExternalFloatArray) \ | 2433 F(Float32Array, kExternalFloatArray) \ |
2434 F(Float64Array, kExternalDoubleArray) | 2434 F(Float64Array, kExternalDoubleArray) \ |
| 2435 F(Uint8ClampedArray, kExternalPixelArray) |
2435 | 2436 |
2436 | 2437 |
2437 #define VALUE_IS_TYPED_ARRAY(TypedArray, type_const) \ | 2438 #define VALUE_IS_TYPED_ARRAY(TypedArray, type_const) \ |
2438 bool Value::Is##TypedArray() const { \ | 2439 bool Value::Is##TypedArray() const { \ |
2439 if (IsDeadCheck(i::Isolate::Current(), "v8::Value::Is" #TypedArray "()")) \ | 2440 if (IsDeadCheck(i::Isolate::Current(), "v8::Value::Is" #TypedArray "()")) \ |
2440 return false; \ | 2441 return false; \ |
2441 i::Handle<i::Object> obj = Utils::OpenHandle(this); \ | 2442 i::Handle<i::Object> obj = Utils::OpenHandle(this); \ |
2442 if (!obj->IsJSTypedArray()) return false; \ | 2443 if (!obj->IsJSTypedArray()) return false; \ |
2443 return i::JSTypedArray::cast(*obj)->type() == type_const; \ | 2444 return i::JSTypedArray::cast(*obj)->type() == type_const; \ |
2444 } | 2445 } |
(...skipping 3524 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5969 ENTER_V8(isolate); \ | 5970 ENTER_V8(isolate); \ |
5970 i::Handle<i::JSTypedArray> obj = \ | 5971 i::Handle<i::JSTypedArray> obj = \ |
5971 NewTypedArray<element_type, array_type, elements_kind>( \ | 5972 NewTypedArray<element_type, array_type, elements_kind>( \ |
5972 isolate, array_buffer, byte_offset, length); \ | 5973 isolate, array_buffer, byte_offset, length); \ |
5973 return Utils::ToLocal##TypedArray(obj); \ | 5974 return Utils::ToLocal##TypedArray(obj); \ |
5974 } | 5975 } |
5975 | 5976 |
5976 | 5977 |
5977 TYPED_ARRAY_NEW(Uint8Array, uint8_t, kExternalUnsignedByteArray, | 5978 TYPED_ARRAY_NEW(Uint8Array, uint8_t, kExternalUnsignedByteArray, |
5978 i::EXTERNAL_UNSIGNED_BYTE_ELEMENTS) | 5979 i::EXTERNAL_UNSIGNED_BYTE_ELEMENTS) |
| 5980 TYPED_ARRAY_NEW(Uint8ClampedArray, uint8_t, kExternalPixelArray, |
| 5981 i::EXTERNAL_PIXEL_ELEMENTS) |
5979 TYPED_ARRAY_NEW(Int8Array, int8_t, kExternalByteArray, | 5982 TYPED_ARRAY_NEW(Int8Array, int8_t, kExternalByteArray, |
5980 i::EXTERNAL_BYTE_ELEMENTS) | 5983 i::EXTERNAL_BYTE_ELEMENTS) |
5981 TYPED_ARRAY_NEW(Uint16Array, uint16_t, kExternalUnsignedShortArray, | 5984 TYPED_ARRAY_NEW(Uint16Array, uint16_t, kExternalUnsignedShortArray, |
5982 i::EXTERNAL_UNSIGNED_SHORT_ELEMENTS) | 5985 i::EXTERNAL_UNSIGNED_SHORT_ELEMENTS) |
5983 TYPED_ARRAY_NEW(Int16Array, int16_t, kExternalShortArray, | 5986 TYPED_ARRAY_NEW(Int16Array, int16_t, kExternalShortArray, |
5984 i::EXTERNAL_SHORT_ELEMENTS) | 5987 i::EXTERNAL_SHORT_ELEMENTS) |
5985 TYPED_ARRAY_NEW(Uint32Array, uint32_t, kExternalUnsignedIntArray, | 5988 TYPED_ARRAY_NEW(Uint32Array, uint32_t, kExternalUnsignedIntArray, |
5986 i::EXTERNAL_UNSIGNED_INT_ELEMENTS) | 5989 i::EXTERNAL_UNSIGNED_INT_ELEMENTS) |
5987 TYPED_ARRAY_NEW(Int32Array, int32_t, kExternalIntArray, | 5990 TYPED_ARRAY_NEW(Int32Array, int32_t, kExternalIntArray, |
5988 i::EXTERNAL_INT_ELEMENTS) | 5991 i::EXTERNAL_INT_ELEMENTS) |
(...skipping 1678 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7667 | 7670 |
7668 v->VisitPointers(blocks_.first(), first_block_limit_); | 7671 v->VisitPointers(blocks_.first(), first_block_limit_); |
7669 | 7672 |
7670 for (int i = 1; i < blocks_.length(); i++) { | 7673 for (int i = 1; i < blocks_.length(); i++) { |
7671 v->VisitPointers(blocks_[i], &blocks_[i][kHandleBlockSize]); | 7674 v->VisitPointers(blocks_[i], &blocks_[i][kHandleBlockSize]); |
7672 } | 7675 } |
7673 } | 7676 } |
7674 | 7677 |
7675 | 7678 |
7676 } } // namespace v8::internal | 7679 } } // namespace v8::internal |
OLD | NEW |