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 1705 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1716 __ pop(left); | 1716 __ pop(left); |
1717 __ mov(a0, result_register()); | 1717 __ mov(a0, result_register()); |
1718 | 1718 |
1719 // Perform combined smi check on both operands. | 1719 // Perform combined smi check on both operands. |
1720 __ Or(scratch1, left, Operand(right)); | 1720 __ Or(scratch1, left, Operand(right)); |
1721 STATIC_ASSERT(kSmiTag == 0); | 1721 STATIC_ASSERT(kSmiTag == 0); |
1722 JumpPatchSite patch_site(masm_); | 1722 JumpPatchSite patch_site(masm_); |
1723 patch_site.EmitJumpIfSmi(scratch1, &smi_case); | 1723 patch_site.EmitJumpIfSmi(scratch1, &smi_case); |
1724 | 1724 |
1725 __ bind(&stub_call); | 1725 __ bind(&stub_call); |
1726 TypeRecordingBinaryOpStub stub(op, mode); | 1726 BinaryOpStub stub(op, mode); |
1727 EmitCallIC(stub.GetCode(), &patch_site, expr->id()); | 1727 EmitCallIC(stub.GetCode(), &patch_site, expr->id()); |
1728 __ jmp(&done); | 1728 __ jmp(&done); |
1729 | 1729 |
1730 __ bind(&smi_case); | 1730 __ bind(&smi_case); |
1731 // Smi case. This code works the same way as the smi-smi case in the type | 1731 // Smi case. This code works the same way as the smi-smi case in the type |
1732 // recording binary operation stub, see | 1732 // recording binary operation stub, see |
1733 // TypeRecordingBinaryOpStub::GenerateSmiSmiOperation for comments. | 1733 // BinaryOpStub::GenerateSmiSmiOperation for comments. |
1734 switch (op) { | 1734 switch (op) { |
1735 case Token::SAR: | 1735 case Token::SAR: |
1736 __ Branch(&stub_call); | 1736 __ Branch(&stub_call); |
1737 __ GetLeastBitsFromSmi(scratch1, right, 5); | 1737 __ GetLeastBitsFromSmi(scratch1, right, 5); |
1738 __ srav(right, left, scratch1); | 1738 __ srav(right, left, scratch1); |
1739 __ And(v0, right, Operand(~kSmiTagMask)); | 1739 __ And(v0, right, Operand(~kSmiTagMask)); |
1740 break; | 1740 break; |
1741 case Token::SHL: { | 1741 case Token::SHL: { |
1742 __ Branch(&stub_call); | 1742 __ Branch(&stub_call); |
1743 __ SmiUntag(scratch1, left); | 1743 __ SmiUntag(scratch1, left); |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1797 __ bind(&done); | 1797 __ bind(&done); |
1798 context()->Plug(v0); | 1798 context()->Plug(v0); |
1799 } | 1799 } |
1800 | 1800 |
1801 | 1801 |
1802 void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr, | 1802 void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr, |
1803 Token::Value op, | 1803 Token::Value op, |
1804 OverwriteMode mode) { | 1804 OverwriteMode mode) { |
1805 __ mov(a0, result_register()); | 1805 __ mov(a0, result_register()); |
1806 __ pop(a1); | 1806 __ pop(a1); |
1807 TypeRecordingBinaryOpStub stub(op, mode); | 1807 BinaryOpStub stub(op, mode); |
1808 EmitCallIC(stub.GetCode(), NULL, expr->id()); | 1808 EmitCallIC(stub.GetCode(), NULL, expr->id()); |
1809 context()->Plug(v0); | 1809 context()->Plug(v0); |
1810 } | 1810 } |
1811 | 1811 |
1812 | 1812 |
1813 void FullCodeGenerator::EmitAssignment(Expression* expr, int bailout_ast_id) { | 1813 void FullCodeGenerator::EmitAssignment(Expression* expr, int bailout_ast_id) { |
1814 // Invalid left-hand sides are rewritten to have a 'throw | 1814 // Invalid left-hand sides are rewritten to have a 'throw |
1815 // ReferenceError' on the left-hand side. | 1815 // ReferenceError' on the left-hand side. |
1816 if (!expr->IsValidLeftHandSide()) { | 1816 if (!expr->IsValidLeftHandSide()) { |
1817 VisitForEffect(expr); | 1817 VisitForEffect(expr); |
(...skipping 1982 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3800 } | 3800 } |
3801 | 3801 |
3802 | 3802 |
3803 void FullCodeGenerator::EmitUnaryOperation(UnaryOperation* expr, | 3803 void FullCodeGenerator::EmitUnaryOperation(UnaryOperation* expr, |
3804 const char* comment) { | 3804 const char* comment) { |
3805 // TODO(svenpanne): Allowing format strings in Comment would be nice here... | 3805 // TODO(svenpanne): Allowing format strings in Comment would be nice here... |
3806 Comment cmt(masm_, comment); | 3806 Comment cmt(masm_, comment); |
3807 bool can_overwrite = expr->expression()->ResultOverwriteAllowed(); | 3807 bool can_overwrite = expr->expression()->ResultOverwriteAllowed(); |
3808 UnaryOverwriteMode overwrite = | 3808 UnaryOverwriteMode overwrite = |
3809 can_overwrite ? UNARY_OVERWRITE : UNARY_NO_OVERWRITE; | 3809 can_overwrite ? UNARY_OVERWRITE : UNARY_NO_OVERWRITE; |
3810 TypeRecordingUnaryOpStub stub(expr->op(), overwrite); | 3810 UnaryOpStub stub(expr->op(), overwrite); |
3811 // TypeRecordingGenericUnaryOpStub expects the argument to be in a0. | 3811 // GenericUnaryOpStub expects the argument to be in a0. |
3812 VisitForAccumulatorValue(expr->expression()); | 3812 VisitForAccumulatorValue(expr->expression()); |
3813 SetSourcePosition(expr->position()); | 3813 SetSourcePosition(expr->position()); |
3814 __ mov(a0, result_register()); | 3814 __ mov(a0, result_register()); |
3815 EmitCallIC(stub.GetCode(), NULL, expr->id()); | 3815 EmitCallIC(stub.GetCode(), NULL, expr->id()); |
3816 context()->Plug(v0); | 3816 context()->Plug(v0); |
3817 } | 3817 } |
3818 | 3818 |
3819 | 3819 |
3820 void FullCodeGenerator::VisitCountOperation(CountOperation* expr) { | 3820 void FullCodeGenerator::VisitCountOperation(CountOperation* expr) { |
3821 Comment cmnt(masm_, "[ CountOperation"); | 3821 Comment cmnt(masm_, "[ CountOperation"); |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3922 | 3922 |
3923 // We could eliminate this smi check if we split the code at | 3923 // We could eliminate this smi check if we split the code at |
3924 // the first smi check before calling ToNumber. | 3924 // the first smi check before calling ToNumber. |
3925 patch_site.EmitJumpIfSmi(v0, &done); | 3925 patch_site.EmitJumpIfSmi(v0, &done); |
3926 __ bind(&stub_call); | 3926 __ bind(&stub_call); |
3927 } | 3927 } |
3928 | 3928 |
3929 // Record position before stub call. | 3929 // Record position before stub call. |
3930 SetSourcePosition(expr->position()); | 3930 SetSourcePosition(expr->position()); |
3931 | 3931 |
3932 TypeRecordingBinaryOpStub stub(Token::ADD, NO_OVERWRITE); | 3932 BinaryOpStub stub(Token::ADD, NO_OVERWRITE); |
3933 EmitCallIC(stub.GetCode(), &patch_site, expr->CountId()); | 3933 EmitCallIC(stub.GetCode(), &patch_site, expr->CountId()); |
3934 __ bind(&done); | 3934 __ bind(&done); |
3935 | 3935 |
3936 // Store the value returned in v0. | 3936 // Store the value returned in v0. |
3937 switch (assign_type) { | 3937 switch (assign_type) { |
3938 case VARIABLE: | 3938 case VARIABLE: |
3939 if (expr->is_postfix()) { | 3939 if (expr->is_postfix()) { |
3940 { EffectContext context(this); | 3940 { EffectContext context(this); |
3941 EmitVariableAssignment(expr->expression()->AsVariableProxy()->var(), | 3941 EmitVariableAssignment(expr->expression()->AsVariableProxy()->var(), |
3942 Token::ASSIGN); | 3942 Token::ASSIGN); |
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4368 __ Addu(at, a1, Operand(masm_->CodeObject())); | 4368 __ Addu(at, a1, Operand(masm_->CodeObject())); |
4369 __ Jump(at); | 4369 __ Jump(at); |
4370 } | 4370 } |
4371 | 4371 |
4372 | 4372 |
4373 #undef __ | 4373 #undef __ |
4374 | 4374 |
4375 } } // namespace v8::internal | 4375 } } // namespace v8::internal |
4376 | 4376 |
4377 #endif // V8_TARGET_ARCH_MIPS | 4377 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |