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

Unified Diff: src/hydrogen.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/handles.cc ('k') | src/hydrogen-instructions.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/hydrogen.cc
===================================================================
--- src/hydrogen.cc (revision 7281)
+++ src/hydrogen.cc (working copy)
@@ -2904,7 +2904,8 @@
expr->constant_properties(),
expr->fast_elements(),
expr->literal_index(),
- expr->depth()));
+ expr->depth(),
+ expr->has_function()));
// The object is expected in the bailout environment during computation
// of the property values and is the value of the entire expression.
PushAndAdd(literal);
@@ -2945,7 +2946,19 @@
default: UNREACHABLE();
}
}
- ast_context()->ReturnValue(Pop());
+
+ if (expr->has_function()) {
+ // Return the result of the transformation to fast properties
+ // instead of the original since this operation changes the map
+ // of the object. This makes sure that the original object won't
+ // be used by other optimized code before it is transformed
+ // (e.g. because of code motion).
+ HToFastProperties* result = new HToFastProperties(Pop());
+ AddInstruction(result);
+ ast_context()->ReturnValue(result);
+ } else {
+ ast_context()->ReturnValue(Pop());
+ }
}
« no previous file with comments | « src/handles.cc ('k') | src/hydrogen-instructions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698