From 6270b797bcd49362958e8c2d2661cab9dac35908 Mon Sep 17 00:00:00 2001 From: jkummerow Date: Tue, 28 Apr 2015 04:02:44 -0700 Subject: [PATCH] Only try to unregister prototype users that are prototypes themselves Because only such maps would have been registered in the first place. This is a performance fix/followup to f6187fb3b52e518 / r28076. BUG=chromium:481785 LOG=n R=yangguo@chromium.org Review URL: https://codereview.chromium.org/1105063003 Cr-Commit-Position: refs/heads/master@{#28101} --- src/objects.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/objects.cc b/src/objects.cc index 8d94786..7e3c70a 100644 --- a/src/objects.cc +++ b/src/objects.cc @@ -1918,7 +1918,8 @@ void JSObject::MigrateToMap(Handle object, Handle new_map, // all prototypes further up the chain are also registered with their // respective prototypes. Object* maybe_old_prototype = old_map->prototype(); - if (maybe_old_prototype->IsJSObject()) { + if (FLAG_track_prototype_users && old_map->is_prototype_map() && + maybe_old_prototype->IsJSObject()) { Handle old_prototype(JSObject::cast(maybe_old_prototype)); bool was_registered = JSObject::UnregisterPrototypeUser(old_prototype, old_map); -- 2.7.4