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 1650 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1661 // rcx to make the shifts easier. | 1661 // rcx to make the shifts easier. |
1662 Label done, stub_call, smi_case; | 1662 Label done, stub_call, smi_case; |
1663 __ pop(rdx); | 1663 __ pop(rdx); |
1664 __ movq(rcx, rax); | 1664 __ movq(rcx, rax); |
1665 __ or_(rax, rdx); | 1665 __ or_(rax, rdx); |
1666 JumpPatchSite patch_site(masm_); | 1666 JumpPatchSite patch_site(masm_); |
1667 patch_site.EmitJumpIfSmi(rax, &smi_case, Label::kNear); | 1667 patch_site.EmitJumpIfSmi(rax, &smi_case, Label::kNear); |
1668 | 1668 |
1669 __ bind(&stub_call); | 1669 __ bind(&stub_call); |
1670 __ movq(rax, rcx); | 1670 __ movq(rax, rcx); |
1671 TypeRecordingBinaryOpStub stub(op, mode); | 1671 BinaryOpStub stub(op, mode); |
1672 EmitCallIC(stub.GetCode(), &patch_site, expr->id()); | 1672 EmitCallIC(stub.GetCode(), &patch_site, expr->id()); |
1673 __ jmp(&done, Label::kNear); | 1673 __ jmp(&done, Label::kNear); |
1674 | 1674 |
1675 __ bind(&smi_case); | 1675 __ bind(&smi_case); |
1676 switch (op) { | 1676 switch (op) { |
1677 case Token::SAR: | 1677 case Token::SAR: |
1678 __ SmiShiftArithmeticRight(rax, rdx, rcx); | 1678 __ SmiShiftArithmeticRight(rax, rdx, rcx); |
1679 break; | 1679 break; |
1680 case Token::SHL: | 1680 case Token::SHL: |
1681 __ SmiShiftLeft(rax, rdx, rcx); | 1681 __ SmiShiftLeft(rax, rdx, rcx); |
(...skipping 26 matching lines...) Expand all Loading... |
1708 | 1708 |
1709 __ bind(&done); | 1709 __ bind(&done); |
1710 context()->Plug(rax); | 1710 context()->Plug(rax); |
1711 } | 1711 } |
1712 | 1712 |
1713 | 1713 |
1714 void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr, | 1714 void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr, |
1715 Token::Value op, | 1715 Token::Value op, |
1716 OverwriteMode mode) { | 1716 OverwriteMode mode) { |
1717 __ pop(rdx); | 1717 __ pop(rdx); |
1718 TypeRecordingBinaryOpStub stub(op, mode); | 1718 BinaryOpStub stub(op, mode); |
1719 // NULL signals no inlined smi code. | 1719 // NULL signals no inlined smi code. |
1720 EmitCallIC(stub.GetCode(), NULL, expr->id()); | 1720 EmitCallIC(stub.GetCode(), NULL, expr->id()); |
1721 context()->Plug(rax); | 1721 context()->Plug(rax); |
1722 } | 1722 } |
1723 | 1723 |
1724 | 1724 |
1725 void FullCodeGenerator::EmitAssignment(Expression* expr, int bailout_ast_id) { | 1725 void FullCodeGenerator::EmitAssignment(Expression* expr, int bailout_ast_id) { |
1726 // Invalid left-hand sides are rewritten to have a 'throw | 1726 // Invalid left-hand sides are rewritten to have a 'throw |
1727 // ReferenceError' on the left-hand side. | 1727 // ReferenceError' on the left-hand side. |
1728 if (!expr->IsValidLeftHandSide()) { | 1728 if (!expr->IsValidLeftHandSide()) { |
(...skipping 1987 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3716 } | 3716 } |
3717 | 3717 |
3718 | 3718 |
3719 void FullCodeGenerator::EmitUnaryOperation(UnaryOperation* expr, | 3719 void FullCodeGenerator::EmitUnaryOperation(UnaryOperation* expr, |
3720 const char* comment) { | 3720 const char* comment) { |
3721 // TODO(svenpanne): Allowing format strings in Comment would be nice here... | 3721 // TODO(svenpanne): Allowing format strings in Comment would be nice here... |
3722 Comment cmt(masm_, comment); | 3722 Comment cmt(masm_, comment); |
3723 bool can_overwrite = expr->expression()->ResultOverwriteAllowed(); | 3723 bool can_overwrite = expr->expression()->ResultOverwriteAllowed(); |
3724 UnaryOverwriteMode overwrite = | 3724 UnaryOverwriteMode overwrite = |
3725 can_overwrite ? UNARY_OVERWRITE : UNARY_NO_OVERWRITE; | 3725 can_overwrite ? UNARY_OVERWRITE : UNARY_NO_OVERWRITE; |
3726 TypeRecordingUnaryOpStub stub(expr->op(), overwrite); | 3726 UnaryOpStub stub(expr->op(), overwrite); |
3727 // TypeRecordingUnaryOpStub expects the argument to be in the | 3727 // UnaryOpStub expects the argument to be in the |
3728 // accumulator register rax. | 3728 // accumulator register rax. |
3729 VisitForAccumulatorValue(expr->expression()); | 3729 VisitForAccumulatorValue(expr->expression()); |
3730 SetSourcePosition(expr->position()); | 3730 SetSourcePosition(expr->position()); |
3731 EmitCallIC(stub.GetCode(), NULL, expr->id()); | 3731 EmitCallIC(stub.GetCode(), NULL, expr->id()); |
3732 context()->Plug(rax); | 3732 context()->Plug(rax); |
3733 } | 3733 } |
3734 | 3734 |
3735 | 3735 |
3736 void FullCodeGenerator::VisitCountOperation(CountOperation* expr) { | 3736 void FullCodeGenerator::VisitCountOperation(CountOperation* expr) { |
3737 Comment cmnt(masm_, "[ CountOperation"); | 3737 Comment cmnt(masm_, "[ CountOperation"); |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3845 __ SmiSubConstant(rax, rax, Smi::FromInt(1)); | 3845 __ SmiSubConstant(rax, rax, Smi::FromInt(1)); |
3846 } else { | 3846 } else { |
3847 __ SmiAddConstant(rax, rax, Smi::FromInt(1)); | 3847 __ SmiAddConstant(rax, rax, Smi::FromInt(1)); |
3848 } | 3848 } |
3849 } | 3849 } |
3850 | 3850 |
3851 // Record position before stub call. | 3851 // Record position before stub call. |
3852 SetSourcePosition(expr->position()); | 3852 SetSourcePosition(expr->position()); |
3853 | 3853 |
3854 // Call stub for +1/-1. | 3854 // Call stub for +1/-1. |
3855 TypeRecordingBinaryOpStub stub(expr->binary_op(), NO_OVERWRITE); | 3855 BinaryOpStub stub(expr->binary_op(), NO_OVERWRITE); |
3856 if (expr->op() == Token::INC) { | 3856 if (expr->op() == Token::INC) { |
3857 __ Move(rdx, Smi::FromInt(1)); | 3857 __ Move(rdx, Smi::FromInt(1)); |
3858 } else { | 3858 } else { |
3859 __ movq(rdx, rax); | 3859 __ movq(rdx, rax); |
3860 __ Move(rax, Smi::FromInt(1)); | 3860 __ Move(rax, Smi::FromInt(1)); |
3861 } | 3861 } |
3862 EmitCallIC(stub.GetCode(), &patch_site, expr->CountId()); | 3862 EmitCallIC(stub.GetCode(), &patch_site, expr->CountId()); |
3863 __ bind(&done); | 3863 __ bind(&done); |
3864 | 3864 |
3865 // Store the value returned in rax. | 3865 // Store the value returned in rax. |
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4291 __ ret(0); | 4291 __ ret(0); |
4292 } | 4292 } |
4293 | 4293 |
4294 | 4294 |
4295 #undef __ | 4295 #undef __ |
4296 | 4296 |
4297 | 4297 |
4298 } } // namespace v8::internal | 4298 } } // namespace v8::internal |
4299 | 4299 |
4300 #endif // V8_TARGET_ARCH_X64 | 4300 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |