OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 2795 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2806 __ j(zero, &no_conversion); | 2806 __ j(zero, &no_conversion); |
2807 __ push(result_register()); | 2807 __ push(result_register()); |
2808 __ InvokeBuiltin(Builtins::TO_NUMBER, CALL_FUNCTION); | 2808 __ InvokeBuiltin(Builtins::TO_NUMBER, CALL_FUNCTION); |
2809 __ bind(&no_conversion); | 2809 __ bind(&no_conversion); |
2810 Apply(context_, result_register()); | 2810 Apply(context_, result_register()); |
2811 break; | 2811 break; |
2812 } | 2812 } |
2813 | 2813 |
2814 case Token::SUB: { | 2814 case Token::SUB: { |
2815 Comment cmt(masm_, "[ UnaryOperation (SUB)"); | 2815 Comment cmt(masm_, "[ UnaryOperation (SUB)"); |
2816 bool overwrite = | 2816 bool can_overwrite = |
2817 (expr->expression()->AsBinaryOperation() != NULL && | 2817 (expr->expression()->AsBinaryOperation() != NULL && |
2818 expr->expression()->AsBinaryOperation()->ResultOverwriteAllowed()); | 2818 expr->expression()->AsBinaryOperation()->ResultOverwriteAllowed()); |
| 2819 UnaryOverwriteMode overwrite = |
| 2820 can_overwrite ? UNARY_OVERWRITE : UNARY_NO_OVERWRITE; |
2819 GenericUnaryOpStub stub(Token::SUB, overwrite); | 2821 GenericUnaryOpStub stub(Token::SUB, overwrite); |
2820 // GenericUnaryOpStub expects the argument to be in the | 2822 // GenericUnaryOpStub expects the argument to be in the |
2821 // accumulator register eax. | 2823 // accumulator register eax. |
2822 VisitForValue(expr->expression(), kAccumulator); | 2824 VisitForValue(expr->expression(), kAccumulator); |
2823 __ CallStub(&stub); | 2825 __ CallStub(&stub); |
2824 Apply(context_, eax); | 2826 Apply(context_, eax); |
2825 break; | 2827 break; |
2826 } | 2828 } |
2827 | 2829 |
2828 case Token::BIT_NOT: { | 2830 case Token::BIT_NOT: { |
2829 Comment cmt(masm_, "[ UnaryOperation (BIT_NOT)"); | 2831 Comment cmt(masm_, "[ UnaryOperation (BIT_NOT)"); |
2830 bool overwrite = | 2832 bool can_overwrite = |
2831 (expr->expression()->AsBinaryOperation() != NULL && | 2833 (expr->expression()->AsBinaryOperation() != NULL && |
2832 expr->expression()->AsBinaryOperation()->ResultOverwriteAllowed()); | 2834 expr->expression()->AsBinaryOperation()->ResultOverwriteAllowed()); |
| 2835 UnaryOverwriteMode overwrite = |
| 2836 can_overwrite ? UNARY_OVERWRITE : UNARY_NO_OVERWRITE; |
2833 GenericUnaryOpStub stub(Token::BIT_NOT, overwrite); | 2837 GenericUnaryOpStub stub(Token::BIT_NOT, overwrite); |
2834 // GenericUnaryOpStub expects the argument to be in the | 2838 // GenericUnaryOpStub expects the argument to be in the |
2835 // accumulator register eax. | 2839 // accumulator register eax. |
2836 VisitForValue(expr->expression(), kAccumulator); | 2840 VisitForValue(expr->expression(), kAccumulator); |
2837 // Avoid calling the stub for Smis. | 2841 // Avoid calling the stub for Smis. |
2838 Label smi, done; | 2842 Label smi, done; |
2839 __ test(result_register(), Immediate(kSmiTagMask)); | 2843 __ test(result_register(), Immediate(kSmiTagMask)); |
2840 __ j(zero, &smi); | 2844 __ j(zero, &smi); |
2841 // Non-smi: call stub leaving result in accumulator register. | 2845 // Non-smi: call stub leaving result in accumulator register. |
2842 __ CallStub(&stub); | 2846 __ CallStub(&stub); |
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3251 // And return. | 3255 // And return. |
3252 __ ret(0); | 3256 __ ret(0); |
3253 } | 3257 } |
3254 | 3258 |
3255 | 3259 |
3256 #undef __ | 3260 #undef __ |
3257 | 3261 |
3258 } } // namespace v8::internal | 3262 } } // namespace v8::internal |
3259 | 3263 |
3260 #endif // V8_TARGET_ARCH_IA32 | 3264 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |