Index: src/api.cc |
diff --git a/src/api.cc b/src/api.cc |
index 5c8a3142aedb88769d9db6978f5571da8a572faf..52d75aad3b003f8afb878bb2c1c2ec12f45bbc1d 100644 |
--- a/src/api.cc |
+++ b/src/api.cc |
@@ -3310,22 +3310,12 @@ void PrepareExternalArrayElements(i::Handle<i::JSObject> object, |
i::Handle<i::ExternalArray> array = |
isolate->factory()->NewExternalArray(length, array_type, data); |
- // If the object already has external elements, create a new, unique |
- // map if the element type is now changing, because assumptions about |
- // generated code based on the receiver's map will be invalid. |
- i::Handle<i::HeapObject> elements(object->elements()); |
- bool cant_reuse_map = |
- elements->map()->IsUndefined() || |
- !elements->map()->has_external_array_elements() || |
- elements->map() != isolate->heap()->MapForExternalArrayType(array_type); |
- if (cant_reuse_map) { |
- i::Handle<i::Map> external_array_map = |
- isolate->factory()->GetElementsTransitionMap( |
- i::Handle<i::Map>(object->map()), |
- GetElementsKindFromExternalArrayType(array_type), |
- object->HasFastProperties()); |
- object->set_map(*external_array_map); |
- } |
+ i::Handle<i::Map> external_array_map = |
+ isolate->factory()->GetElementsTransitionMap( |
+ object, |
+ GetElementsKindFromExternalArrayType(array_type)); |
+ |
+ object->set_map(*external_array_map); |
object->set_elements(*array); |
} |