Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Unified Diff: src/objects.cc

Issue 1143813002: Reland "[strong] Object literals create strong objects" (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix handlification bug Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/hydrogen.cc ('k') | src/parser.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects.cc
diff --git a/src/objects.cc b/src/objects.cc
index 645ea57e344d2727209c68fa90b4a98843108d0e..28670a94f758aa7d00054ee3514101cf65a04ef3 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -3804,7 +3804,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);
@@ -10318,7 +10320,10 @@ Handle<Object> CacheInitialJSArrayMaps(
maps->set(next_kind, *new_map);
current_map = new_map;
}
- native_context->set_js_array_maps(*maps);
+ if (initial_map->is_strong())
+ native_context->set_js_array_strong_maps(*maps);
+ else
+ native_context->set_js_array_maps(*maps);
return initial_map;
}
@@ -10353,13 +10358,18 @@ void JSFunction::SetInstancePrototype(Handle<JSFunction> function,
JSFunction::SetInitialMap(function, new_map, value);
// If the function is used as the global Array function, cache the
- // initial map (and transitioned versions) in the native context.
- Context* native_context = function->context()->native_context();
- Object* array_function =
- native_context->get(Context::ARRAY_FUNCTION_INDEX);
+ // updated initial maps (and transitioned versions) in the native context.
+ Handle<Context> native_context(function->context()->native_context(),
+ isolate);
+ Handle<Object> array_function(
+ native_context->get(Context::ARRAY_FUNCTION_INDEX), isolate);
if (array_function->IsJSFunction() &&
- *function == JSFunction::cast(array_function)) {
- CacheInitialJSArrayMaps(handle(native_context, isolate), new_map);
+ *function == JSFunction::cast(*array_function)) {
+ CacheInitialJSArrayMaps(native_context, new_map);
+ Handle<Map> new_strong_map =
+ Map::Copy(initial_map, "SetInstancePrototype");
+ new_strong_map->set_is_strong(true);
+ CacheInitialJSArrayMaps(native_context, new_strong_map);
}
}
« no previous file with comments | « src/hydrogen.cc ('k') | src/parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698