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 812 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
823 // r2: Right value (least significant part of mantissa). | 823 // r2: Right value (least significant part of mantissa). |
824 // r3: Right value (sign, exponent, top of mantissa). | 824 // r3: Right value (sign, exponent, top of mantissa). |
825 | 825 |
826 // Assert that heap_number_result is callee-saved. | 826 // Assert that heap_number_result is callee-saved. |
827 // We currently always use r5 to pass it. | 827 // We currently always use r5 to pass it. |
828 ASSERT(heap_number_result.is(r5)); | 828 ASSERT(heap_number_result.is(r5)); |
829 | 829 |
830 // Push the current return address before the C call. Return will be | 830 // Push the current return address before the C call. Return will be |
831 // through pop(pc) below. | 831 // through pop(pc) below. |
832 __ push(lr); | 832 __ push(lr); |
833 __ PrepareCallCFunction(4, scratch); // Two doubles are 4 arguments. | 833 __ PrepareCallCFunction(4, scratch); // Two doubles are 4 arguments. |
Søren Thygesen Gjesse
2011/04/27 08:19:01
We should probably pass 0 instead of 4 here for ha
Karl Klose
2011/04/27 12:54:13
Changed to PrepareCallCFunction(0, 2, scratch).
| |
834 if (FLAG_hardfloat) { | |
Søren Thygesen Gjesse
2011/04/27 08:19:01
As far as I can see CallCCodeForDoubleOperation is
Karl Klose
2011/04/27 12:54:13
It is used from the TRBO stub, also with VFP3.
| |
835 __ vmov(d0, r0, r1); | |
836 __ vmov(d1, r2, r3); | |
837 } | |
834 // Call C routine that may not cause GC or other trouble. | 838 // Call C routine that may not cause GC or other trouble. |
835 __ CallCFunction(ExternalReference::double_fp_operation(op, masm->isolate()), | 839 __ CallCFunction(ExternalReference::double_fp_operation(op, masm->isolate()), |
836 4); | 840 4); |
837 // Store answer in the overwritable heap number. Double returned in | 841 // Store answer in the overwritable heap number. Double returned in |
838 // registers r0 and r1. | 842 // registers r0 and r1 or in d0. |
839 __ Strd(r0, r1, FieldMemOperand(heap_number_result, | 843 if (FLAG_hardfloat) { |
840 HeapNumber::kValueOffset)); | 844 __ vstr(d0, |
845 FieldMemOperand(heap_number_result, HeapNumber::kValueOffset)); | |
846 } else { | |
847 __ Strd(r0, r1, FieldMemOperand(heap_number_result, | |
848 HeapNumber::kValueOffset)); | |
849 } | |
841 // Place heap_number_result in r0 and return to the pushed return address. | 850 // Place heap_number_result in r0 and return to the pushed return address. |
842 __ mov(r0, Operand(heap_number_result)); | 851 __ mov(r0, Operand(heap_number_result)); |
843 __ pop(pc); | 852 __ pop(pc); |
844 } | 853 } |
845 | 854 |
846 | 855 |
847 // See comment for class. | 856 // See comment for class. |
848 void WriteInt32ToHeapNumberStub::Generate(MacroAssembler* masm) { | 857 void WriteInt32ToHeapNumberStub::Generate(MacroAssembler* masm) { |
849 Label max_negative_int; | 858 Label max_negative_int; |
850 // the_int_ has the answer which is a signed int32 but not a Smi. | 859 // the_int_ has the answer which is a signed int32 but not a Smi. |
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1173 __ Ret(ne); | 1182 __ Ret(ne); |
1174 // Now they are equal if and only if the lhs exponent is zero in its | 1183 // Now they are equal if and only if the lhs exponent is zero in its |
1175 // low 31 bits. | 1184 // low 31 bits. |
1176 __ mov(r0, Operand(rhs_exponent, LSL, kSmiTagSize)); | 1185 __ mov(r0, Operand(rhs_exponent, LSL, kSmiTagSize)); |
1177 __ Ret(); | 1186 __ Ret(); |
1178 } else { | 1187 } else { |
1179 // Call a native function to do a comparison between two non-NaNs. | 1188 // Call a native function to do a comparison between two non-NaNs. |
1180 // Call C routine that may not cause GC or other trouble. | 1189 // Call C routine that may not cause GC or other trouble. |
1181 __ push(lr); | 1190 __ push(lr); |
1182 __ PrepareCallCFunction(4, r5); // Two doubles count as 4 arguments. | 1191 __ PrepareCallCFunction(4, r5); // Two doubles count as 4 arguments. |
1192 if (FLAG_hardfloat) { | |
1193 __ vmov(d0, r0, r1); | |
1194 __ vmov(d1, r2, r3); | |
1195 } | |
1183 __ CallCFunction(ExternalReference::compare_doubles(masm->isolate()), 4); | 1196 __ CallCFunction(ExternalReference::compare_doubles(masm->isolate()), 4); |
1184 __ pop(pc); // Return. | 1197 __ pop(pc); // Return. |
1185 } | 1198 } |
1186 } | 1199 } |
1187 | 1200 |
1188 | 1201 |
1189 // See comment at call site. | 1202 // See comment at call site. |
1190 static void EmitStrictTwoHeapObjectCompare(MacroAssembler* masm, | 1203 static void EmitStrictTwoHeapObjectCompare(MacroAssembler* masm, |
1191 Register lhs, | 1204 Register lhs, |
1192 Register rhs) { | 1205 Register rhs) { |
(...skipping 1629 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2822 } | 2835 } |
2823 } | 2836 } |
2824 | 2837 |
2825 | 2838 |
2826 void TranscendentalCacheStub::GenerateCallCFunction(MacroAssembler* masm, | 2839 void TranscendentalCacheStub::GenerateCallCFunction(MacroAssembler* masm, |
2827 Register scratch) { | 2840 Register scratch) { |
2828 Isolate* isolate = masm->isolate(); | 2841 Isolate* isolate = masm->isolate(); |
2829 | 2842 |
2830 __ push(lr); | 2843 __ push(lr); |
2831 __ PrepareCallCFunction(2, scratch); | 2844 __ PrepareCallCFunction(2, scratch); |
2832 __ vmov(r0, r1, d2); | 2845 if (FLAG_hardfloat) { |
Søren Thygesen Gjesse
2011/04/27 08:19:01
I think we should consider changing the Transcende
| |
2846 __ vmov(d0, d2); | |
2847 } else { | |
2848 __ vmov(r0, r1, d2); | |
2849 } | |
2833 switch (type_) { | 2850 switch (type_) { |
2834 case TranscendentalCache::SIN: | 2851 case TranscendentalCache::SIN: |
2835 __ CallCFunction(ExternalReference::math_sin_double_function(isolate), 2); | 2852 __ CallCFunction(ExternalReference::math_sin_double_function(isolate), 2); |
2836 break; | 2853 break; |
2837 case TranscendentalCache::COS: | 2854 case TranscendentalCache::COS: |
2838 __ CallCFunction(ExternalReference::math_cos_double_function(isolate), 2); | 2855 __ CallCFunction(ExternalReference::math_cos_double_function(isolate), 2); |
2839 break; | 2856 break; |
2840 case TranscendentalCache::LOG: | 2857 case TranscendentalCache::LOG: |
2841 __ CallCFunction(ExternalReference::math_log_double_function(isolate), 2); | 2858 __ CallCFunction(ExternalReference::math_log_double_function(isolate), 2); |
2842 break; | 2859 break; |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3049 // an untagged smi. Allocate a heap number and call a | 3066 // an untagged smi. Allocate a heap number and call a |
3050 // C function for integer exponents. The register containing | 3067 // C function for integer exponents. The register containing |
3051 // the heap number is callee-saved. | 3068 // the heap number is callee-saved. |
3052 __ AllocateHeapNumber(heapnumber, | 3069 __ AllocateHeapNumber(heapnumber, |
3053 scratch, | 3070 scratch, |
3054 scratch2, | 3071 scratch2, |
3055 heapnumbermap, | 3072 heapnumbermap, |
3056 &call_runtime); | 3073 &call_runtime); |
3057 __ push(lr); | 3074 __ push(lr); |
3058 __ PrepareCallCFunction(3, scratch); | 3075 __ PrepareCallCFunction(3, scratch); |
3059 __ mov(r2, exponent); | 3076 __ SetCallCDoubleArguments(double_base, exponent); |
3060 __ vmov(r0, r1, double_base); | |
3061 __ CallCFunction( | 3077 __ CallCFunction( |
3062 ExternalReference::power_double_int_function(masm->isolate()), 3); | 3078 ExternalReference::power_double_int_function(masm->isolate()), 3); |
3063 __ pop(lr); | 3079 __ pop(lr); |
3064 __ GetCFunctionDoubleResult(double_result); | 3080 __ GetCFunctionDoubleResult(double_result); |
3065 __ vstr(double_result, | 3081 __ vstr(double_result, |
3066 FieldMemOperand(heapnumber, HeapNumber::kValueOffset)); | 3082 FieldMemOperand(heapnumber, HeapNumber::kValueOffset)); |
3067 __ mov(r0, heapnumber); | 3083 __ mov(r0, heapnumber); |
3068 __ Ret(2 * kPointerSize); | 3084 __ Ret(2 * kPointerSize); |
3069 | 3085 |
3070 __ bind(&exponent_not_smi); | 3086 __ bind(&exponent_not_smi); |
3071 __ ldr(scratch, FieldMemOperand(exponent, JSObject::kMapOffset)); | 3087 __ ldr(scratch, FieldMemOperand(exponent, JSObject::kMapOffset)); |
3072 __ cmp(scratch, heapnumbermap); | 3088 __ cmp(scratch, heapnumbermap); |
3073 __ b(ne, &call_runtime); | 3089 __ b(ne, &call_runtime); |
3074 // Exponent is a heapnumber. Load it into double register. | 3090 // Exponent is a heapnumber. Load it into double register. |
3075 __ vldr(double_exponent, | 3091 __ vldr(double_exponent, |
3076 FieldMemOperand(exponent, HeapNumber::kValueOffset)); | 3092 FieldMemOperand(exponent, HeapNumber::kValueOffset)); |
3077 | 3093 |
3078 // The base and the exponent are in double registers. | 3094 // The base and the exponent are in double registers. |
3079 // Allocate a heap number and call a C function for | 3095 // Allocate a heap number and call a C function for |
3080 // double exponents. The register containing | 3096 // double exponents. The register containing |
3081 // the heap number is callee-saved. | 3097 // the heap number is callee-saved. |
3082 __ AllocateHeapNumber(heapnumber, | 3098 __ AllocateHeapNumber(heapnumber, |
3083 scratch, | 3099 scratch, |
3084 scratch2, | 3100 scratch2, |
3085 heapnumbermap, | 3101 heapnumbermap, |
3086 &call_runtime); | 3102 &call_runtime); |
3087 __ push(lr); | 3103 __ push(lr); |
3088 __ PrepareCallCFunction(4, scratch); | 3104 __ PrepareCallCFunction(4, scratch); |
3089 __ vmov(r0, r1, double_base); | 3105 __ SetCallCDoubleArguments(double_base, double_exponent); |
3090 __ vmov(r2, r3, double_exponent); | |
3091 __ CallCFunction( | 3106 __ CallCFunction( |
3092 ExternalReference::power_double_double_function(masm->isolate()), 4); | 3107 ExternalReference::power_double_double_function(masm->isolate()), 4); |
3093 __ pop(lr); | 3108 __ pop(lr); |
3094 __ GetCFunctionDoubleResult(double_result); | 3109 __ GetCFunctionDoubleResult(double_result); |
3095 __ vstr(double_result, | 3110 __ vstr(double_result, |
3096 FieldMemOperand(heapnumber, HeapNumber::kValueOffset)); | 3111 FieldMemOperand(heapnumber, HeapNumber::kValueOffset)); |
3097 __ mov(r0, heapnumber); | 3112 __ mov(r0, heapnumber); |
3098 __ Ret(2 * kPointerSize); | 3113 __ Ret(2 * kPointerSize); |
3099 } | 3114 } |
3100 | 3115 |
(...skipping 2670 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5771 __ str(pc, MemOperand(sp, 0)); | 5786 __ str(pc, MemOperand(sp, 0)); |
5772 __ Jump(target); // Call the C++ function. | 5787 __ Jump(target); // Call the C++ function. |
5773 } | 5788 } |
5774 | 5789 |
5775 | 5790 |
5776 #undef __ | 5791 #undef __ |
5777 | 5792 |
5778 } } // namespace v8::internal | 5793 } } // namespace v8::internal |
5779 | 5794 |
5780 #endif // V8_TARGET_ARCH_ARM | 5795 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |