| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 3756 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3767 Label no_conversion; | 3767 Label no_conversion; |
| 3768 __ tst(result_register(), Operand(kSmiTagMask)); | 3768 __ tst(result_register(), Operand(kSmiTagMask)); |
| 3769 __ b(eq, &no_conversion); | 3769 __ b(eq, &no_conversion); |
| 3770 ToNumberStub convert_stub; | 3770 ToNumberStub convert_stub; |
| 3771 __ CallStub(&convert_stub); | 3771 __ CallStub(&convert_stub); |
| 3772 __ bind(&no_conversion); | 3772 __ bind(&no_conversion); |
| 3773 context()->Plug(result_register()); | 3773 context()->Plug(result_register()); |
| 3774 break; | 3774 break; |
| 3775 } | 3775 } |
| 3776 | 3776 |
| 3777 case Token::SUB: { | 3777 case Token::SUB: |
| 3778 Comment cmt(masm_, "[ UnaryOperation (SUB)"); | 3778 EmitUnaryOperation(expr, "[ UnaryOperation (SUB)"); |
| 3779 bool can_overwrite = expr->expression()->ResultOverwriteAllowed(); | |
| 3780 UnaryOverwriteMode overwrite = | |
| 3781 can_overwrite ? UNARY_OVERWRITE : UNARY_NO_OVERWRITE; | |
| 3782 GenericUnaryOpStub stub(Token::SUB, overwrite, NO_UNARY_FLAGS); | |
| 3783 // GenericUnaryOpStub expects the argument to be in the | |
| 3784 // accumulator register r0. | |
| 3785 VisitForAccumulatorValue(expr->expression()); | |
| 3786 __ CallStub(&stub); | |
| 3787 context()->Plug(r0); | |
| 3788 break; | 3779 break; |
| 3789 } | |
| 3790 | 3780 |
| 3791 case Token::BIT_NOT: { | 3781 case Token::BIT_NOT: |
| 3792 Comment cmt(masm_, "[ UnaryOperation (BIT_NOT)"); | 3782 EmitUnaryOperation(expr, "[ UnaryOperation (BIT_NOT)"); |
| 3793 // The generic unary operation stub expects the argument to be | |
| 3794 // in the accumulator register r0. | |
| 3795 VisitForAccumulatorValue(expr->expression()); | |
| 3796 Label done; | |
| 3797 bool inline_smi_code = ShouldInlineSmiCase(expr->op()); | |
| 3798 if (inline_smi_code) { | |
| 3799 Label call_stub; | |
| 3800 __ JumpIfNotSmi(r0, &call_stub); | |
| 3801 __ mvn(r0, Operand(r0)); | |
| 3802 // Bit-clear inverted smi-tag. | |
| 3803 __ bic(r0, r0, Operand(kSmiTagMask)); | |
| 3804 __ b(&done); | |
| 3805 __ bind(&call_stub); | |
| 3806 } | |
| 3807 bool overwrite = expr->expression()->ResultOverwriteAllowed(); | |
| 3808 UnaryOpFlags flags = inline_smi_code | |
| 3809 ? NO_UNARY_SMI_CODE_IN_STUB | |
| 3810 : NO_UNARY_FLAGS; | |
| 3811 UnaryOverwriteMode mode = | |
| 3812 overwrite ? UNARY_OVERWRITE : UNARY_NO_OVERWRITE; | |
| 3813 GenericUnaryOpStub stub(Token::BIT_NOT, mode, flags); | |
| 3814 __ CallStub(&stub); | |
| 3815 __ bind(&done); | |
| 3816 context()->Plug(r0); | |
| 3817 break; | 3783 break; |
| 3818 } | |
| 3819 | 3784 |
| 3820 default: | 3785 default: |
| 3821 UNREACHABLE(); | 3786 UNREACHABLE(); |
| 3822 } | 3787 } |
| 3823 } | 3788 } |
| 3824 | 3789 |
| 3825 | 3790 |
| 3791 void FullCodeGenerator::EmitUnaryOperation(UnaryOperation* expr, |
| 3792 const char* comment) { |
| 3793 // TODO(svenpanne): Allowing format strings in Comment would be nice here... |
| 3794 Comment cmt(masm_, comment); |
| 3795 bool can_overwrite = expr->expression()->ResultOverwriteAllowed(); |
| 3796 UnaryOverwriteMode overwrite = |
| 3797 can_overwrite ? UNARY_OVERWRITE : UNARY_NO_OVERWRITE; |
| 3798 TypeRecordingUnaryOpStub stub(expr->op(), overwrite); |
| 3799 // TypeRecordingGenericUnaryOpStub expects the argument to be in the |
| 3800 // accumulator register r0. |
| 3801 VisitForAccumulatorValue(expr->expression()); |
| 3802 __ CallStub(&stub); |
| 3803 context()->Plug(r0); |
| 3804 } |
| 3805 |
| 3806 |
| 3826 void FullCodeGenerator::VisitCountOperation(CountOperation* expr) { | 3807 void FullCodeGenerator::VisitCountOperation(CountOperation* expr) { |
| 3827 Comment cmnt(masm_, "[ CountOperation"); | 3808 Comment cmnt(masm_, "[ CountOperation"); |
| 3828 SetSourcePosition(expr->position()); | 3809 SetSourcePosition(expr->position()); |
| 3829 | 3810 |
| 3830 // Invalid left-hand sides are rewritten to have a 'throw ReferenceError' | 3811 // Invalid left-hand sides are rewritten to have a 'throw ReferenceError' |
| 3831 // as the left-hand side. | 3812 // as the left-hand side. |
| 3832 if (!expr->expression()->IsValidLeftHandSide()) { | 3813 if (!expr->expression()->IsValidLeftHandSide()) { |
| 3833 VisitForEffect(expr->expression()); | 3814 VisitForEffect(expr->expression()); |
| 3834 return; | 3815 return; |
| 3835 } | 3816 } |
| (...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4361 __ mov(r1, Operand(r1, ASR, 1)); // Un-smi-tag value. | 4342 __ mov(r1, Operand(r1, ASR, 1)); // Un-smi-tag value. |
| 4362 __ add(pc, r1, Operand(masm_->CodeObject())); | 4343 __ add(pc, r1, Operand(masm_->CodeObject())); |
| 4363 } | 4344 } |
| 4364 | 4345 |
| 4365 | 4346 |
| 4366 #undef __ | 4347 #undef __ |
| 4367 | 4348 |
| 4368 } } // namespace v8::internal | 4349 } } // namespace v8::internal |
| 4369 | 4350 |
| 4370 #endif // V8_TARGET_ARCH_ARM | 4351 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |