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 1699 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1710 Register right = r0; | 1710 Register right = r0; |
1711 __ pop(left); | 1711 __ pop(left); |
1712 | 1712 |
1713 // Perform combined smi check on both operands. | 1713 // Perform combined smi check on both operands. |
1714 __ orr(scratch1, left, Operand(right)); | 1714 __ orr(scratch1, left, Operand(right)); |
1715 STATIC_ASSERT(kSmiTag == 0); | 1715 STATIC_ASSERT(kSmiTag == 0); |
1716 JumpPatchSite patch_site(masm_); | 1716 JumpPatchSite patch_site(masm_); |
1717 patch_site.EmitJumpIfSmi(scratch1, &smi_case); | 1717 patch_site.EmitJumpIfSmi(scratch1, &smi_case); |
1718 | 1718 |
1719 __ bind(&stub_call); | 1719 __ bind(&stub_call); |
1720 TypeRecordingBinaryOpStub stub(op, mode); | 1720 BinaryOpStub stub(op, mode); |
1721 EmitCallIC(stub.GetCode(), &patch_site, expr->id()); | 1721 EmitCallIC(stub.GetCode(), &patch_site, expr->id()); |
1722 __ jmp(&done); | 1722 __ jmp(&done); |
1723 | 1723 |
1724 __ bind(&smi_case); | 1724 __ bind(&smi_case); |
1725 // Smi case. This code works the same way as the smi-smi case in the type | 1725 // Smi case. This code works the same way as the smi-smi case in the type |
1726 // recording binary operation stub, see | 1726 // recording binary operation stub, see |
1727 // TypeRecordingBinaryOpStub::GenerateSmiSmiOperation for comments. | 1727 // BinaryOpStub::GenerateSmiSmiOperation for comments. |
1728 switch (op) { | 1728 switch (op) { |
1729 case Token::SAR: | 1729 case Token::SAR: |
1730 __ b(&stub_call); | 1730 __ b(&stub_call); |
1731 __ GetLeastBitsFromSmi(scratch1, right, 5); | 1731 __ GetLeastBitsFromSmi(scratch1, right, 5); |
1732 __ mov(right, Operand(left, ASR, scratch1)); | 1732 __ mov(right, Operand(left, ASR, scratch1)); |
1733 __ bic(right, right, Operand(kSmiTagMask)); | 1733 __ bic(right, right, Operand(kSmiTagMask)); |
1734 break; | 1734 break; |
1735 case Token::SHL: { | 1735 case Token::SHL: { |
1736 __ b(&stub_call); | 1736 __ b(&stub_call); |
1737 __ SmiUntag(scratch1, left); | 1737 __ SmiUntag(scratch1, left); |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1791 | 1791 |
1792 __ bind(&done); | 1792 __ bind(&done); |
1793 context()->Plug(r0); | 1793 context()->Plug(r0); |
1794 } | 1794 } |
1795 | 1795 |
1796 | 1796 |
1797 void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr, | 1797 void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr, |
1798 Token::Value op, | 1798 Token::Value op, |
1799 OverwriteMode mode) { | 1799 OverwriteMode mode) { |
1800 __ pop(r1); | 1800 __ pop(r1); |
1801 TypeRecordingBinaryOpStub stub(op, mode); | 1801 BinaryOpStub stub(op, mode); |
1802 EmitCallIC(stub.GetCode(), NULL, expr->id()); | 1802 EmitCallIC(stub.GetCode(), NULL, expr->id()); |
1803 context()->Plug(r0); | 1803 context()->Plug(r0); |
1804 } | 1804 } |
1805 | 1805 |
1806 | 1806 |
1807 void FullCodeGenerator::EmitAssignment(Expression* expr, int bailout_ast_id) { | 1807 void FullCodeGenerator::EmitAssignment(Expression* expr, int bailout_ast_id) { |
1808 // Invalid left-hand sides are rewritten to have a 'throw | 1808 // Invalid left-hand sides are rewritten to have a 'throw |
1809 // ReferenceError' on the left-hand side. | 1809 // ReferenceError' on the left-hand side. |
1810 if (!expr->IsValidLeftHandSide()) { | 1810 if (!expr->IsValidLeftHandSide()) { |
1811 VisitForEffect(expr); | 1811 VisitForEffect(expr); |
(...skipping 1971 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3783 } | 3783 } |
3784 | 3784 |
3785 | 3785 |
3786 void FullCodeGenerator::EmitUnaryOperation(UnaryOperation* expr, | 3786 void FullCodeGenerator::EmitUnaryOperation(UnaryOperation* expr, |
3787 const char* comment) { | 3787 const char* comment) { |
3788 // TODO(svenpanne): Allowing format strings in Comment would be nice here... | 3788 // TODO(svenpanne): Allowing format strings in Comment would be nice here... |
3789 Comment cmt(masm_, comment); | 3789 Comment cmt(masm_, comment); |
3790 bool can_overwrite = expr->expression()->ResultOverwriteAllowed(); | 3790 bool can_overwrite = expr->expression()->ResultOverwriteAllowed(); |
3791 UnaryOverwriteMode overwrite = | 3791 UnaryOverwriteMode overwrite = |
3792 can_overwrite ? UNARY_OVERWRITE : UNARY_NO_OVERWRITE; | 3792 can_overwrite ? UNARY_OVERWRITE : UNARY_NO_OVERWRITE; |
3793 TypeRecordingUnaryOpStub stub(expr->op(), overwrite); | 3793 UnaryOpStub stub(expr->op(), overwrite); |
3794 // TypeRecordingGenericUnaryOpStub expects the argument to be in the | 3794 // UnaryOpStub expects the argument to be in the |
3795 // accumulator register r0. | 3795 // accumulator register r0. |
3796 VisitForAccumulatorValue(expr->expression()); | 3796 VisitForAccumulatorValue(expr->expression()); |
3797 SetSourcePosition(expr->position()); | 3797 SetSourcePosition(expr->position()); |
3798 EmitCallIC(stub.GetCode(), NULL, expr->id()); | 3798 EmitCallIC(stub.GetCode(), NULL, expr->id()); |
3799 context()->Plug(r0); | 3799 context()->Plug(r0); |
3800 } | 3800 } |
3801 | 3801 |
3802 | 3802 |
3803 void FullCodeGenerator::VisitCountOperation(CountOperation* expr) { | 3803 void FullCodeGenerator::VisitCountOperation(CountOperation* expr) { |
3804 Comment cmnt(masm_, "[ CountOperation"); | 3804 Comment cmnt(masm_, "[ CountOperation"); |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3905 | 3905 |
3906 __ bind(&stub_call); | 3906 __ bind(&stub_call); |
3907 // Call stub. Undo operation first. | 3907 // Call stub. Undo operation first. |
3908 __ sub(r0, r0, Operand(Smi::FromInt(count_value))); | 3908 __ sub(r0, r0, Operand(Smi::FromInt(count_value))); |
3909 } | 3909 } |
3910 __ mov(r1, Operand(Smi::FromInt(count_value))); | 3910 __ mov(r1, Operand(Smi::FromInt(count_value))); |
3911 | 3911 |
3912 // Record position before stub call. | 3912 // Record position before stub call. |
3913 SetSourcePosition(expr->position()); | 3913 SetSourcePosition(expr->position()); |
3914 | 3914 |
3915 TypeRecordingBinaryOpStub stub(Token::ADD, NO_OVERWRITE); | 3915 BinaryOpStub stub(Token::ADD, NO_OVERWRITE); |
3916 EmitCallIC(stub.GetCode(), &patch_site, expr->CountId()); | 3916 EmitCallIC(stub.GetCode(), &patch_site, expr->CountId()); |
3917 __ bind(&done); | 3917 __ bind(&done); |
3918 | 3918 |
3919 // Store the value returned in r0. | 3919 // Store the value returned in r0. |
3920 switch (assign_type) { | 3920 switch (assign_type) { |
3921 case VARIABLE: | 3921 case VARIABLE: |
3922 if (expr->is_postfix()) { | 3922 if (expr->is_postfix()) { |
3923 { EffectContext context(this); | 3923 { EffectContext context(this); |
3924 EmitVariableAssignment(expr->expression()->AsVariableProxy()->var(), | 3924 EmitVariableAssignment(expr->expression()->AsVariableProxy()->var(), |
3925 Token::ASSIGN); | 3925 Token::ASSIGN); |
(...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4354 __ mov(r1, Operand(r1, ASR, 1)); // Un-smi-tag value. | 4354 __ mov(r1, Operand(r1, ASR, 1)); // Un-smi-tag value. |
4355 __ add(pc, r1, Operand(masm_->CodeObject())); | 4355 __ add(pc, r1, Operand(masm_->CodeObject())); |
4356 } | 4356 } |
4357 | 4357 |
4358 | 4358 |
4359 #undef __ | 4359 #undef __ |
4360 | 4360 |
4361 } } // namespace v8::internal | 4361 } } // namespace v8::internal |
4362 | 4362 |
4363 #endif // V8_TARGET_ARCH_ARM | 4363 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |