Commit 011ca837 authored by bmeurer@chromium.org's avatar bmeurer@chromium.org

ARM: Use loop to initialize locals when optimizing for size.

R=svenpanne@chromium.org

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@17465 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 53710033
......@@ -168,9 +168,20 @@ void FullCodeGenerator::Generate() {
// Generators allocate locals, if any, in context slots.
ASSERT(!info->function()->is_generator() || locals_count == 0);
if (locals_count > 0) {
__ LoadRoot(ip, Heap::kUndefinedValueRootIndex);
for (int i = 0; i < locals_count; i++) {
__ push(ip);
// Emit a loop to initialize stack cells for locals when optimizing for
// size. Otherwise, unroll the loop for maximum performance.
__ LoadRoot(r9, Heap::kUndefinedValueRootIndex);
if (FLAG_optimize_for_size && locals_count > 4) {
Label loop;
__ mov(r2, Operand(locals_count));
__ bind(&loop);
__ sub(r2, r2, Operand(1), SetCC);
__ push(r9);
__ b(&loop, ne);
} else {
for (int i = 0; i < locals_count; i++) {
__ push(r9);
}
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment