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

Unified Diff: src/codegen-ia32.cc

Issue 27128: Go into slow case when encountering object initialization on the top level to... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 years, 10 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/ast.h ('k') | src/parser.cc » ('j') | src/parser.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/codegen-ia32.cc
===================================================================
--- src/codegen-ia32.cc (revision 1358)
+++ src/codegen-ia32.cc (working copy)
@@ -2758,6 +2758,15 @@
Reference target(this, node->target());
if (target.is_illegal()) return;
+ if (node->starts_initialization_block()) {
+ ASSERT(target.type() == Reference::NAMED ||
+ target.type() == Reference::KEYED);
+ // Changing to slow case in the beginning of an initialization block
Mads Ager (chromium) 2009/02/25 13:11:07 Change to slow case ... to avoid ... or Changing
olehougaard 2009/02/26 07:31:44 Fixed
+ // to avoid the quadratic behavior of repeatedly adding fast properties.
+ int stack_position = (target.type() == Reference::NAMED) ? 0 : 1;
+ frame_->Push(Operand(esp, stack_position * kPointerSize));
+ __ CallRuntime(Runtime::kToSlowProperties, 1);
+ }
if (node->op() == Token::ASSIGN ||
node->op() == Token::INIT_VAR ||
node->op() == Token::INIT_CONST) {
@@ -2789,6 +2798,14 @@
target.SetValue(CONST_INIT);
} else {
target.SetValue(NOT_CONST_INIT);
+ if (node->ends_initialization_block()) {
+ ASSERT(target.type() == Reference::NAMED ||
+ target.type() == Reference::KEYED);
+ // End of initialization block. Revert to fast case.
+ int stack_position = (target.type() == Reference::NAMED) ? 1 : 2;
+ frame_->Push(Operand(esp, stack_position * kPointerSize));
+ __ CallRuntime(Runtime::kToFastProperties, 1);
+ }
}
}
}
« no previous file with comments | « src/ast.h ('k') | src/parser.cc » ('j') | src/parser.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698