| 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 1542 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1553 Expression* right, | 1553 Expression* right, |
| 1554 ConstantOperand constant) { | 1554 ConstantOperand constant) { |
| 1555 ASSERT(constant == kNoConstants); // Only handled case. | 1555 ASSERT(constant == kNoConstants); // Only handled case. |
| 1556 EmitBinaryOp(op, mode); | 1556 EmitBinaryOp(op, mode); |
| 1557 } | 1557 } |
| 1558 | 1558 |
| 1559 | 1559 |
| 1560 void FullCodeGenerator::EmitBinaryOp(Token::Value op, | 1560 void FullCodeGenerator::EmitBinaryOp(Token::Value op, |
| 1561 OverwriteMode mode) { | 1561 OverwriteMode mode) { |
| 1562 __ pop(r1); | 1562 __ pop(r1); |
| 1563 if (op == Token::ADD || op == Token::SUB) { | 1563 if (op == Token::ADD || |
| 1564 op == Token::SUB || |
| 1565 op == Token::MUL || |
| 1566 op == Token::DIV || |
| 1567 op == Token::MOD) { |
| 1564 TypeRecordingBinaryOpStub stub(op, mode); | 1568 TypeRecordingBinaryOpStub stub(op, mode); |
| 1565 __ CallStub(&stub); | 1569 __ CallStub(&stub); |
| 1566 } else { | 1570 } else { |
| 1567 GenericBinaryOpStub stub(op, mode, r1, r0); | 1571 GenericBinaryOpStub stub(op, mode, r1, r0); |
| 1568 __ CallStub(&stub); | 1572 __ CallStub(&stub); |
| 1569 } | 1573 } |
| 1570 context()->Plug(r0); | 1574 context()->Plug(r0); |
| 1571 } | 1575 } |
| 1572 | 1576 |
| 1573 | 1577 |
| (...skipping 1496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3070 context()->Plug(r0); | 3074 context()->Plug(r0); |
| 3071 break; | 3075 break; |
| 3072 } | 3076 } |
| 3073 | 3077 |
| 3074 case Token::ADD: { | 3078 case Token::ADD: { |
| 3075 Comment cmt(masm_, "[ UnaryOperation (ADD)"); | 3079 Comment cmt(masm_, "[ UnaryOperation (ADD)"); |
| 3076 VisitForAccumulatorValue(expr->expression()); | 3080 VisitForAccumulatorValue(expr->expression()); |
| 3077 Label no_conversion; | 3081 Label no_conversion; |
| 3078 __ tst(result_register(), Operand(kSmiTagMask)); | 3082 __ tst(result_register(), Operand(kSmiTagMask)); |
| 3079 __ b(eq, &no_conversion); | 3083 __ b(eq, &no_conversion); |
| 3080 __ push(r0); | 3084 ToNumberStub convert_stub; |
| 3081 __ InvokeBuiltin(Builtins::TO_NUMBER, CALL_JS); | 3085 __ CallStub(&convert_stub); |
| 3082 __ bind(&no_conversion); | 3086 __ bind(&no_conversion); |
| 3083 context()->Plug(result_register()); | 3087 context()->Plug(result_register()); |
| 3084 break; | 3088 break; |
| 3085 } | 3089 } |
| 3086 | 3090 |
| 3087 case Token::SUB: { | 3091 case Token::SUB: { |
| 3088 Comment cmt(masm_, "[ UnaryOperation (SUB)"); | 3092 Comment cmt(masm_, "[ UnaryOperation (SUB)"); |
| 3089 bool can_overwrite = expr->expression()->ResultOverwriteAllowed(); | 3093 bool can_overwrite = expr->expression()->ResultOverwriteAllowed(); |
| 3090 UnaryOverwriteMode overwrite = | 3094 UnaryOverwriteMode overwrite = |
| 3091 can_overwrite ? UNARY_OVERWRITE : UNARY_NO_OVERWRITE; | 3095 can_overwrite ? UNARY_OVERWRITE : UNARY_NO_OVERWRITE; |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3190 } | 3194 } |
| 3191 } | 3195 } |
| 3192 | 3196 |
| 3193 // We need a second deoptimization point after loading the value | 3197 // We need a second deoptimization point after loading the value |
| 3194 // in case evaluating the property load my have a side effect. | 3198 // in case evaluating the property load my have a side effect. |
| 3195 PrepareForBailout(expr->increment(), TOS_REG); | 3199 PrepareForBailout(expr->increment(), TOS_REG); |
| 3196 | 3200 |
| 3197 // Call ToNumber only if operand is not a smi. | 3201 // Call ToNumber only if operand is not a smi. |
| 3198 Label no_conversion; | 3202 Label no_conversion; |
| 3199 __ JumpIfSmi(r0, &no_conversion); | 3203 __ JumpIfSmi(r0, &no_conversion); |
| 3200 __ push(r0); | 3204 ToNumberStub convert_stub; |
| 3201 __ InvokeBuiltin(Builtins::TO_NUMBER, CALL_JS); | 3205 __ CallStub(&convert_stub); |
| 3202 __ bind(&no_conversion); | 3206 __ bind(&no_conversion); |
| 3203 | 3207 |
| 3204 // Save result for postfix expressions. | 3208 // Save result for postfix expressions. |
| 3205 if (expr->is_postfix()) { | 3209 if (expr->is_postfix()) { |
| 3206 if (!context()->IsEffect()) { | 3210 if (!context()->IsEffect()) { |
| 3207 // Save the result on the stack. If we have a named or keyed property | 3211 // Save the result on the stack. If we have a named or keyed property |
| 3208 // we store the result under the receiver that is currently on top | 3212 // we store the result under the receiver that is currently on top |
| 3209 // of the stack. | 3213 // of the stack. |
| 3210 switch (assign_type) { | 3214 switch (assign_type) { |
| 3211 case VARIABLE: | 3215 case VARIABLE: |
| (...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3641 __ mov(r1, Operand(r1, ASR, 1)); // Un-smi-tag value. | 3645 __ mov(r1, Operand(r1, ASR, 1)); // Un-smi-tag value. |
| 3642 __ add(pc, r1, Operand(masm_->CodeObject())); | 3646 __ add(pc, r1, Operand(masm_->CodeObject())); |
| 3643 } | 3647 } |
| 3644 | 3648 |
| 3645 | 3649 |
| 3646 #undef __ | 3650 #undef __ |
| 3647 | 3651 |
| 3648 } } // namespace v8::internal | 3652 } } // namespace v8::internal |
| 3649 | 3653 |
| 3650 #endif // V8_TARGET_ARCH_ARM | 3654 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |