| Index: src/arm/full-codegen-arm.cc
|
| ===================================================================
|
| --- src/arm/full-codegen-arm.cc (revision 3712)
|
| +++ src/arm/full-codegen-arm.cc (working copy)
|
| @@ -1364,6 +1364,45 @@
|
| break;
|
| }
|
|
|
| + case Token::SUB: {
|
| + Comment cmt(masm_, "[ UnaryOperation (SUB)");
|
| + bool overwrite =
|
| + (expr->expression()->AsBinaryOperation() != NULL &&
|
| + expr->expression()->AsBinaryOperation()->ResultOverwriteAllowed());
|
| + GenericUnaryOpStub stub(Token::SUB, overwrite);
|
| + // GenericUnaryOpStub expects the argument to be in the
|
| + // accumulator register r0.
|
| + VisitForValue(expr->expression(), kAccumulator);
|
| + __ CallStub(&stub);
|
| + Apply(context_, r0);
|
| + break;
|
| + }
|
| +
|
| + case Token::BIT_NOT: {
|
| + Comment cmt(masm_, "[ UnaryOperation (BIT_NOT)");
|
| + bool overwrite =
|
| + (expr->expression()->AsBinaryOperation() != NULL &&
|
| + expr->expression()->AsBinaryOperation()->ResultOverwriteAllowed());
|
| + GenericUnaryOpStub stub(Token::BIT_NOT, overwrite);
|
| + // GenericUnaryOpStub expects the argument to be in the
|
| + // accumulator register r0.
|
| + VisitForValue(expr->expression(), kAccumulator);
|
| + // Avoid calling the stub for Smis.
|
| + Label smi, done;
|
| + __ tst(result_register(), Operand(kSmiTagMask));
|
| + __ b(eq, &smi);
|
| + // Non-smi: call stub leaving result in accumulator register.
|
| + __ CallStub(&stub);
|
| + __ b(&done);
|
| + // Perform operation directly on Smis.
|
| + __ bind(&smi);
|
| + __ mvn(result_register(), Operand(result_register()));
|
| + // Bit-clear inverted smi-tag.
|
| + __ bic(result_register(), result_register(), Operand(kSmiTagMask));
|
| + __ bind(&done);
|
| + Apply(context_, result_register());
|
| + }
|
| +
|
| default:
|
| UNREACHABLE();
|
| }
|
|
|