OLD | NEW |
---|---|
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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_MIPS | 5 #if V8_TARGET_ARCH_MIPS |
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 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
121 __ mov(a3, a1); | 121 __ mov(a3, a1); |
122 __ LoadRoot(a2, Heap::kUndefinedValueRootIndex); | 122 __ LoadRoot(a2, Heap::kUndefinedValueRootIndex); |
123 ArrayConstructorStub stub(masm->isolate()); | 123 ArrayConstructorStub stub(masm->isolate()); |
124 __ TailCallStub(&stub); | 124 __ TailCallStub(&stub); |
125 } | 125 } |
126 | 126 |
127 | 127 |
128 // static | 128 // static |
129 void Builtins::Generate_MathMaxMin(MacroAssembler* masm, MathMaxMinKind kind) { | 129 void Builtins::Generate_MathMaxMin(MacroAssembler* masm, MathMaxMinKind kind) { |
130 // ----------- S t a t e ------------- | 130 // ----------- S t a t e ------------- |
131 // -- a0 : number of arguments | 131 // -- a0 : number of arguments |
132 // -- a1 : function | 132 // -- a1 : function |
133 // -- cp : context | 133 // -- cp : context |
134 // -- ra : return address | 134 // -- ra : return address |
135 // -- sp[(argc - n) * 8] : arg[n] (zero-based) | 135 // -- sp[(argc - n - 1) * 4] : arg[n] (zero-based) |
136 // -- sp[(argc + 1) * 8] : receiver | 136 // -- sp[argc * 4] : receiver |
137 // ----------------------------------- | 137 // ----------------------------------- |
138 Heap::RootListIndex const root_index = | 138 Heap::RootListIndex const root_index = |
139 (kind == MathMaxMinKind::kMin) ? Heap::kInfinityValueRootIndex | 139 (kind == MathMaxMinKind::kMin) ? Heap::kInfinityValueRootIndex |
140 : Heap::kMinusInfinityValueRootIndex; | 140 : Heap::kMinusInfinityValueRootIndex; |
141 | 141 |
142 // Load the accumulator with the default return value (either -Infinity or | 142 // Load the accumulator with the default return value (either -Infinity or |
143 // +Infinity), with the tagged value in t2 and the double value in f0. | 143 // +Infinity), with the tagged value in t2 and the double value in f0. |
144 __ LoadRoot(t2, root_index); | 144 __ LoadRoot(t2, root_index); |
145 __ ldc1(f0, FieldMemOperand(t2, HeapNumber::kValueOffset)); | 145 __ ldc1(f0, FieldMemOperand(t2, HeapNumber::kValueOffset)); |
146 __ Addu(a3, a0, Operand(1)); | |
147 | 146 |
148 Label done_loop, loop; | 147 Label done_loop, loop; |
148 __ mov(a3, a0); | |
149 __ bind(&loop); | 149 __ bind(&loop); |
150 { | 150 { |
151 // Check if all parameters done. | 151 // Check if all parameters done. |
152 __ Subu(a0, a0, Operand(1)); | 152 __ Subu(a3, a3, Operand(1)); |
153 __ Branch(&done_loop, lt, a0, Operand(zero_reg)); | 153 __ Branch(&done_loop, lt, a3, Operand(zero_reg)); |
ivica.bogosavljevic
2016/07/01 12:40:50
You could fill delay slot here, the next instructi
balazs.kilvady
2016/07/01 13:17:25
Since we support r6 I try to avoid delay slot usag
| |
154 | 154 |
155 // Load the next parameter tagged value into a2. | 155 // Load the next parameter tagged value into a2. |
156 __ Lsa(at, sp, a0, kPointerSizeLog2); | 156 __ Lsa(at, sp, a3, kPointerSizeLog2); |
157 __ lw(a2, MemOperand(at)); | 157 __ lw(a2, MemOperand(at)); |
158 | 158 |
159 // Load the double value of the parameter into f2, maybe converting the | 159 // Load the double value of the parameter into f2, maybe converting the |
160 // parameter to a number first using the ToNumber builtin if necessary. | 160 // parameter to a number first using the ToNumber builtin if necessary. |
161 Label convert, convert_smi, convert_number, done_convert; | 161 Label convert, convert_smi, convert_number, done_convert; |
162 __ bind(&convert); | 162 __ bind(&convert); |
163 __ JumpIfSmi(a2, &convert_smi); | 163 __ JumpIfSmi(a2, &convert_smi); |
164 __ lw(t0, FieldMemOperand(a2, HeapObject::kMapOffset)); | 164 __ lw(t0, FieldMemOperand(a2, HeapObject::kMapOffset)); |
165 __ JumpIfRoot(t0, Heap::kHeapNumberMapRootIndex, &convert_number); | 165 __ JumpIfRoot(t0, Heap::kHeapNumberMapRootIndex, &convert_number); |
166 { | 166 { |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
221 __ jmp(&loop); | 221 __ jmp(&loop); |
222 | 222 |
223 // At least one side is NaN, which means that the result will be NaN too. | 223 // At least one side is NaN, which means that the result will be NaN too. |
224 __ bind(&compare_nan); | 224 __ bind(&compare_nan); |
225 __ LoadRoot(t2, Heap::kNanValueRootIndex); | 225 __ LoadRoot(t2, Heap::kNanValueRootIndex); |
226 __ ldc1(f0, FieldMemOperand(t2, HeapNumber::kValueOffset)); | 226 __ ldc1(f0, FieldMemOperand(t2, HeapNumber::kValueOffset)); |
227 __ jmp(&loop); | 227 __ jmp(&loop); |
228 } | 228 } |
229 | 229 |
230 __ bind(&done_loop); | 230 __ bind(&done_loop); |
231 __ Lsa(sp, sp, a3, kPointerSizeLog2); | 231 // Drop all slots, including the receiver. |
232 __ Addu(a0, a0, Operand(1)); | |
233 __ Lsa(sp, sp, a0, kPointerSizeLog2); | |
232 __ Ret(USE_DELAY_SLOT); | 234 __ Ret(USE_DELAY_SLOT); |
233 __ mov(v0, t2); // In delay slot. | 235 __ mov(v0, t2); // In delay slot. |
234 } | 236 } |
235 | 237 |
236 // static | 238 // static |
237 void Builtins::Generate_NumberConstructor(MacroAssembler* masm) { | 239 void Builtins::Generate_NumberConstructor(MacroAssembler* masm) { |
238 // ----------- S t a t e ------------- | 240 // ----------- S t a t e ------------- |
239 // -- a0 : number of arguments | 241 // -- a0 : number of arguments |
240 // -- a1 : constructor function | 242 // -- a1 : constructor function |
241 // -- ra : return address | 243 // -- ra : return address |
(...skipping 2766 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3008 } | 3010 } |
3009 } | 3011 } |
3010 | 3012 |
3011 | 3013 |
3012 #undef __ | 3014 #undef __ |
3013 | 3015 |
3014 } // namespace internal | 3016 } // namespace internal |
3015 } // namespace v8 | 3017 } // namespace v8 |
3016 | 3018 |
3017 #endif // V8_TARGET_ARCH_MIPS | 3019 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |