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

Unified Diff: src/parser.cc

Issue 6240012: Optimize calls to object literal properties that are initialized with a funct... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: rebased and fixed lintos Created 9 years, 9 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/ia32/lithium-ia32.cc ('k') | src/runtime.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/parser.cc
===================================================================
--- src/parser.cc (revision 7281)
+++ src/parser.cc (working copy)
@@ -3340,6 +3340,7 @@
ZoneList<ObjectLiteral::Property*>* properties =
new ZoneList<ObjectLiteral::Property*>(4);
int number_of_boilerplate_properties = 0;
+ bool has_function = false;
ObjectLiteralPropertyChecker checker(this, top_scope_->is_strict_mode());
@@ -3428,6 +3429,13 @@
ObjectLiteral::Property* property =
new ObjectLiteral::Property(key, value);
+ // Mark object literals that contain function literals and pretenure the
+ // literal so it can be added as a constant function property.
+ if (value->AsFunctionLiteral() != NULL) {
+ has_function = true;
+ value->AsFunctionLiteral()->set_pretenure(true);
+ }
+
// Count CONSTANT or COMPUTED properties to maintain the enumeration order.
if (IsBoilerplateProperty(property)) number_of_boilerplate_properties++;
// Validate the property
@@ -3463,7 +3471,8 @@
literal_index,
is_simple,
fast_elements,
- depth);
+ depth,
+ has_function);
}
« no previous file with comments | « src/ia32/lithium-ia32.cc ('k') | src/runtime.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698