Chromium Code Reviews

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

Issue 2087433003: PPC/s390: [builtins] Introduce a proper BUILTIN frame type. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: added fixes for ppc Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff |
« 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 97 matching lines...)
108 // tail call a stub 108 // tail call a stub
109 __ LoadRoot(r4, Heap::kUndefinedValueRootIndex); 109 __ LoadRoot(r4, Heap::kUndefinedValueRootIndex);
110 ArrayConstructorStub stub(masm->isolate()); 110 ArrayConstructorStub stub(masm->isolate());
111 __ TailCallStub(&stub); 111 __ TailCallStub(&stub);
112 } 112 }
113 113
114 // static 114 // static
115 void Builtins::Generate_MathMaxMin(MacroAssembler* masm, MathMaxMinKind kind) { 115 void Builtins::Generate_MathMaxMin(MacroAssembler* masm, MathMaxMinKind kind) {
116 // ----------- S t a t e ------------- 116 // ----------- S t a t e -------------
117 // -- r2 : number of arguments 117 // -- r2 : number of arguments
118 // -- r3 : function
119 // -- cp : context
118 // -- lr : return address 120 // -- lr : return address
119 // -- sp[(argc - n) * 8] : arg[n] (zero-based) 121 // -- sp[(argc - n) * 8] : arg[n] (zero-based)
120 // -- sp[(argc + 1) * 8] : receiver 122 // -- sp[(argc + 1) * 8] : receiver
121 // ----------------------------------- 123 // -----------------------------------
122 Condition const cond_done = (kind == MathMaxMinKind::kMin) ? lt : gt; 124 Condition const cond_done = (kind == MathMaxMinKind::kMin) ? lt : gt;
123 Heap::RootListIndex const root_index = 125 Heap::RootListIndex const root_index =
124 (kind == MathMaxMinKind::kMin) ? Heap::kInfinityValueRootIndex 126 (kind == MathMaxMinKind::kMin) ? Heap::kInfinityValueRootIndex
125 : Heap::kMinusInfinityValueRootIndex; 127 : Heap::kMinusInfinityValueRootIndex;
126 DoubleRegister const reg = (kind == MathMaxMinKind::kMin) ? d2 : d1; 128 DoubleRegister const reg = (kind == MathMaxMinKind::kMin) ? d2 : d1;
127 129
128 // Load the accumulator with the default return value (either -Infinity or 130 // Load the accumulator with the default return value (either -Infinity or
129 // +Infinity), with the tagged value in r3 and the double value in d1. 131 // +Infinity), with the tagged value in r7 and the double value in d1.
130 __ LoadRoot(r3, root_index); 132 __ LoadRoot(r7, root_index);
131 __ LoadDouble(d1, FieldMemOperand(r3, HeapNumber::kValueOffset)); 133 __ LoadDouble(d1, FieldMemOperand(r7, HeapNumber::kValueOffset));
132 134
133 // Setup state for loop 135 // Setup state for loop
134 // r4: address of arg[0] + kPointerSize 136 // r4: address of arg[0] + kPointerSize
135 // r5: number of slots to drop at exit (arguments + receiver) 137 // r5: number of slots to drop at exit (arguments + receiver)
136 __ ShiftLeftP(r4, r2, Operand(kPointerSizeLog2)); 138 __ AddP(r6, r2, Operand(1));
137 __ AddP(r4, sp, r4);
138 __ AddP(r5, r2, Operand(1));
139 139
140 Label done_loop, loop; 140 Label done_loop, loop;
141 __ bind(&loop); 141 __ bind(&loop);
142 { 142 {
143 // Check if all parameters done. 143 // Check if all parameters done.
144 __ CmpLogicalP(r4, sp); 144 __ SubP(r2, Operand(1));
145 __ ble(&done_loop); 145 __ blt(&done_loop);
146 146
147 // Load the next parameter tagged value into r2. 147 // Load the next parameter tagged value into r2.
148 __ lay(r4, MemOperand(r4, -kPointerSize)); 148 __ ShiftLeftP(r1, r2, Operand(kPointerSizeLog2));
149 __ LoadP(r2, MemOperand(r4)); 149 __ LoadP(r4, MemOperand(sp, r1));
150 150
151 // Load the double value of the parameter into d2, maybe converting the 151 // Load the double value of the parameter into d2, maybe converting the
152 // parameter to a number first using the ToNumber builtin if necessary. 152 // parameter to a number first using the ToNumber builtin if necessary.
153 Label convert, convert_smi, convert_number, done_convert; 153 Label convert, convert_smi, convert_number, done_convert;
154 __ bind(&convert); 154 __ bind(&convert);
155 __ JumpIfSmi(r2, &convert_smi); 155 __ JumpIfSmi(r4, &convert_smi);
156 __ LoadP(r6, FieldMemOperand(r2, HeapObject::kMapOffset)); 156 __ LoadP(r5, FieldMemOperand(r4, HeapObject::kMapOffset));
157 __ JumpIfRoot(r6, Heap::kHeapNumberMapRootIndex, &convert_number); 157 __ JumpIfRoot(r5, Heap::kHeapNumberMapRootIndex, &convert_number);
158 { 158 {
159 // Parameter is not a Number, use the ToNumber builtin to convert it. 159 // Parameter is not a Number, use the ToNumber builtin to convert it.
160 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); 160 DCHECK(!FLAG_enable_embedded_constant_pool);
161 __ SmiTag(r5); 161 FrameScope scope(masm, StackFrame::MANUAL);
162 __ Push(r3, r4, r5); 162 __ Push(r14, fp, cp, r3);
163 __ la(fp, MemOperand(sp, 2 * kPointerSize));
164 __ SmiTag(r2);
165 __ SmiTag(r6);
166 __ Push(r2, r6, r7);
167 __ LoadRR(r2, r4);
163 __ Call(masm->isolate()->builtins()->ToNumber(), RelocInfo::CODE_TARGET); 168 __ Call(masm->isolate()->builtins()->ToNumber(), RelocInfo::CODE_TARGET);
164 __ Pop(r3, r4, r5); 169 __ LoadRR(r4, r2);
165 __ SmiUntag(r5); 170 __ Pop(r2, r6, r7);
166 { 171 {
167 // Restore the double accumulator value (d1). 172 // Restore the double accumulator value (d1).
168 Label done_restore; 173 Label done_restore;
169 __ SmiToDouble(d1, r3); 174 __ SmiToDouble(d1, r7);
170 __ JumpIfSmi(r3, &done_restore); 175 __ JumpIfSmi(r7, &done_restore);
171 __ LoadDouble(d1, FieldMemOperand(r3, HeapNumber::kValueOffset)); 176 __ LoadDouble(d1, FieldMemOperand(r7, HeapNumber::kValueOffset));
172 __ bind(&done_restore); 177 __ bind(&done_restore);
173 } 178 }
179 __ SmiUntag(r6);
180 __ SmiUntag(r2);
181 __ Pop(r14, fp, cp, r3);
174 } 182 }
175 __ b(&convert); 183 __ b(&convert);
176 __ bind(&convert_number); 184 __ bind(&convert_number);
177 __ LoadDouble(d2, FieldMemOperand(r2, HeapNumber::kValueOffset)); 185 __ LoadDouble(d2, FieldMemOperand(r4, HeapNumber::kValueOffset));
178 __ b(&done_convert); 186 __ b(&done_convert);
179 __ bind(&convert_smi); 187 __ bind(&convert_smi);
180 __ SmiToDouble(d2, r2); 188 __ SmiToDouble(d2, r4);
181 __ bind(&done_convert); 189 __ bind(&done_convert);
182 190
183 // Perform the actual comparison with the accumulator value on the left hand 191 // Perform the actual comparison with the accumulator value on the left hand
184 // side (d1) and the next parameter value on the right hand side (d2). 192 // side (d1) and the next parameter value on the right hand side (d2).
185 Label compare_nan, compare_swap; 193 Label compare_nan, compare_swap;
186 __ cdbr(d1, d2); 194 __ cdbr(d1, d2);
187 __ bunordered(&compare_nan); 195 __ bunordered(&compare_nan);
188 __ b(cond_done, &loop); 196 __ b(cond_done, &loop);
189 __ b(CommuteCondition(cond_done), &compare_swap); 197 __ b(CommuteCondition(cond_done), &compare_swap);
190 198
191 // Left and right hand side are equal, check for -0 vs. +0. 199 // Left and right hand side are equal, check for -0 vs. +0.
192 __ TestDoubleIsMinusZero(reg, r6, r7); 200 __ TestDoubleIsMinusZero(reg, r1, r0);
193 __ bne(&loop); 201 __ bne(&loop);
194 202
195 // Update accumulator. Result is on the right hand side. 203 // Update accumulator. Result is on the right hand side.
196 __ bind(&compare_swap); 204 __ bind(&compare_swap);
197 __ ldr(d1, d2); 205 __ ldr(d1, d2);
198 __ LoadRR(r3, r2); 206 __ LoadRR(r7, r4);
199 __ b(&loop); 207 __ b(&loop);
200 208
201 // At least one side is NaN, which means that the result will be NaN too. 209 // At least one side is NaN, which means that the result will be NaN too.
202 // We still need to visit the rest of the arguments. 210 // We still need to visit the rest of the arguments.
203 __ bind(&compare_nan); 211 __ bind(&compare_nan);
204 __ LoadRoot(r3, Heap::kNanValueRootIndex); 212 __ LoadRoot(r7, Heap::kNanValueRootIndex);
205 __ LoadDouble(d1, FieldMemOperand(r3, HeapNumber::kValueOffset)); 213 __ LoadDouble(d1, FieldMemOperand(r7, HeapNumber::kValueOffset));
206 __ b(&loop); 214 __ b(&loop);
207 } 215 }
208 216
209 __ bind(&done_loop); 217 __ bind(&done_loop);
210 __ LoadRR(r2, r3); 218 __ LoadRR(r2, r7);
211 __ Drop(r5); 219 __ Drop(r6);
212 __ Ret(); 220 __ Ret();
213 } 221 }
214 222
215 // static 223 // static
216 void Builtins::Generate_NumberConstructor(MacroAssembler* masm) { 224 void Builtins::Generate_NumberConstructor(MacroAssembler* masm) {
217 // ----------- S t a t e ------------- 225 // ----------- S t a t e -------------
218 // -- r2 : number of arguments 226 // -- r2 : number of arguments
219 // -- r3 : constructor function 227 // -- r3 : constructor function
220 // -- lr : return address 228 // -- lr : return address
221 // -- sp[(argc - n - 1) * 4] : arg[n] (zero based) 229 // -- sp[(argc - n - 1) * 4] : arg[n] (zero based)
(...skipping 2662 matching lines...)
2884 __ bkpt(0); 2892 __ bkpt(0);
2885 } 2893 }
2886 } 2894 }
2887 2895
2888 #undef __ 2896 #undef __
2889 2897
2890 } // namespace internal 2898 } // namespace internal
2891 } // namespace v8 2899 } // namespace v8
2892 2900
2893 #endif // V8_TARGET_ARCH_S390 2901 #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