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

Unified Diff: src/objects.cc

Issue 706243002: Avoid some unnecessary fast-properties map creations. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: update tests Created 6 years, 1 month 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 | « no previous file | src/runtime/runtime-object.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 258390c4d5cb2b62ff079e31d90de3e5595b6fcb..2b17ebb8b12d816c4401ecffdb18f861fc088a15 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -9416,13 +9416,17 @@ void JSObject::OptimizeAsPrototype(Handle<JSObject> object,
// First normalize to ensure all JSFunctions are CONSTANT.
JSObject::NormalizeProperties(object, KEEP_INOBJECT_PROPERTIES, 0);
}
+ bool has_just_copied_map = false;
if (!object->HasFastProperties()) {
JSObject::MigrateSlowToFast(object, 0);
+ has_just_copied_map = true;
}
if (mode == FAST_PROTOTYPE && object->HasFastProperties() &&
!object->map()->is_prototype_map()) {
- Handle<Map> new_map = Map::Copy(handle(object->map()));
- JSObject::MigrateToMap(object, new_map);
+ if (!has_just_copied_map) {
+ Handle<Map> new_map = Map::Copy(handle(object->map()));
+ JSObject::MigrateToMap(object, new_map);
+ }
object->map()->set_is_prototype_map(true);
}
}
« no previous file with comments | « no previous file | src/runtime/runtime-object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698