Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(170)

Side by Side Diff: src/arm/code-stubs-arm.cc

Issue 6874007: Implement hardfloat calling convention in macro assembler and simulator. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Insert deleted empty line. Created 9 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | src/arm/lithium-codegen-arm.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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(0, 2, scratch);
834 if (FLAG_hardfloat) {
835 ASSERT(CpuFeatures::IsSupported(VFP3));
836 CpuFeatures::Scope scope(VFP3);
837 __ vmov(d0, r0, r1);
838 __ vmov(d1, r2, r3);
839 }
834 // Call C routine that may not cause GC or other trouble. 840 // Call C routine that may not cause GC or other trouble.
835 __ CallCFunction(ExternalReference::double_fp_operation(op, masm->isolate()), 841 __ CallCFunction(ExternalReference::double_fp_operation(op, masm->isolate()),
Søren Thygesen Gjesse 2011/04/27 13:26:03 The number 4 passed here should be two values as i
Karl Klose 2011/04/27 14:27:56 Done.
836 4); 842 4);
837 // Store answer in the overwritable heap number. Double returned in 843 // Store answer in the overwritable heap number. Double returned in
838 // registers r0 and r1. 844 // registers r0 and r1 or in d0.
839 __ Strd(r0, r1, FieldMemOperand(heap_number_result, 845 if (FLAG_hardfloat) {
840 HeapNumber::kValueOffset)); 846 CpuFeatures::Scope scope(VFP3);
847 __ vstr(d0,
848 FieldMemOperand(heap_number_result, HeapNumber::kValueOffset));
849 } else {
850 __ Strd(r0, r1, FieldMemOperand(heap_number_result,
851 HeapNumber::kValueOffset));
852 }
841 // Place heap_number_result in r0 and return to the pushed return address. 853 // Place heap_number_result in r0 and return to the pushed return address.
842 __ mov(r0, Operand(heap_number_result)); 854 __ mov(r0, Operand(heap_number_result));
843 __ pop(pc); 855 __ pop(pc);
844 } 856 }
845 857
846 858
847 // See comment for class. 859 // See comment for class.
848 void WriteInt32ToHeapNumberStub::Generate(MacroAssembler* masm) { 860 void WriteInt32ToHeapNumberStub::Generate(MacroAssembler* masm) {
849 Label max_negative_int; 861 Label max_negative_int;
850 // the_int_ has the answer which is a signed int32 but not a Smi. 862 // the_int_ has the answer which is a signed int32 but not a Smi.
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after
1172 __ mov(r0, Operand(r4), LeaveCC, ne); 1184 __ mov(r0, Operand(r4), LeaveCC, ne);
1173 __ Ret(ne); 1185 __ Ret(ne);
1174 // Now they are equal if and only if the lhs exponent is zero in its 1186 // Now they are equal if and only if the lhs exponent is zero in its
1175 // low 31 bits. 1187 // low 31 bits.
1176 __ mov(r0, Operand(rhs_exponent, LSL, kSmiTagSize)); 1188 __ mov(r0, Operand(rhs_exponent, LSL, kSmiTagSize));
1177 __ Ret(); 1189 __ Ret();
1178 } else { 1190 } else {
1179 // Call a native function to do a comparison between two non-NaNs. 1191 // Call a native function to do a comparison between two non-NaNs.
1180 // Call C routine that may not cause GC or other trouble. 1192 // Call C routine that may not cause GC or other trouble.
1181 __ push(lr); 1193 __ push(lr);
1182 __ PrepareCallCFunction(4, r5); // Two doubles count as 4 arguments. 1194 __ PrepareCallCFunction(0, 2, r5);
1195 if (FLAG_hardfloat) {
1196 ASSERT(CpuFeatures::IsSupported(VFP3));
1197 CpuFeatures::Scope scope(VFP3);
1198 __ vmov(d0, r0, r1);
1199 __ vmov(d1, r2, r3);
1200 }
1183 __ CallCFunction(ExternalReference::compare_doubles(masm->isolate()), 4); 1201 __ CallCFunction(ExternalReference::compare_doubles(masm->isolate()), 4);
1184 __ pop(pc); // Return. 1202 __ pop(pc); // Return.
1185 } 1203 }
1186 } 1204 }
1187 1205
1188 1206
1189 // See comment at call site. 1207 // See comment at call site.
1190 static void EmitStrictTwoHeapObjectCompare(MacroAssembler* masm, 1208 static void EmitStrictTwoHeapObjectCompare(MacroAssembler* masm,
1191 Register lhs, 1209 Register lhs,
1192 Register rhs) { 1210 Register rhs) {
(...skipping 1634 matching lines...) Expand 10 before | Expand all | Expand 10 after
2827 __ Ret(); 2845 __ Ret();
2828 } 2846 }
2829 } 2847 }
2830 2848
2831 2849
2832 void TranscendentalCacheStub::GenerateCallCFunction(MacroAssembler* masm, 2850 void TranscendentalCacheStub::GenerateCallCFunction(MacroAssembler* masm,
2833 Register scratch) { 2851 Register scratch) {
2834 Isolate* isolate = masm->isolate(); 2852 Isolate* isolate = masm->isolate();
2835 2853
2836 __ push(lr); 2854 __ push(lr);
2837 __ PrepareCallCFunction(2, scratch); 2855 __ PrepareCallCFunction(0, 1, scratch);
2838 __ vmov(r0, r1, d2); 2856 if (FLAG_hardfloat) {
2857 __ vmov(d0, d2);
2858 } else {
2859 __ vmov(r0, r1, d2);
2860 }
2839 switch (type_) { 2861 switch (type_) {
2840 case TranscendentalCache::SIN: 2862 case TranscendentalCache::SIN:
2841 __ CallCFunction(ExternalReference::math_sin_double_function(isolate), 2); 2863 __ CallCFunction(ExternalReference::math_sin_double_function(isolate), 2);
2842 break; 2864 break;
2843 case TranscendentalCache::COS: 2865 case TranscendentalCache::COS:
2844 __ CallCFunction(ExternalReference::math_cos_double_function(isolate), 2); 2866 __ CallCFunction(ExternalReference::math_cos_double_function(isolate), 2);
2845 break; 2867 break;
2846 case TranscendentalCache::LOG: 2868 case TranscendentalCache::LOG:
2847 __ CallCFunction(ExternalReference::math_log_double_function(isolate), 2); 2869 __ CallCFunction(ExternalReference::math_log_double_function(isolate), 2);
2848 break; 2870 break;
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
3054 // The base is in a double register and the exponent is 3076 // The base is in a double register and the exponent is
3055 // an untagged smi. Allocate a heap number and call a 3077 // an untagged smi. Allocate a heap number and call a
3056 // C function for integer exponents. The register containing 3078 // C function for integer exponents. The register containing
3057 // the heap number is callee-saved. 3079 // the heap number is callee-saved.
3058 __ AllocateHeapNumber(heapnumber, 3080 __ AllocateHeapNumber(heapnumber,
3059 scratch, 3081 scratch,
3060 scratch2, 3082 scratch2,
3061 heapnumbermap, 3083 heapnumbermap,
3062 &call_runtime); 3084 &call_runtime);
3063 __ push(lr); 3085 __ push(lr);
3064 __ PrepareCallCFunction(3, scratch); 3086 __ PrepareCallCFunction(1, 1, scratch);
3065 __ mov(r2, exponent); 3087 __ SetCallCDoubleArguments(double_base, exponent);
3066 __ vmov(r0, r1, double_base);
3067 __ CallCFunction( 3088 __ CallCFunction(
3068 ExternalReference::power_double_int_function(masm->isolate()), 3); 3089 ExternalReference::power_double_int_function(masm->isolate()), 3);
3069 __ pop(lr); 3090 __ pop(lr);
3070 __ GetCFunctionDoubleResult(double_result); 3091 __ GetCFunctionDoubleResult(double_result);
3071 __ vstr(double_result, 3092 __ vstr(double_result,
3072 FieldMemOperand(heapnumber, HeapNumber::kValueOffset)); 3093 FieldMemOperand(heapnumber, HeapNumber::kValueOffset));
3073 __ mov(r0, heapnumber); 3094 __ mov(r0, heapnumber);
3074 __ Ret(2 * kPointerSize); 3095 __ Ret(2 * kPointerSize);
3075 3096
3076 __ bind(&exponent_not_smi); 3097 __ bind(&exponent_not_smi);
3077 __ ldr(scratch, FieldMemOperand(exponent, JSObject::kMapOffset)); 3098 __ ldr(scratch, FieldMemOperand(exponent, JSObject::kMapOffset));
3078 __ cmp(scratch, heapnumbermap); 3099 __ cmp(scratch, heapnumbermap);
3079 __ b(ne, &call_runtime); 3100 __ b(ne, &call_runtime);
3080 // Exponent is a heapnumber. Load it into double register. 3101 // Exponent is a heapnumber. Load it into double register.
3081 __ vldr(double_exponent, 3102 __ vldr(double_exponent,
3082 FieldMemOperand(exponent, HeapNumber::kValueOffset)); 3103 FieldMemOperand(exponent, HeapNumber::kValueOffset));
3083 3104
3084 // The base and the exponent are in double registers. 3105 // The base and the exponent are in double registers.
3085 // Allocate a heap number and call a C function for 3106 // Allocate a heap number and call a C function for
3086 // double exponents. The register containing 3107 // double exponents. The register containing
3087 // the heap number is callee-saved. 3108 // the heap number is callee-saved.
3088 __ AllocateHeapNumber(heapnumber, 3109 __ AllocateHeapNumber(heapnumber,
3089 scratch, 3110 scratch,
3090 scratch2, 3111 scratch2,
3091 heapnumbermap, 3112 heapnumbermap,
3092 &call_runtime); 3113 &call_runtime);
3093 __ push(lr); 3114 __ push(lr);
3094 __ PrepareCallCFunction(4, scratch); 3115 __ PrepareCallCFunction(0, 2, scratch);
3095 __ vmov(r0, r1, double_base); 3116 __ SetCallCDoubleArguments(double_base, double_exponent);
3096 __ vmov(r2, r3, double_exponent);
3097 __ CallCFunction( 3117 __ CallCFunction(
3098 ExternalReference::power_double_double_function(masm->isolate()), 4); 3118 ExternalReference::power_double_double_function(masm->isolate()), 4);
3099 __ pop(lr); 3119 __ pop(lr);
3100 __ GetCFunctionDoubleResult(double_result); 3120 __ GetCFunctionDoubleResult(double_result);
3101 __ vstr(double_result, 3121 __ vstr(double_result,
3102 FieldMemOperand(heapnumber, HeapNumber::kValueOffset)); 3122 FieldMemOperand(heapnumber, HeapNumber::kValueOffset));
3103 __ mov(r0, heapnumber); 3123 __ mov(r0, heapnumber);
3104 __ Ret(2 * kPointerSize); 3124 __ Ret(2 * kPointerSize);
3105 } 3125 }
3106 3126
(...skipping 25 matching lines...) Expand all
3132 bool do_gc, 3152 bool do_gc,
3133 bool always_allocate) { 3153 bool always_allocate) {
3134 // r0: result parameter for PerformGC, if any 3154 // r0: result parameter for PerformGC, if any
3135 // r4: number of arguments including receiver (C callee-saved) 3155 // r4: number of arguments including receiver (C callee-saved)
3136 // r5: pointer to builtin function (C callee-saved) 3156 // r5: pointer to builtin function (C callee-saved)
3137 // r6: pointer to the first argument (C callee-saved) 3157 // r6: pointer to the first argument (C callee-saved)
3138 Isolate* isolate = masm->isolate(); 3158 Isolate* isolate = masm->isolate();
3139 3159
3140 if (do_gc) { 3160 if (do_gc) {
3141 // Passing r0. 3161 // Passing r0.
3142 __ PrepareCallCFunction(1, r1); 3162 __ PrepareCallCFunction(1, 0, r1);
3143 __ CallCFunction(ExternalReference::perform_gc_function(isolate), 1); 3163 __ CallCFunction(ExternalReference::perform_gc_function(isolate), 1);
3144 } 3164 }
3145 3165
3146 ExternalReference scope_depth = 3166 ExternalReference scope_depth =
3147 ExternalReference::heap_always_allocate_scope_depth(isolate); 3167 ExternalReference::heap_always_allocate_scope_depth(isolate);
3148 if (always_allocate) { 3168 if (always_allocate) {
3149 __ mov(r0, Operand(scope_depth)); 3169 __ mov(r0, Operand(scope_depth));
3150 __ ldr(r1, MemOperand(r0)); 3170 __ ldr(r1, MemOperand(r0));
3151 __ add(r1, r1, Operand(1)); 3171 __ add(r1, r1, Operand(1));
3152 __ str(r1, MemOperand(r0)); 3172 __ str(r1, MemOperand(r0));
(...skipping 2624 matching lines...) Expand 10 before | Expand all | Expand 10 after
5777 __ str(pc, MemOperand(sp, 0)); 5797 __ str(pc, MemOperand(sp, 0));
5778 __ Jump(target); // Call the C++ function. 5798 __ Jump(target); // Call the C++ function.
5779 } 5799 }
5780 5800
5781 5801
5782 #undef __ 5802 #undef __
5783 5803
5784 } } // namespace v8::internal 5804 } } // namespace v8::internal
5785 5805
5786 #endif // V8_TARGET_ARCH_ARM 5806 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « no previous file | src/arm/lithium-codegen-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698