Only try to unregister prototype users that are prototypes themselves
authorjkummerow <jkummerow@chromium.org>
Tue, 28 Apr 2015 11:02:44 +0000 (04:02 -0700)
committerCommit bot <commit-bot@chromium.org>
Tue, 28 Apr 2015 11:02:18 +0000 (11:02 +0000)
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

index 8d94786..7e3c70a 100644 (file)
@@ -1918,7 +1918,8 @@ void JSObject::MigrateToMap(Handle<JSObject> object, Handle<Map> 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<JSObject> old_prototype(JSObject::cast(maybe_old_prototype));
     bool was_registered =
         JSObject::UnregisterPrototypeUser(old_prototype, old_map);