summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrei Popescu <andreip@google.com>2010-04-26 13:52:20 +0100
committerAndrei Popescu <andreip@google.com>2010-04-26 13:52:20 +0100
commit10e7c6c7845a8d467bf3fd61a215dfedd8554e21 (patch)
tree1cc90da887da05638fae632f10fab116aac8fddb
parent6a927b2a077ba8a767bd21abcfbf1c4e3d1b11e0 (diff)
downloadandroid_external_v8-10e7c6c7845a8d467bf3fd61a215dfedd8554e21.tar.gz
android_external_v8-10e7c6c7845a8d467bf3fd61a215dfedd8554e21.tar.bz2
android_external_v8-10e7c6c7845a8d467bf3fd61a215dfedd8554e21.zip
Cherry pick http://codereview.chromium.org/1791001
"Fix bug in the ARM full code generator for inlined count operations. (on Android branch)." Fix bug: 2628556 Change-Id: Ide81c4ba3191aa18e1350d51c1fc44698f364dd2
-rw-r--r--src/arm/full-codegen-arm.cc11
1 files changed, 4 insertions, 7 deletions
diff --git a/src/arm/full-codegen-arm.cc b/src/arm/full-codegen-arm.cc
index 48963738..670de09f 100644
--- a/src/arm/full-codegen-arm.cc
+++ b/src/arm/full-codegen-arm.cc
@@ -1592,10 +1592,9 @@ void FullCodeGenerator::VisitCountOperation(CountOperation* expr) {
// Inline smi case if we are in a loop.
Label stub_call, done;
+ int count_value = expr->op() == Token::INC ? 1 : -1;
if (loop_depth() > 0) {
- __ add(r0, r0, Operand(expr->op() == Token::INC
- ? Smi::FromInt(1)
- : Smi::FromInt(-1)));
+ __ add(r0, r0, Operand(Smi::FromInt(count_value)), SetCC);
__ b(vs, &stub_call);
// We could eliminate this smi check if we split the code at
// the first smi check before calling ToNumber.
@@ -1603,11 +1602,9 @@ void FullCodeGenerator::VisitCountOperation(CountOperation* expr) {
__ b(eq, &done);
__ bind(&stub_call);
// Call stub. Undo operation first.
- __ sub(r0, r0, Operand(r1));
+ __ sub(r0, r0, Operand(Smi::FromInt(count_value)));
}
- __ mov(r1, Operand(expr->op() == Token::INC
- ? Smi::FromInt(1)
- : Smi::FromInt(-1)));
+ __ mov(r1, Operand(Smi::FromInt(count_value)));
GenericBinaryOpStub stub(Token::ADD, NO_OVERWRITE);
__ CallStub(&stub);
__ bind(&done);