| Index: src/ia32/full-codegen-ia32.cc
|
| ===================================================================
|
| --- src/ia32/full-codegen-ia32.cc (revision 7674)
|
| +++ src/ia32/full-codegen-ia32.cc (working copy)
|
| @@ -3725,48 +3725,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 eax.
|
| - VisitForAccumulatorValue(expr->expression());
|
| - __ CallStub(&stub);
|
| - context()->Plug(eax);
|
| + 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 eax.
|
| - VisitForAccumulatorValue(expr->expression());
|
| - Label done;
|
| - bool inline_smi_case = ShouldInlineSmiCase(expr->op());
|
| - if (inline_smi_case) {
|
| - NearLabel call_stub;
|
| - __ test(eax, Immediate(kSmiTagMask));
|
| - __ j(not_zero, &call_stub);
|
| - __ lea(eax, Operand(eax, kSmiTagMask));
|
| - __ not_(eax);
|
| - __ jmp(&done);
|
| - __ bind(&call_stub);
|
| - }
|
| - bool overwrite = expr->expression()->ResultOverwriteAllowed();
|
| - UnaryOverwriteMode mode =
|
| - overwrite ? UNARY_OVERWRITE : UNARY_NO_OVERWRITE;
|
| - UnaryOpFlags flags = inline_smi_case
|
| - ? NO_UNARY_SMI_CODE_IN_STUB
|
| - : NO_UNARY_FLAGS;
|
| - GenericUnaryOpStub stub(Token::BIT_NOT, mode, flags);
|
| - __ CallStub(&stub);
|
| - __ bind(&done);
|
| - context()->Plug(eax);
|
| + case Token::BIT_NOT:
|
| + EmitUnaryOperation(expr, "[ UnaryOperation (BIT_NOT)");
|
| break;
|
| - }
|
|
|
| default:
|
| UNREACHABLE();
|
| @@ -3774,6 +3739,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);
|
| + // TypeRecordingUnaryOpStub expects the argument to be in the
|
| + // accumulator register eax.
|
| + VisitForAccumulatorValue(expr->expression());
|
| + __ CallStub(&stub);
|
| + context()->Plug(eax);
|
| +}
|
| +
|
| +
|
| void FullCodeGenerator::VisitCountOperation(CountOperation* expr) {
|
| Comment cmnt(masm_, "[ CountOperation");
|
| SetSourcePosition(expr->position());
|
|
|