Revision: 17505
Author:   [email protected]
Date:     Tue Nov  5 17:52:47 2013 UTC
Log:      MIPS: Use loop to initialize locals when optimizing for size.

Port r17465 (9f3f3d1)

BUG=
[email protected]

Review URL: https://codereview.chromium.org/59853002

Patch from Balazs Kilvady <[email protected]>.
http://code.google.com/p/v8/source/detail?r=17505

Modified:
 /branches/bleeding_edge/src/mips/full-codegen-mips.cc

=======================================
--- /branches/bleeding_edge/src/mips/full-codegen-mips.cc Tue Nov 5 09:54:59 2013 UTC +++ /branches/bleeding_edge/src/mips/full-codegen-mips.cc Tue Nov 5 17:52:47 2013 UTC
@@ -180,8 +180,20 @@
     ASSERT(!info->function()->is_generator() || locals_count == 0);
     if (locals_count > 0) {
       __ LoadRoot(at, Heap::kUndefinedValueRootIndex);
-      for (int i = 0; i < locals_count; i++) {
-        __ push(at);
+ // Emit a loop to initialize stack cells for locals when optimizing for
+      // size. Otherwise, unroll the loop for maximum performance.
+      __ LoadRoot(t5, Heap::kUndefinedValueRootIndex);
+      if (FLAG_optimize_for_size && locals_count > 4) {
+        Label loop;
+        __ li(a2, Operand(locals_count));
+        __ bind(&loop);
+        __ Subu(a2, a2, 1);
+        __ push(t5);
+        __ Branch(&loop, gt, a2, Operand(zero_reg));
+      } else {
+        for (int i = 0; i < locals_count; i++) {
+          __ push(t5);
+        }
       }
     }
   }

--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to