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

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: added x64 and arm code. Created 9 years, 11 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
Index: src/parser.cc
===================================================================
--- src/parser.cc (revision 6540)
+++ src/parser.cc (working copy)
@@ -3257,6 +3257,7 @@
ZoneList<ObjectLiteral::Property*>* properties =
new ZoneList<ObjectLiteral::Property*>(4);
int number_of_boilerplate_properties = 0;
+ bool has_function = false;
ObjectLiteralPropertyChecker checker(this, temp_scope_->StrictMode());
@@ -3344,6 +3345,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
@@ -3379,7 +3387,8 @@
literal_index,
is_simple,
fast_elements,
- depth);
+ depth,
+ has_function);
}
« src/hydrogen-instructions.h ('K') | « src/ia32/lithium-ia32.cc ('k') | src/runtime.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698