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
This commit is contained in:
fschneider@chromium.org 2009-11-13 13:59:07 +00:00
parent 2e3e770ab9
commit 5820f951c1

View File

@ -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);
}
}
}