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 3729 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3740 context()->Plug(eax); | 3740 context()->Plug(eax); |
3741 break; | 3741 break; |
3742 } | 3742 } |
3743 | 3743 |
3744 case Token::ADD: { | 3744 case Token::ADD: { |
3745 Comment cmt(masm_, "[ UnaryOperation (ADD)"); | 3745 Comment cmt(masm_, "[ UnaryOperation (ADD)"); |
3746 VisitForAccumulatorValue(expr->expression()); | 3746 VisitForAccumulatorValue(expr->expression()); |
3747 Label no_conversion; | 3747 Label no_conversion; |
3748 __ test(result_register(), Immediate(kSmiTagMask)); | 3748 __ test(result_register(), Immediate(kSmiTagMask)); |
3749 __ j(zero, &no_conversion); | 3749 __ j(zero, &no_conversion); |
3750 __ push(result_register()); | 3750 ToNumberStub convert_stub; |
3751 __ InvokeBuiltin(Builtins::TO_NUMBER, CALL_FUNCTION); | 3751 __ CallStub(&convert_stub); |
3752 __ bind(&no_conversion); | 3752 __ bind(&no_conversion); |
3753 context()->Plug(result_register()); | 3753 context()->Plug(result_register()); |
3754 break; | 3754 break; |
3755 } | 3755 } |
3756 | 3756 |
3757 case Token::SUB: { | 3757 case Token::SUB: { |
3758 Comment cmt(masm_, "[ UnaryOperation (SUB)"); | 3758 Comment cmt(masm_, "[ UnaryOperation (SUB)"); |
3759 bool can_overwrite = expr->expression()->ResultOverwriteAllowed(); | 3759 bool can_overwrite = expr->expression()->ResultOverwriteAllowed(); |
3760 UnaryOverwriteMode overwrite = | 3760 UnaryOverwriteMode overwrite = |
3761 can_overwrite ? UNARY_OVERWRITE : UNARY_NO_OVERWRITE; | 3761 can_overwrite ? UNARY_OVERWRITE : UNARY_NO_OVERWRITE; |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3861 // We need a second deoptimization point after loading the value | 3861 // We need a second deoptimization point after loading the value |
3862 // in case evaluating the property load my have a side effect. | 3862 // in case evaluating the property load my have a side effect. |
3863 PrepareForBailout(expr->increment(), TOS_REG); | 3863 PrepareForBailout(expr->increment(), TOS_REG); |
3864 | 3864 |
3865 // Call ToNumber only if operand is not a smi. | 3865 // Call ToNumber only if operand is not a smi. |
3866 NearLabel no_conversion; | 3866 NearLabel no_conversion; |
3867 if (ShouldInlineSmiCase(expr->op())) { | 3867 if (ShouldInlineSmiCase(expr->op())) { |
3868 __ test(eax, Immediate(kSmiTagMask)); | 3868 __ test(eax, Immediate(kSmiTagMask)); |
3869 __ j(zero, &no_conversion); | 3869 __ j(zero, &no_conversion); |
3870 } | 3870 } |
3871 __ push(eax); | 3871 ToNumberStub convert_stub; |
3872 __ InvokeBuiltin(Builtins::TO_NUMBER, CALL_FUNCTION); | 3872 __ CallStub(&convert_stub); |
3873 __ bind(&no_conversion); | 3873 __ bind(&no_conversion); |
3874 | 3874 |
3875 // Save result for postfix expressions. | 3875 // Save result for postfix expressions. |
3876 if (expr->is_postfix()) { | 3876 if (expr->is_postfix()) { |
3877 if (!context()->IsEffect()) { | 3877 if (!context()->IsEffect()) { |
3878 // Save the result on the stack. If we have a named or keyed property | 3878 // Save the result on the stack. If we have a named or keyed property |
3879 // we store the result under the receiver that is currently on top | 3879 // we store the result under the receiver that is currently on top |
3880 // of the stack. | 3880 // of the stack. |
3881 switch (assign_type) { | 3881 switch (assign_type) { |
3882 case VARIABLE: | 3882 case VARIABLE: |
(...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4366 // And return. | 4366 // And return. |
4367 __ ret(0); | 4367 __ ret(0); |
4368 } | 4368 } |
4369 | 4369 |
4370 | 4370 |
4371 #undef __ | 4371 #undef __ |
4372 | 4372 |
4373 } } // namespace v8::internal | 4373 } } // namespace v8::internal |
4374 | 4374 |
4375 #endif // V8_TARGET_ARCH_IA32 | 4375 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |