Reviewers: William Hesse,

Message:
This optimization was missing on IA32.

Description:
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
   ...




Please review this at http://codereview.chromium.org/393009

SVN Base: http://v8.googlecode.com/svn/branches/bleeding_edge/

Affected files:
   M     src/ia32/fast-codegen-ia32.cc


Index: src/ia32/fast-codegen-ia32.cc
===================================================================
--- src/ia32/fast-codegen-ia32.cc       (revision 3300)
+++ src/ia32/fast-codegen-ia32.cc       (working copy)
@@ -62,8 +62,13 @@

    { 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);
+      }
      }
    }




--~--~---------~--~----~------------~-------~--~----~
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
-~----------~----~----~----~------~----~------~--~---

Reply via email to