Index: src/api.cc |
diff --git a/src/api.cc b/src/api.cc |
index 26558c42924954037831b23aa2f5de26f3fb9df1..5c8a3142aedb88769d9db6978f5571da8a572faf 100644 |
--- a/src/api.cc |
+++ b/src/api.cc |
@@ -3266,6 +3266,42 @@ bool v8::Object::DeleteHiddenValue(v8::Handle<v8::String> key) { |
namespace { |
+static i::ElementsKind GetElementsKindFromExternalArrayType( |
+ ExternalArrayType array_type) { |
+ switch (array_type) { |
+ case kExternalByteArray: |
+ return i::EXTERNAL_BYTE_ELEMENTS; |
+ break; |
+ case kExternalUnsignedByteArray: |
+ return i::EXTERNAL_UNSIGNED_BYTE_ELEMENTS; |
+ break; |
+ case kExternalShortArray: |
+ return i::EXTERNAL_SHORT_ELEMENTS; |
+ break; |
+ case kExternalUnsignedShortArray: |
+ return i::EXTERNAL_UNSIGNED_SHORT_ELEMENTS; |
+ break; |
+ case kExternalIntArray: |
+ return i::EXTERNAL_INT_ELEMENTS; |
+ break; |
+ case kExternalUnsignedIntArray: |
+ return i::EXTERNAL_UNSIGNED_INT_ELEMENTS; |
+ break; |
+ case kExternalFloatArray: |
+ return i::EXTERNAL_FLOAT_ELEMENTS; |
+ break; |
+ case kExternalDoubleArray: |
+ return i::EXTERNAL_DOUBLE_ELEMENTS; |
+ break; |
+ case kExternalPixelArray: |
+ return i::EXTERNAL_PIXEL_ELEMENTS; |
+ break; |
+ } |
+ UNREACHABLE(); |
+ return i::DICTIONARY_ELEMENTS; |
+} |
+ |
+ |
void PrepareExternalArrayElements(i::Handle<i::JSObject> object, |
void* data, |
ExternalArrayType array_type, |
@@ -3284,9 +3320,9 @@ void PrepareExternalArrayElements(i::Handle<i::JSObject> object, |
elements->map() != isolate->heap()->MapForExternalArrayType(array_type); |
if (cant_reuse_map) { |
i::Handle<i::Map> external_array_map = |
- isolate->factory()->GetExternalArrayElementsMap( |
+ isolate->factory()->GetElementsTransitionMap( |
i::Handle<i::Map>(object->map()), |
- array_type, |
+ GetElementsKindFromExternalArrayType(array_type), |
object->HasFastProperties()); |
object->set_map(*external_array_map); |
} |
@@ -3348,6 +3384,7 @@ int v8::Object::GetIndexedPropertiesPixelDataLength() { |
} |
} |
+ |
void v8::Object::SetIndexedPropertiesToExternalArrayData( |
void* data, |
ExternalArrayType array_type, |