Index: src/objects.cc |
diff --git a/src/objects.cc b/src/objects.cc |
index 6dc5de2552847c8487da20604452705a7837143f..97f43506b984bfd39194f3633e10d15589d1e726 100644 |
--- a/src/objects.cc |
+++ b/src/objects.cc |
@@ -3800,7 +3800,9 @@ Handle<Map> Map::TransitionElementsTo(Handle<Map> map, |
Isolate* isolate = map->GetIsolate(); |
Context* native_context = isolate->context()->native_context(); |
- Object* maybe_array_maps = native_context->js_array_maps(); |
+ Object* maybe_array_maps = map->is_strong() |
+ ? native_context->js_array_strong_maps() |
+ : native_context->js_array_maps(); |
if (maybe_array_maps->IsFixedArray()) { |
DisallowHeapAllocation no_gc; |
FixedArray* array_maps = FixedArray::cast(maybe_array_maps); |
@@ -10288,7 +10290,7 @@ void Map::SetPrototype(Handle<Map> map, Handle<Object> prototype, |
Handle<Object> CacheInitialJSArrayMaps( |
- Handle<Context> native_context, Handle<Map> initial_map) { |
+ Handle<Context> native_context, Handle<Map> initial_map, bool is_strong) { |
// Replace all of the cached initial array maps in the native context with |
// the appropriate transitioned elements kind maps. |
Factory* factory = native_context->GetIsolate()->factory(); |
@@ -10314,7 +10316,10 @@ Handle<Object> CacheInitialJSArrayMaps( |
maps->set(next_kind, *new_map); |
current_map = new_map; |
} |
- native_context->set_js_array_maps(*maps); |
+ if (is_strong) |
+ native_context->set_js_array_strong_maps(*maps); |
+ else |
+ native_context->set_js_array_maps(*maps); |
return initial_map; |
} |
@@ -10355,7 +10360,14 @@ void JSFunction::SetInstancePrototype(Handle<JSFunction> function, |
native_context->get(Context::ARRAY_FUNCTION_INDEX); |
if (array_function->IsJSFunction() && |
*function == JSFunction::cast(array_function)) { |
- CacheInitialJSArrayMaps(handle(native_context, isolate), new_map); |
+ CacheInitialJSArrayMaps(handle(native_context, isolate), new_map, |
+ false); |
+ // Piggy-back this place to also create the strong array maps. |
+ Handle<Map> new_strong_map = |
+ Map::Copy(initial_map, "SetInstancePrototype"); |
+ new_strong_map->set_is_strong(true); |
+ CacheInitialJSArrayMaps(handle(native_context, isolate), |
+ new_strong_map, true); |
} |
} |