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

Side by Side Diff: src/s390/builtins-s390.cc

Issue 2125913004: PPC/s390: [builtins] Fix MathMaxMin on arm and arm64 (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 5 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
« no previous file with comments | « src/ppc/builtins-ppc.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #if V8_TARGET_ARCH_S390 5 #if V8_TARGET_ARCH_S390
6 6
7 #include "src/codegen.h" 7 #include "src/codegen.h"
8 #include "src/debug/debug.h" 8 #include "src/debug/debug.h"
9 #include "src/deoptimizer.h" 9 #include "src/deoptimizer.h"
10 #include "src/full-codegen/full-codegen.h" 10 #include "src/full-codegen/full-codegen.h"
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 // Run the native code for the Array function called as a normal function. 112 // Run the native code for the Array function called as a normal function.
113 // tail call a stub 113 // tail call a stub
114 __ LoadRoot(r4, Heap::kUndefinedValueRootIndex); 114 __ LoadRoot(r4, Heap::kUndefinedValueRootIndex);
115 ArrayConstructorStub stub(masm->isolate()); 115 ArrayConstructorStub stub(masm->isolate());
116 __ TailCallStub(&stub); 116 __ TailCallStub(&stub);
117 } 117 }
118 118
119 // static 119 // static
120 void Builtins::Generate_MathMaxMin(MacroAssembler* masm, MathMaxMinKind kind) { 120 void Builtins::Generate_MathMaxMin(MacroAssembler* masm, MathMaxMinKind kind) {
121 // ----------- S t a t e ------------- 121 // ----------- S t a t e -------------
122 // -- r2 : number of arguments 122 // -- r2 : number of arguments
123 // -- r3 : function 123 // -- r3 : function
124 // -- cp : context 124 // -- cp : context
125 // -- lr : return address 125 // -- lr : return address
126 // -- sp[(argc - n) * 8] : arg[n] (zero-based) 126 // -- sp[(argc - n - 1) * 4] : arg[n] (zero based)
127 // -- sp[(argc + 1) * 8] : receiver 127 // -- sp[argc * 4] : receiver
128 // ----------------------------------- 128 // -----------------------------------
129 Condition const cond_done = (kind == MathMaxMinKind::kMin) ? lt : gt; 129 Condition const cond_done = (kind == MathMaxMinKind::kMin) ? lt : gt;
130 Heap::RootListIndex const root_index = 130 Heap::RootListIndex const root_index =
131 (kind == MathMaxMinKind::kMin) ? Heap::kInfinityValueRootIndex 131 (kind == MathMaxMinKind::kMin) ? Heap::kInfinityValueRootIndex
132 : Heap::kMinusInfinityValueRootIndex; 132 : Heap::kMinusInfinityValueRootIndex;
133 DoubleRegister const reg = (kind == MathMaxMinKind::kMin) ? d2 : d1; 133 DoubleRegister const reg = (kind == MathMaxMinKind::kMin) ? d2 : d1;
134 134
135 // Load the accumulator with the default return value (either -Infinity or 135 // Load the accumulator with the default return value (either -Infinity or
136 // +Infinity), with the tagged value in r7 and the double value in d1. 136 // +Infinity), with the tagged value in r7 and the double value in d1.
137 __ LoadRoot(r7, root_index); 137 __ LoadRoot(r7, root_index);
138 __ LoadDouble(d1, FieldMemOperand(r7, HeapNumber::kValueOffset)); 138 __ LoadDouble(d1, FieldMemOperand(r7, HeapNumber::kValueOffset));
139 139
140 // Setup state for loop 140 // Setup state for loop
141 // r4: address of arg[0] + kPointerSize 141 // r4: address of arg[0] + kPointerSize
142 // r5: number of slots to drop at exit (arguments + receiver) 142 // r5: number of slots to drop at exit (arguments + receiver)
143 __ AddP(r6, r2, Operand(1)); 143 __ AddP(r6, r2, Operand(1));
144 144
145 Label done_loop, loop; 145 Label done_loop, loop;
146 __ LoadRR(r6, r2);
146 __ bind(&loop); 147 __ bind(&loop);
147 { 148 {
148 // Check if all parameters done. 149 // Check if all parameters done.
149 __ SubP(r2, Operand(1)); 150 __ SubP(r6, Operand(1));
150 __ blt(&done_loop); 151 __ blt(&done_loop);
151 152
152 // Load the next parameter tagged value into r2. 153 // Load the next parameter tagged value into r2.
153 __ ShiftLeftP(r1, r2, Operand(kPointerSizeLog2)); 154 __ ShiftLeftP(r1, r6, Operand(kPointerSizeLog2));
154 __ LoadP(r4, MemOperand(sp, r1)); 155 __ LoadP(r4, MemOperand(sp, r1));
155 156
156 // Load the double value of the parameter into d2, maybe converting the 157 // Load the double value of the parameter into d2, maybe converting the
157 // parameter to a number first using the ToNumber builtin if necessary. 158 // parameter to a number first using the ToNumber builtin if necessary.
158 Label convert, convert_smi, convert_number, done_convert; 159 Label convert, convert_smi, convert_number, done_convert;
159 __ bind(&convert); 160 __ bind(&convert);
160 __ JumpIfSmi(r4, &convert_smi); 161 __ JumpIfSmi(r4, &convert_smi);
161 __ LoadP(r5, FieldMemOperand(r4, HeapObject::kMapOffset)); 162 __ LoadP(r5, FieldMemOperand(r4, HeapObject::kMapOffset));
162 __ JumpIfRoot(r5, Heap::kHeapNumberMapRootIndex, &convert_number); 163 __ JumpIfRoot(r5, Heap::kHeapNumberMapRootIndex, &convert_number);
163 { 164 {
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 213
213 // At least one side is NaN, which means that the result will be NaN too. 214 // At least one side is NaN, which means that the result will be NaN too.
214 // We still need to visit the rest of the arguments. 215 // We still need to visit the rest of the arguments.
215 __ bind(&compare_nan); 216 __ bind(&compare_nan);
216 __ LoadRoot(r7, Heap::kNanValueRootIndex); 217 __ LoadRoot(r7, Heap::kNanValueRootIndex);
217 __ LoadDouble(d1, FieldMemOperand(r7, HeapNumber::kValueOffset)); 218 __ LoadDouble(d1, FieldMemOperand(r7, HeapNumber::kValueOffset));
218 __ b(&loop); 219 __ b(&loop);
219 } 220 }
220 221
221 __ bind(&done_loop); 222 __ bind(&done_loop);
223 // Drop all slots, including the receiver.
224 __ AddP(r2, Operand(1));
225 __ Drop(r2);
222 __ LoadRR(r2, r7); 226 __ LoadRR(r2, r7);
223 __ Drop(r6);
224 __ Ret(); 227 __ Ret();
225 } 228 }
226 229
227 // static 230 // static
228 void Builtins::Generate_NumberConstructor(MacroAssembler* masm) { 231 void Builtins::Generate_NumberConstructor(MacroAssembler* masm) {
229 // ----------- S t a t e ------------- 232 // ----------- S t a t e -------------
230 // -- r2 : number of arguments 233 // -- r2 : number of arguments
231 // -- r3 : constructor function 234 // -- r3 : constructor function
232 // -- lr : return address 235 // -- lr : return address
233 // -- sp[(argc - n - 1) * 4] : arg[n] (zero based) 236 // -- sp[(argc - n - 1) * 4] : arg[n] (zero based)
(...skipping 2725 matching lines...) Expand 10 before | Expand all | Expand 10 after
2959 __ bkpt(0); 2962 __ bkpt(0);
2960 } 2963 }
2961 } 2964 }
2962 2965
2963 #undef __ 2966 #undef __
2964 2967
2965 } // namespace internal 2968 } // namespace internal
2966 } // namespace v8 2969 } // namespace v8
2967 2970
2968 #endif // V8_TARGET_ARCH_S390 2971 #endif // V8_TARGET_ARCH_S390
OLDNEW
« no previous file with comments | « src/ppc/builtins-ppc.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698