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

Unified Diff: src/objects.cc

Issue 1347243004: [strong] Implement revised strong class semantics (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: \cl feedback Created 5 years, 3 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/messages.h ('k') | src/runtime/runtime-classes.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 28007d73f5e1ce27867312a38e713ef5d6d9cc8a..d2821a4320755d0b2c1d56c9c5a5896291d5f6f2 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -10512,6 +10512,9 @@ void JSFunction::SetInstancePrototype(Handle<JSFunction> function,
function->set_prototype_or_initial_map(*value);
} else {
Handle<Map> new_map = Map::Copy(initial_map, "SetInstancePrototype");
+ if (function->map()->is_strong()) {
+ new_map->set_is_strong();
+ }
JSFunction::SetInitialMap(function, new_map, value);
// If the function is used as the global Array function, cache the
@@ -10636,6 +10639,9 @@ void JSFunction::EnsureHasInitialMap(Handle<JSFunction> function) {
in_object_properties = function->shared()->CalculateInObjectProperties();
}
Handle<Map> map = isolate->factory()->NewMap(instance_type, instance_size);
+ if (function->map()->is_strong()) {
+ map->set_is_strong();
+ }
// Fetch or allocate prototype.
Handle<Object> prototype;
@@ -10649,7 +10655,8 @@ void JSFunction::EnsureHasInitialMap(Handle<JSFunction> function) {
DCHECK(map->has_fast_object_elements());
// Finally link initial map and constructor function.
- JSFunction::SetInitialMap(function, map, Handle<JSReceiver>::cast(prototype));
+ DCHECK(prototype->IsJSReceiver());
+ JSFunction::SetInitialMap(function, map, prototype);
if (!function->shared()->is_generator()) {
function->StartInobjectSlackTracking();
« no previous file with comments | « src/messages.h ('k') | src/runtime/runtime-classes.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698