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 2866 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2877 break; | 2877 break; |
2878 case TRBinaryOpIC::SMI: | 2878 case TRBinaryOpIC::SMI: |
2879 GenerateSmiStub(masm); | 2879 GenerateSmiStub(masm); |
2880 break; | 2880 break; |
2881 case TRBinaryOpIC::INT32: | 2881 case TRBinaryOpIC::INT32: |
2882 GenerateInt32Stub(masm); | 2882 GenerateInt32Stub(masm); |
2883 break; | 2883 break; |
2884 case TRBinaryOpIC::HEAP_NUMBER: | 2884 case TRBinaryOpIC::HEAP_NUMBER: |
2885 GenerateHeapNumberStub(masm); | 2885 GenerateHeapNumberStub(masm); |
2886 break; | 2886 break; |
| 2887 case TRBinaryOpIC::ODDBALL: |
| 2888 GenerateOddballStub(masm); |
| 2889 break; |
2887 case TRBinaryOpIC::STRING: | 2890 case TRBinaryOpIC::STRING: |
2888 GenerateStringStub(masm); | 2891 GenerateStringStub(masm); |
2889 break; | 2892 break; |
2890 case TRBinaryOpIC::GENERIC: | 2893 case TRBinaryOpIC::GENERIC: |
2891 GenerateGeneric(masm); | 2894 GenerateGeneric(masm); |
2892 break; | 2895 break; |
2893 default: | 2896 default: |
2894 UNREACHABLE(); | 2897 UNREACHABLE(); |
2895 } | 2898 } |
2896 } | 2899 } |
(...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3419 // If the ne condition is set, result does | 3422 // If the ne condition is set, result does |
3420 // not fit in a 32-bit integer. | 3423 // not fit in a 32-bit integer. |
3421 __ b(ne, &transition); | 3424 __ b(ne, &transition); |
3422 } | 3425 } |
3423 | 3426 |
3424 // Check if the result fits in a smi. | 3427 // Check if the result fits in a smi. |
3425 __ vmov(scratch1, single_scratch); | 3428 __ vmov(scratch1, single_scratch); |
3426 __ add(scratch2, scratch1, Operand(0x40000000), SetCC); | 3429 __ add(scratch2, scratch1, Operand(0x40000000), SetCC); |
3427 // If not try to return a heap number. | 3430 // If not try to return a heap number. |
3428 __ b(mi, &return_heap_number); | 3431 __ b(mi, &return_heap_number); |
| 3432 // Check for minus zero. Return heap number for minus zero. |
| 3433 Label not_zero; |
| 3434 __ cmp(scratch1, Operand(0)); |
| 3435 __ b(ne, ¬_zero); |
| 3436 __ vmov(scratch2, d5.high()); |
| 3437 __ tst(scratch2, Operand(HeapNumber::kSignMask)); |
| 3438 __ b(ne, &return_heap_number); |
| 3439 __ bind(¬_zero); |
| 3440 |
3429 // Tag the result and return. | 3441 // Tag the result and return. |
3430 __ SmiTag(r0, scratch1); | 3442 __ SmiTag(r0, scratch1); |
3431 __ Ret(); | 3443 __ Ret(); |
| 3444 } else { |
| 3445 // DIV just falls through to allocating a heap number. |
3432 } | 3446 } |
3433 | 3447 |
3434 if (result_type_ >= (op_ == Token::DIV) ? TRBinaryOpIC::HEAP_NUMBER | 3448 if (result_type_ >= (op_ == Token::DIV) ? TRBinaryOpIC::HEAP_NUMBER |
3435 : TRBinaryOpIC::INT32) { | 3449 : TRBinaryOpIC::INT32) { |
3436 __ bind(&return_heap_number); | 3450 __ bind(&return_heap_number); |
3437 // We are using vfp registers so r5 is available. | 3451 // We are using vfp registers so r5 is available. |
3438 heap_number_result = r5; | 3452 heap_number_result = r5; |
3439 GenerateHeapResultAllocation(masm, | 3453 GenerateHeapResultAllocation(masm, |
3440 heap_number_result, | 3454 heap_number_result, |
3441 heap_number_map, | 3455 heap_number_map, |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3599 if (transition.is_linked()) { | 3613 if (transition.is_linked()) { |
3600 __ bind(&transition); | 3614 __ bind(&transition); |
3601 GenerateTypeTransition(masm); | 3615 GenerateTypeTransition(masm); |
3602 } | 3616 } |
3603 | 3617 |
3604 __ bind(&call_runtime); | 3618 __ bind(&call_runtime); |
3605 GenerateCallRuntime(masm); | 3619 GenerateCallRuntime(masm); |
3606 } | 3620 } |
3607 | 3621 |
3608 | 3622 |
| 3623 void TypeRecordingBinaryOpStub::GenerateOddballStub(MacroAssembler* masm) { |
| 3624 Label call_runtime; |
| 3625 |
| 3626 if (op_ == Token::ADD) { |
| 3627 // Handle string addition here, because it is the only operation |
| 3628 // that does not do a ToNumber conversion on the operands. |
| 3629 GenerateAddStrings(masm); |
| 3630 } |
| 3631 |
| 3632 // Convert oddball arguments to numbers. |
| 3633 Label check, done; |
| 3634 __ CompareRoot(r1, Heap::kUndefinedValueRootIndex); |
| 3635 __ b(ne, &check); |
| 3636 if (Token::IsBitOp(op_)) { |
| 3637 __ mov(r1, Operand(Smi::FromInt(0))); |
| 3638 } else { |
| 3639 __ LoadRoot(r1, Heap::kNanValueRootIndex); |
| 3640 } |
| 3641 __ jmp(&done); |
| 3642 __ bind(&check); |
| 3643 __ CompareRoot(r0, Heap::kUndefinedValueRootIndex); |
| 3644 __ b(ne, &done); |
| 3645 if (Token::IsBitOp(op_)) { |
| 3646 __ mov(r0, Operand(Smi::FromInt(0))); |
| 3647 } else { |
| 3648 __ LoadRoot(r0, Heap::kNanValueRootIndex); |
| 3649 } |
| 3650 __ bind(&done); |
| 3651 |
| 3652 GenerateHeapNumberStub(masm); |
| 3653 } |
| 3654 |
| 3655 |
3609 void TypeRecordingBinaryOpStub::GenerateHeapNumberStub(MacroAssembler* masm) { | 3656 void TypeRecordingBinaryOpStub::GenerateHeapNumberStub(MacroAssembler* masm) { |
3610 Label call_runtime; | 3657 Label call_runtime; |
3611 ASSERT(operands_type_ == TRBinaryOpIC::HEAP_NUMBER); | |
3612 | |
3613 GenerateFPOperation(masm, false, &call_runtime, &call_runtime); | 3658 GenerateFPOperation(masm, false, &call_runtime, &call_runtime); |
3614 | 3659 |
3615 __ bind(&call_runtime); | 3660 __ bind(&call_runtime); |
3616 GenerateCallRuntime(masm); | 3661 GenerateCallRuntime(masm); |
3617 } | 3662 } |
3618 | 3663 |
3619 | 3664 |
3620 void TypeRecordingBinaryOpStub::GenerateGeneric(MacroAssembler* masm) { | 3665 void TypeRecordingBinaryOpStub::GenerateGeneric(MacroAssembler* masm) { |
3621 Label call_runtime, call_string_add_or_runtime; | 3666 Label call_runtime, call_string_add_or_runtime; |
3622 | 3667 |
(...skipping 3240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6863 __ str(pc, MemOperand(sp, 0)); | 6908 __ str(pc, MemOperand(sp, 0)); |
6864 __ Jump(target); // Call the C++ function. | 6909 __ Jump(target); // Call the C++ function. |
6865 } | 6910 } |
6866 | 6911 |
6867 | 6912 |
6868 #undef __ | 6913 #undef __ |
6869 | 6914 |
6870 } } // namespace v8::internal | 6915 } } // namespace v8::internal |
6871 | 6916 |
6872 #endif // V8_TARGET_ARCH_ARM | 6917 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |