Chromium Code Reviews| Index: src/ia32/full-codegen-ia32.cc |
| =================================================================== |
| --- src/ia32/full-codegen-ia32.cc (revision 7676) |
| +++ 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... |
|
fschneider
2011/04/26 13:32:52
It's a little complicated to do, since format stri
Sven Panne
2011/04/27 00:45:54
I thought about using something like vsnprintf in
fschneider
2011/04/27 11:34:36
As Kevin said, we do something similar in Cranksha
Sven Panne
2011/04/27 17:19:31
OK, I'll have a look, especially if the change is
|
| + 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()); |
|
fschneider
2011/04/26 13:32:52
You need to call here:
SetSourcePosition(expr->po
Sven Panne
2011/04/27 00:45:54
Done, for x64 and ARM, too.
Why is Expression::po
fschneider
2011/04/27 11:34:36
I agree that it would be a good idea to make it ab
Sven Panne
2011/04/27 17:19:31
I'll investigate this later, and I wanted to do th
|
| + __ CallStub(&stub); |
|
fschneider
2011/04/26 13:32:52
You should use here:
EmitCallIC(stub.GetCode(), N
Sven Panne
2011/04/27 00:45:54
I have to admit that I still don't understand this
fschneider
2011/04/27 11:34:36
Have a look at uses of JumpPatchSite for BinaryOpe
Sven Panne
2011/04/27 17:19:31
OK, I'll keep this in mind...
|
| + context()->Plug(eax); |
| +} |
| + |
| + |
| void FullCodeGenerator::VisitCountOperation(CountOperation* expr) { |
| Comment cmnt(masm_, "[ CountOperation"); |
| SetSourcePosition(expr->position()); |