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 2643 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2654 case Token::MOD: { | 2654 case Token::MOD: { |
2655 // Load left and right operands into d6 and d7 or r0/r1 and r2/r3 | 2655 // Load left and right operands into d6 and d7 or r0/r1 and r2/r3 |
2656 // depending on whether VFP3 is available or not. | 2656 // depending on whether VFP3 is available or not. |
2657 FloatingPointHelper::Destination destination = | 2657 FloatingPointHelper::Destination destination = |
2658 CpuFeatures::IsSupported(VFP3) && op_ != Token::MOD ? | 2658 CpuFeatures::IsSupported(VFP3) && op_ != Token::MOD ? |
2659 FloatingPointHelper::kVFPRegisters : | 2659 FloatingPointHelper::kVFPRegisters : |
2660 FloatingPointHelper::kCoreRegisters; | 2660 FloatingPointHelper::kCoreRegisters; |
2661 | 2661 |
2662 // Allocate new heap number for result. | 2662 // Allocate new heap number for result. |
2663 Register result = r5; | 2663 Register result = r5; |
2664 __ AllocateHeapNumber( | 2664 GenerateHeapResultAllocation( |
2665 result, scratch1, scratch2, heap_number_map, gc_required); | 2665 masm, result, heap_number_map, scratch1, scratch2, gc_required); |
2666 | 2666 |
2667 // Load the operands. | 2667 // Load the operands. |
2668 if (smi_operands) { | 2668 if (smi_operands) { |
2669 FloatingPointHelper::LoadSmis(masm, destination, scratch1, scratch2); | 2669 FloatingPointHelper::LoadSmis(masm, destination, scratch1, scratch2); |
2670 } else { | 2670 } else { |
2671 FloatingPointHelper::LoadOperands(masm, | 2671 FloatingPointHelper::LoadOperands(masm, |
2672 destination, | 2672 destination, |
2673 heap_number_map, | 2673 heap_number_map, |
2674 scratch1, | 2674 scratch1, |
2675 scratch2, | 2675 scratch2, |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2804 } | 2804 } |
2805 | 2805 |
2806 // Check that the *signed* result fits in a smi. | 2806 // Check that the *signed* result fits in a smi. |
2807 __ add(r3, r2, Operand(0x40000000), SetCC); | 2807 __ add(r3, r2, Operand(0x40000000), SetCC); |
2808 __ b(mi, &result_not_a_smi); | 2808 __ b(mi, &result_not_a_smi); |
2809 __ SmiTag(r0, r2); | 2809 __ SmiTag(r0, r2); |
2810 __ Ret(); | 2810 __ Ret(); |
2811 | 2811 |
2812 // Allocate new heap number for result. | 2812 // Allocate new heap number for result. |
2813 __ bind(&result_not_a_smi); | 2813 __ bind(&result_not_a_smi); |
2814 __ AllocateHeapNumber( | 2814 Register result = r5; |
2815 r5, scratch1, scratch2, heap_number_map, gc_required); | 2815 if (smi_operands) { |
| 2816 __ AllocateHeapNumber( |
| 2817 result, scratch1, scratch2, heap_number_map, gc_required); |
| 2818 } else { |
| 2819 GenerateHeapResultAllocation( |
| 2820 masm, result, heap_number_map, scratch1, scratch2, gc_required); |
| 2821 } |
2816 | 2822 |
2817 // r2: Answer as signed int32. | 2823 // r2: Answer as signed int32. |
2818 // r5: Heap number to write answer into. | 2824 // r5: Heap number to write answer into. |
2819 | 2825 |
2820 // Nothing can go wrong now, so move the heap number to r0, which is the | 2826 // Nothing can go wrong now, so move the heap number to r0, which is the |
2821 // result. | 2827 // result. |
2822 __ mov(r0, Operand(r5)); | 2828 __ mov(r0, Operand(r5)); |
2823 | 2829 |
2824 if (CpuFeatures::IsSupported(VFP3)) { | 2830 if (CpuFeatures::IsSupported(VFP3)) { |
2825 // Convert the int32 in r2 to the heap number in r0. r3 is corrupted. As | 2831 // Convert the int32 in r2 to the heap number in r0. r3 is corrupted. As |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2927 | 2933 |
2928 __ bind(¬_numbers); | 2934 __ bind(¬_numbers); |
2929 GenerateTypeTransition(masm); | 2935 GenerateTypeTransition(masm); |
2930 | 2936 |
2931 __ bind(&call_runtime); | 2937 __ bind(&call_runtime); |
2932 GenerateCallRuntime(masm); | 2938 GenerateCallRuntime(masm); |
2933 } | 2939 } |
2934 | 2940 |
2935 | 2941 |
2936 void TypeRecordingBinaryOpStub::GenerateGeneric(MacroAssembler* masm) { | 2942 void TypeRecordingBinaryOpStub::GenerateGeneric(MacroAssembler* masm) { |
2937 Label call_runtime; | 2943 Label call_runtime, call_string_add_or_runtime; |
2938 | 2944 |
2939 GenerateSmiCode(masm, &call_runtime, ALLOW_HEAPNUMBER_RESULTS); | 2945 GenerateSmiCode(masm, &call_runtime, ALLOW_HEAPNUMBER_RESULTS); |
2940 | 2946 |
2941 // If all else fails, use the runtime system to get the correct | 2947 GenerateFPOperation(masm, false, &call_string_add_or_runtime, &call_runtime); |
2942 // result. | |
2943 __ bind(&call_runtime); | |
2944 | 2948 |
2945 // Try to add strings before calling runtime. | 2949 __ bind(&call_string_add_or_runtime); |
2946 if (op_ == Token::ADD) { | 2950 if (op_ == Token::ADD) { |
2947 GenerateAddStrings(masm); | 2951 GenerateAddStrings(masm); |
2948 } | 2952 } |
2949 | 2953 |
2950 GenericBinaryOpStub stub(op_, mode_, r1, r0); | 2954 __ bind(&call_runtime); |
2951 __ TailCallStub(&stub); | 2955 GenerateCallRuntime(masm); |
2952 } | 2956 } |
2953 | 2957 |
2954 | 2958 |
2955 void TypeRecordingBinaryOpStub::GenerateAddStrings(MacroAssembler* masm) { | 2959 void TypeRecordingBinaryOpStub::GenerateAddStrings(MacroAssembler* masm) { |
2956 ASSERT(op_ == Token::ADD); | 2960 ASSERT(op_ == Token::ADD); |
2957 | 2961 |
2958 Register left = r1; | 2962 Register left = r1; |
2959 Register right = r0; | 2963 Register right = r0; |
2960 Label call_runtime; | 2964 Label call_runtime; |
2961 | 2965 |
(...skipping 3089 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6051 __ strb(untagged_value, MemOperand(external_pointer, untagged_key)); | 6055 __ strb(untagged_value, MemOperand(external_pointer, untagged_key)); |
6052 __ Ret(); | 6056 __ Ret(); |
6053 } | 6057 } |
6054 | 6058 |
6055 | 6059 |
6056 #undef __ | 6060 #undef __ |
6057 | 6061 |
6058 } } // namespace v8::internal | 6062 } } // namespace v8::internal |
6059 | 6063 |
6060 #endif // V8_TARGET_ARCH_ARM | 6064 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |