Revision: 18398
Author: plin...@gmail.com
Date: Fri Dec 20 19:40:12 2013 UTC
Log: MIPS: Improve allocate locals to reduce code size.
TEST=
BUG=
R=plin...@gmail.com
Review URL: https://codereview.chromium.org/104713013
Patch from Dusan Milosavljevic <dusan.milosavlje...@rt-rk.com>.
http://code.google.com/p/v8/source/detail?r=18398
Modified:
/branches/bleeding_edge/src/mips/full-codegen-mips.cc
=======================================
--- /branches/bleeding_edge/src/mips/full-codegen-mips.cc Wed Dec 18
17:56:30 2013 UTC
+++ /branches/bleeding_edge/src/mips/full-codegen-mips.cc Fri Dec 20
19:40:12 2013 UTC
@@ -179,20 +179,21 @@
// Generators allocate locals, if any, in context slots.
ASSERT(!info->function()->is_generator() || locals_count == 0);
if (locals_count > 0) {
- __ LoadRoot(at, Heap::kUndefinedValueRootIndex);
// 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) {
+ if ((FLAG_optimize_for_size && locals_count > 4) ||
+ !is_int16(locals_count)) {
Label loop;
- __ li(a2, Operand(locals_count));
+ __ Subu(a2, sp, Operand(locals_count * kPointerSize));
__ bind(&loop);
- __ Subu(a2, a2, 1);
- __ push(t5);
- __ Branch(&loop, gt, a2, Operand(zero_reg));
+ __ Subu(sp, sp, Operand(kPointerSize));
+ __ Branch(&loop, gt, sp, Operand(a2), USE_DELAY_SLOT);
+ __ sw(t5, MemOperand(sp, 0)); // Push in the delay slot.
} else {
+ __ Subu(sp, sp, Operand(locals_count * kPointerSize));
for (int i = 0; i < locals_count; i++) {
- __ push(t5);
+ __ sw(t5, MemOperand(sp, i * kPointerSize));
}
}
}
--
--
v8-dev mailing list
v8-dev@googlegroups.com
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 v8-dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.