MIPS: Use loop to initialize locals when optimizing for size.
Port r17465 (9f3f3d1) BUG= R=plind44@gmail.com Review URL: https://codereview.chromium.org/59853002 Patch from Balazs Kilvady <kilvadyb@homejinni.com>. git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@17505 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
parent
9f80c8d72e
commit
ebc5445912
@ -180,8 +180,20 @@ void FullCodeGenerator::Generate() {
|
||||
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) {
|
||||
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(at);
|
||||
__ push(t5);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user