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 2789 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2800 __ j(is_smi, &no_conversion); | 2800 __ j(is_smi, &no_conversion); |
2801 __ push(result_register()); | 2801 __ push(result_register()); |
2802 __ InvokeBuiltin(Builtins::TO_NUMBER, CALL_FUNCTION); | 2802 __ InvokeBuiltin(Builtins::TO_NUMBER, CALL_FUNCTION); |
2803 __ bind(&no_conversion); | 2803 __ bind(&no_conversion); |
2804 Apply(context_, result_register()); | 2804 Apply(context_, result_register()); |
2805 break; | 2805 break; |
2806 } | 2806 } |
2807 | 2807 |
2808 case Token::SUB: { | 2808 case Token::SUB: { |
2809 Comment cmt(masm_, "[ UnaryOperation (SUB)"); | 2809 Comment cmt(masm_, "[ UnaryOperation (SUB)"); |
2810 bool overwrite = | 2810 bool can_overwrite = |
2811 (expr->expression()->AsBinaryOperation() != NULL && | 2811 (expr->expression()->AsBinaryOperation() != NULL && |
2812 expr->expression()->AsBinaryOperation()->ResultOverwriteAllowed()); | 2812 expr->expression()->AsBinaryOperation()->ResultOverwriteAllowed()); |
| 2813 UnaryOverwriteMode overwrite = |
| 2814 can_overwrite ? UNARY_OVERWRITE : UNARY_NO_OVERWRITE; |
2813 GenericUnaryOpStub stub(Token::SUB, overwrite); | 2815 GenericUnaryOpStub stub(Token::SUB, overwrite); |
2814 // GenericUnaryOpStub expects the argument to be in the | 2816 // GenericUnaryOpStub expects the argument to be in the |
2815 // accumulator register rax. | 2817 // accumulator register rax. |
2816 VisitForValue(expr->expression(), kAccumulator); | 2818 VisitForValue(expr->expression(), kAccumulator); |
2817 __ CallStub(&stub); | 2819 __ CallStub(&stub); |
2818 Apply(context_, rax); | 2820 Apply(context_, rax); |
2819 break; | 2821 break; |
2820 } | 2822 } |
2821 | 2823 |
2822 case Token::BIT_NOT: { | 2824 case Token::BIT_NOT: { |
2823 Comment cmt(masm_, "[ UnaryOperation (BIT_NOT)"); | 2825 Comment cmt(masm_, "[ UnaryOperation (BIT_NOT)"); |
2824 bool overwrite = | 2826 bool can_overwrite = |
2825 (expr->expression()->AsBinaryOperation() != NULL && | 2827 (expr->expression()->AsBinaryOperation() != NULL && |
2826 expr->expression()->AsBinaryOperation()->ResultOverwriteAllowed()); | 2828 expr->expression()->AsBinaryOperation()->ResultOverwriteAllowed()); |
| 2829 UnaryOverwriteMode overwrite = |
| 2830 can_overwrite ? UNARY_OVERWRITE : UNARY_NO_OVERWRITE; |
2827 GenericUnaryOpStub stub(Token::BIT_NOT, overwrite); | 2831 GenericUnaryOpStub stub(Token::BIT_NOT, overwrite); |
2828 // GenericUnaryOpStub expects the argument to be in the | 2832 // GenericUnaryOpStub expects the argument to be in the |
2829 // accumulator register rax. | 2833 // accumulator register rax. |
2830 VisitForValue(expr->expression(), kAccumulator); | 2834 VisitForValue(expr->expression(), kAccumulator); |
2831 // Avoid calling the stub for Smis. | 2835 // Avoid calling the stub for Smis. |
2832 Label smi, done; | 2836 Label smi, done; |
2833 Condition is_smi = masm_->CheckSmi(result_register()); | 2837 Condition is_smi = masm_->CheckSmi(result_register()); |
2834 __ j(is_smi, &smi); | 2838 __ j(is_smi, &smi); |
2835 // Non-smi: call stub leaving result in accumulator register. | 2839 // Non-smi: call stub leaving result in accumulator register. |
2836 __ CallStub(&stub); | 2840 __ CallStub(&stub); |
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3241 __ ret(0); | 3245 __ ret(0); |
3242 } | 3246 } |
3243 | 3247 |
3244 | 3248 |
3245 #undef __ | 3249 #undef __ |
3246 | 3250 |
3247 | 3251 |
3248 } } // namespace v8::internal | 3252 } } // namespace v8::internal |
3249 | 3253 |
3250 #endif // V8_TARGET_ARCH_X64 | 3254 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |