| Index: src/arm/full-codegen-arm.cc
|
| ===================================================================
|
| --- src/arm/full-codegen-arm.cc (revision 7674)
|
| +++ src/arm/full-codegen-arm.cc (working copy)
|
| @@ -3774,48 +3774,13 @@
|
| break;
|
| }
|
|
|
| - case Token::SUB: {
|
| - Comment cmt(masm_, "[ UnaryOperation (SUB)");
|
| - bool can_overwrite = expr->expression()->ResultOverwriteAllowed();
|
| - UnaryOverwriteMode overwrite =
|
| - can_overwrite ? UNARY_OVERWRITE : UNARY_NO_OVERWRITE;
|
| - GenericUnaryOpStub stub(Token::SUB, overwrite, NO_UNARY_FLAGS);
|
| - // GenericUnaryOpStub expects the argument to be in the
|
| - // accumulator register r0.
|
| - VisitForAccumulatorValue(expr->expression());
|
| - __ CallStub(&stub);
|
| - context()->Plug(r0);
|
| + case Token::SUB:
|
| + EmitUnaryOperation(expr, "[ UnaryOperation (SUB)");
|
| break;
|
| - }
|
|
|
| - case Token::BIT_NOT: {
|
| - Comment cmt(masm_, "[ UnaryOperation (BIT_NOT)");
|
| - // The generic unary operation stub expects the argument to be
|
| - // in the accumulator register r0.
|
| - VisitForAccumulatorValue(expr->expression());
|
| - Label done;
|
| - bool inline_smi_code = ShouldInlineSmiCase(expr->op());
|
| - if (inline_smi_code) {
|
| - Label call_stub;
|
| - __ JumpIfNotSmi(r0, &call_stub);
|
| - __ mvn(r0, Operand(r0));
|
| - // Bit-clear inverted smi-tag.
|
| - __ bic(r0, r0, Operand(kSmiTagMask));
|
| - __ b(&done);
|
| - __ bind(&call_stub);
|
| - }
|
| - bool overwrite = expr->expression()->ResultOverwriteAllowed();
|
| - UnaryOpFlags flags = inline_smi_code
|
| - ? NO_UNARY_SMI_CODE_IN_STUB
|
| - : NO_UNARY_FLAGS;
|
| - UnaryOverwriteMode mode =
|
| - overwrite ? UNARY_OVERWRITE : UNARY_NO_OVERWRITE;
|
| - GenericUnaryOpStub stub(Token::BIT_NOT, mode, flags);
|
| - __ CallStub(&stub);
|
| - __ bind(&done);
|
| - context()->Plug(r0);
|
| + case Token::BIT_NOT:
|
| + EmitUnaryOperation(expr, "[ UnaryOperation (BIT_NOT)");
|
| break;
|
| - }
|
|
|
| default:
|
| UNREACHABLE();
|
| @@ -3823,6 +3788,22 @@
|
| }
|
|
|
|
|
| +void FullCodeGenerator::EmitUnaryOperation(UnaryOperation* expr,
|
| + const char* comment) {
|
| + // TODO(svenpanne): Allowing format strings in Comment would be nice here...
|
| + Comment cmt(masm_, comment);
|
| + bool can_overwrite = expr->expression()->ResultOverwriteAllowed();
|
| + UnaryOverwriteMode overwrite =
|
| + can_overwrite ? UNARY_OVERWRITE : UNARY_NO_OVERWRITE;
|
| + TypeRecordingUnaryOpStub stub(expr->op(), overwrite);
|
| + // TypeRecordingGenericUnaryOpStub expects the argument to be in the
|
| + // accumulator register r0.
|
| + VisitForAccumulatorValue(expr->expression());
|
| + __ CallStub(&stub);
|
| + context()->Plug(r0);
|
| +}
|
| +
|
| +
|
| void FullCodeGenerator::VisitCountOperation(CountOperation* expr) {
|
| Comment cmnt(masm_, "[ CountOperation");
|
| SetSourcePosition(expr->position());
|
|
|