Reviewers: Sven Panne,
Message:
PTAL
Description:
ARM: Use loop to initialize locals when optimizing for size.
Please review this at https://codereview.chromium.org/52163002/
SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge
Affected files (+14, -2 lines):
M src/arm/full-codegen-arm.cc
Index: src/arm/full-codegen-arm.cc
diff --git a/src/arm/full-codegen-arm.cc b/src/arm/full-codegen-arm.cc
index
c57c78559803c81e51137a32876688dff0ceebc0..fbea793efd6fbd962027b418074c40f236fb2b68
100644
--- a/src/arm/full-codegen-arm.cc
+++ b/src/arm/full-codegen-arm.cc
@@ -168,9 +168,21 @@ 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++) {
+ // Emit a loop to initialize stack cells for locals when optimizing
for
+ // size. Otherwise, unroll the loop for maximum performance.
+ if (FLAG_optimize_for_size && locals_count > 4) {
+ Label loop;
+ __ mov(r2, Operand(locals_count));
+ __ LoadRoot(ip, Heap::kUndefinedValueRootIndex);
+ __ bind(&loop);
+ __ sub(r2, r2, Operand(1), SetCC);
__ push(ip);
+ __ b(&loop, ne);
+ } else {
+ __ LoadRoot(ip, Heap::kUndefinedValueRootIndex);
+ for (int i = 0; i < locals_count; i++) {
+ __ push(ip);
+ }
}
}
}
--
--
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.