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

Unified Diff: src/objects.cc

Issue 332783002: Optimize prototype chain when creating initial maps for functions used as constructors (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 6 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 | « no previous file | test/mjsunit/dictionary-properties.js » ('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 bdfa23cde59d32626192b08ec182f5e2784550e6..a306e88b04716c9e96b229aa573f7d4b7cf4ae25 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -10189,6 +10189,10 @@ void JSFunction::EnsureHasInitialMap(Handle<JSFunction> function) {
Handle<Object> prototype;
if (function->has_instance_prototype()) {
prototype = handle(function->instance_prototype(), isolate);
+ for (Handle<Object> p = prototype; !p->IsNull() && !p->IsJSProxy();
+ p = Object::GetPrototype(isolate, p)) {
+ JSObject::OptimizeAsPrototype(Handle<JSObject>::cast(p));
+ }
} else {
prototype = isolate->factory()->NewFunctionPrototype(function);
}
« no previous file with comments | « no previous file | test/mjsunit/dictionary-properties.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698