From 5820f951c1323145e6230d026ad7024c21ed6433 Mon Sep 17 00:00:00 2001 From: "fschneider@chromium.org" Date: Fri, 13 Nov 2009 13:59:07 +0000 Subject: [PATCH] Improve the allocation and initialization of locals on IA32 in the top-level compiler. This optimization is already done on x64 and ARM. Until now we used a push immediate for each local variable on IA32: push $undefined push $undefined ... to initialize each local variable. This change does: mov eax, $undefined push eax push eax ... Review URL: http://codereview.chromium.org/393009 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3304 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/ia32/fast-codegen-ia32.cc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/ia32/fast-codegen-ia32.cc b/src/ia32/fast-codegen-ia32.cc index c366b40821..a01d754e47 100644 --- a/src/ia32/fast-codegen-ia32.cc +++ b/src/ia32/fast-codegen-ia32.cc @@ -62,8 +62,13 @@ void FastCodeGenerator::Generate(FunctionLiteral* fun) { { Comment cmnt(masm_, "[ Allocate locals"); int locals_count = fun->scope()->num_stack_slots(); - for (int i = 0; i < locals_count; i++) { + if (locals_count == 1) { __ push(Immediate(Factory::undefined_value())); + } else if (locals_count > 1) { + __ mov(eax, Immediate(Factory::undefined_value())); + for (int i = 0; i < locals_count; i++) { + __ push(eax); + } } }