Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Side by Side Diff: src/arm/full-codegen-arm.cc

Issue 6879081: Added type recording for unary minus and unary bitwise negation. Note that the (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Incorporated Florian's suggested changes Created 9 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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 SetSourcePosition(expr->position());
3803 EmitCallIC(stub.GetCode(), NULL);
3804 context()->Plug(r0);
3805 }
3806
3807
3826 void FullCodeGenerator::VisitCountOperation(CountOperation* expr) { 3808 void FullCodeGenerator::VisitCountOperation(CountOperation* expr) {
3827 Comment cmnt(masm_, "[ CountOperation"); 3809 Comment cmnt(masm_, "[ CountOperation");
3828 SetSourcePosition(expr->position()); 3810 SetSourcePosition(expr->position());
3829 3811
3830 // Invalid left-hand sides are rewritten to have a 'throw ReferenceError' 3812 // Invalid left-hand sides are rewritten to have a 'throw ReferenceError'
3831 // as the left-hand side. 3813 // as the left-hand side.
3832 if (!expr->expression()->IsValidLeftHandSide()) { 3814 if (!expr->expression()->IsValidLeftHandSide()) {
3833 VisitForEffect(expr->expression()); 3815 VisitForEffect(expr->expression());
3834 return; 3816 return;
3835 } 3817 }
(...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after
4361 __ mov(r1, Operand(r1, ASR, 1)); // Un-smi-tag value. 4343 __ mov(r1, Operand(r1, ASR, 1)); // Un-smi-tag value.
4362 __ add(pc, r1, Operand(masm_->CodeObject())); 4344 __ add(pc, r1, Operand(masm_->CodeObject()));
4363 } 4345 }
4364 4346
4365 4347
4366 #undef __ 4348 #undef __
4367 4349
4368 } } // namespace v8::internal 4350 } } // namespace v8::internal
4369 4351
4370 #endif // V8_TARGET_ARCH_ARM 4352 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « src/arm/code-stubs-arm.cc ('k') | src/ast.h » ('j') | src/ia32/full-codegen-ia32.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698