| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 #if defined(USE_SIMULATOR) | 55 #if defined(USE_SIMULATOR) |
| 56 byte* fast_exp_mips_machine_code = NULL; | 56 byte* fast_exp_mips_machine_code = NULL; |
| 57 double fast_exp_simulator(double x) { | 57 double fast_exp_simulator(double x) { |
| 58 return Simulator::current(Isolate::Current())->CallFP( | 58 return Simulator::current(Isolate::Current())->CallFP( |
| 59 fast_exp_mips_machine_code, x, 0); | 59 fast_exp_mips_machine_code, x, 0); |
| 60 } | 60 } |
| 61 #endif | 61 #endif |
| 62 | 62 |
| 63 | 63 |
| 64 UnaryMathFunction CreateExpFunction() { | 64 UnaryMathFunction CreateExpFunction() { |
| 65 if (!CpuFeatures::IsSupported(FPU)) return &exp; | |
| 66 if (!FLAG_fast_math) return &exp; | 65 if (!FLAG_fast_math) return &exp; |
| 67 size_t actual_size; | 66 size_t actual_size; |
| 68 byte* buffer = static_cast<byte*>(OS::Allocate(1 * KB, &actual_size, true)); | 67 byte* buffer = static_cast<byte*>(OS::Allocate(1 * KB, &actual_size, true)); |
| 69 if (buffer == NULL) return &exp; | 68 if (buffer == NULL) return &exp; |
| 70 ExternalReference::InitializeMathExpData(); | 69 ExternalReference::InitializeMathExpData(); |
| 71 | 70 |
| 72 MacroAssembler masm(NULL, buffer, static_cast<int>(actual_size)); | 71 MacroAssembler masm(NULL, buffer, static_cast<int>(actual_size)); |
| 73 | 72 |
| 74 { | 73 { |
| 75 CpuFeatureScope use_fpu(&masm, FPU); | |
| 76 DoubleRegister input = f12; | 74 DoubleRegister input = f12; |
| 77 DoubleRegister result = f0; | 75 DoubleRegister result = f0; |
| 78 DoubleRegister double_scratch1 = f4; | 76 DoubleRegister double_scratch1 = f4; |
| 79 DoubleRegister double_scratch2 = f6; | 77 DoubleRegister double_scratch2 = f6; |
| 80 Register temp1 = t0; | 78 Register temp1 = t0; |
| 81 Register temp2 = t1; | 79 Register temp2 = t1; |
| 82 Register temp3 = t2; | 80 Register temp3 = t2; |
| 83 | 81 |
| 84 if (!IsMipsSoftFloatABI) { | 82 if (!IsMipsSoftFloatABI) { |
| 85 // Input value is in f12 anyway, nothing to do. | 83 // Input value is in f12 anyway, nothing to do. |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 MacroAssembler* masm, AllocationSiteMode mode, Label* fail) { | 175 MacroAssembler* masm, AllocationSiteMode mode, Label* fail) { |
| 178 // ----------- S t a t e ------------- | 176 // ----------- S t a t e ------------- |
| 179 // -- a0 : value | 177 // -- a0 : value |
| 180 // -- a1 : key | 178 // -- a1 : key |
| 181 // -- a2 : receiver | 179 // -- a2 : receiver |
| 182 // -- ra : return address | 180 // -- ra : return address |
| 183 // -- a3 : target map, scratch for subsequent call | 181 // -- a3 : target map, scratch for subsequent call |
| 184 // -- t0 : scratch (elements) | 182 // -- t0 : scratch (elements) |
| 185 // ----------------------------------- | 183 // ----------------------------------- |
| 186 Label loop, entry, convert_hole, gc_required, only_change_map, done; | 184 Label loop, entry, convert_hole, gc_required, only_change_map, done; |
| 187 bool fpu_supported = CpuFeatures::IsSupported(FPU); | |
| 188 | 185 |
| 189 Register scratch = t6; | 186 Register scratch = t6; |
| 190 | 187 |
| 191 if (mode == TRACK_ALLOCATION_SITE) { | 188 if (mode == TRACK_ALLOCATION_SITE) { |
| 192 masm->TestJSArrayForAllocationSiteInfo(a2, t0, eq, fail); | 189 masm->TestJSArrayForAllocationSiteInfo(a2, t0, eq, fail); |
| 193 } | 190 } |
| 194 | 191 |
| 195 // Check for empty arrays, which only require a map transition and no changes | 192 // Check for empty arrays, which only require a map transition and no changes |
| 196 // to the backing store. | 193 // to the backing store. |
| 197 __ lw(t0, FieldMemOperand(a2, JSObject::kElementsOffset)); | 194 __ lw(t0, FieldMemOperand(a2, JSObject::kElementsOffset)); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 242 __ Addu(t3, t2, Operand(FixedDoubleArray::kHeaderSize)); | 239 __ Addu(t3, t2, Operand(FixedDoubleArray::kHeaderSize)); |
| 243 __ sll(t2, t1, 2); | 240 __ sll(t2, t1, 2); |
| 244 __ Addu(t2, t2, t3); | 241 __ Addu(t2, t2, t3); |
| 245 __ li(t0, Operand(kHoleNanLower32)); | 242 __ li(t0, Operand(kHoleNanLower32)); |
| 246 __ li(t1, Operand(kHoleNanUpper32)); | 243 __ li(t1, Operand(kHoleNanUpper32)); |
| 247 // t0: kHoleNanLower32 | 244 // t0: kHoleNanLower32 |
| 248 // t1: kHoleNanUpper32 | 245 // t1: kHoleNanUpper32 |
| 249 // t2: end of destination FixedDoubleArray, not tagged | 246 // t2: end of destination FixedDoubleArray, not tagged |
| 250 // t3: begin of FixedDoubleArray element fields, not tagged | 247 // t3: begin of FixedDoubleArray element fields, not tagged |
| 251 | 248 |
| 252 if (!fpu_supported) __ Push(a1, a0); | |
| 253 | |
| 254 __ Branch(&entry); | 249 __ Branch(&entry); |
| 255 | 250 |
| 256 __ bind(&only_change_map); | 251 __ bind(&only_change_map); |
| 257 __ sw(a3, FieldMemOperand(a2, HeapObject::kMapOffset)); | 252 __ sw(a3, FieldMemOperand(a2, HeapObject::kMapOffset)); |
| 258 __ RecordWriteField(a2, | 253 __ RecordWriteField(a2, |
| 259 HeapObject::kMapOffset, | 254 HeapObject::kMapOffset, |
| 260 a3, | 255 a3, |
| 261 t5, | 256 t5, |
| 262 kRAHasNotBeenSaved, | 257 kRAHasNotBeenSaved, |
| 263 kDontSaveFPRegs, | 258 kDontSaveFPRegs, |
| 264 OMIT_REMEMBERED_SET, | 259 OMIT_REMEMBERED_SET, |
| 265 OMIT_SMI_CHECK); | 260 OMIT_SMI_CHECK); |
| 266 __ Branch(&done); | 261 __ Branch(&done); |
| 267 | 262 |
| 268 // Call into runtime if GC is required. | 263 // Call into runtime if GC is required. |
| 269 __ bind(&gc_required); | 264 __ bind(&gc_required); |
| 270 __ pop(ra); | 265 __ pop(ra); |
| 271 __ Branch(fail); | 266 __ Branch(fail); |
| 272 | 267 |
| 273 // Convert and copy elements. | 268 // Convert and copy elements. |
| 274 __ bind(&loop); | 269 __ bind(&loop); |
| 275 __ lw(t5, MemOperand(a3)); | 270 __ lw(t5, MemOperand(a3)); |
| 276 __ Addu(a3, a3, kIntSize); | 271 __ Addu(a3, a3, kIntSize); |
| 277 // t5: current element | 272 // t5: current element |
| 278 __ UntagAndJumpIfNotSmi(t5, t5, &convert_hole); | 273 __ UntagAndJumpIfNotSmi(t5, t5, &convert_hole); |
| 279 | 274 |
| 280 // Normal smi, convert to double and store. | 275 // Normal smi, convert to double and store. |
| 281 if (fpu_supported) { | 276 __ mtc1(t5, f0); |
| 282 CpuFeatureScope scope(masm, FPU); | 277 __ cvt_d_w(f0, f0); |
| 283 __ mtc1(t5, f0); | 278 __ sdc1(f0, MemOperand(t3)); |
| 284 __ cvt_d_w(f0, f0); | 279 __ Addu(t3, t3, kDoubleSize); |
| 285 __ sdc1(f0, MemOperand(t3)); | 280 |
| 286 __ Addu(t3, t3, kDoubleSize); | |
| 287 } else { | |
| 288 FloatingPointHelper::ConvertIntToDouble(masm, | |
| 289 t5, | |
| 290 FloatingPointHelper::kCoreRegisters, | |
| 291 f0, | |
| 292 a0, | |
| 293 a1, | |
| 294 t7, | |
| 295 f0); | |
| 296 __ sw(a0, MemOperand(t3)); // mantissa | |
| 297 __ sw(a1, MemOperand(t3, kIntSize)); // exponent | |
| 298 __ Addu(t3, t3, kDoubleSize); | |
| 299 } | |
| 300 __ Branch(&entry); | 281 __ Branch(&entry); |
| 301 | 282 |
| 302 // Hole found, store the-hole NaN. | 283 // Hole found, store the-hole NaN. |
| 303 __ bind(&convert_hole); | 284 __ bind(&convert_hole); |
| 304 if (FLAG_debug_code) { | 285 if (FLAG_debug_code) { |
| 305 // Restore a "smi-untagged" heap object. | 286 // Restore a "smi-untagged" heap object. |
| 306 __ SmiTag(t5); | 287 __ SmiTag(t5); |
| 307 __ Or(t5, t5, Operand(1)); | 288 __ Or(t5, t5, Operand(1)); |
| 308 __ LoadRoot(at, Heap::kTheHoleValueRootIndex); | 289 __ LoadRoot(at, Heap::kTheHoleValueRootIndex); |
| 309 __ Assert(eq, "object found in smi-only array", at, Operand(t5)); | 290 __ Assert(eq, "object found in smi-only array", at, Operand(t5)); |
| 310 } | 291 } |
| 311 __ sw(t0, MemOperand(t3)); // mantissa | 292 __ sw(t0, MemOperand(t3)); // mantissa |
| 312 __ sw(t1, MemOperand(t3, kIntSize)); // exponent | 293 __ sw(t1, MemOperand(t3, kIntSize)); // exponent |
| 313 __ Addu(t3, t3, kDoubleSize); | 294 __ Addu(t3, t3, kDoubleSize); |
| 314 | 295 |
| 315 __ bind(&entry); | 296 __ bind(&entry); |
| 316 __ Branch(&loop, lt, t3, Operand(t2)); | 297 __ Branch(&loop, lt, t3, Operand(t2)); |
| 317 | 298 |
| 318 if (!fpu_supported) __ Pop(a1, a0); | |
| 319 __ pop(ra); | 299 __ pop(ra); |
| 320 __ bind(&done); | 300 __ bind(&done); |
| 321 } | 301 } |
| 322 | 302 |
| 323 | 303 |
| 324 void ElementsTransitionGenerator::GenerateDoubleToObject( | 304 void ElementsTransitionGenerator::GenerateDoubleToObject( |
| 325 MacroAssembler* masm, AllocationSiteMode mode, Label* fail) { | 305 MacroAssembler* masm, AllocationSiteMode mode, Label* fail) { |
| 326 // ----------- S t a t e ------------- | 306 // ----------- S t a t e ------------- |
| 327 // -- a0 : value | 307 // -- a0 : value |
| 328 // -- a1 : key | 308 // -- a1 : key |
| (...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 721 patcher.masm()->dd(reinterpret_cast<uint32_t>(stub->instruction_start())); | 701 patcher.masm()->dd(reinterpret_cast<uint32_t>(stub->instruction_start())); |
| 722 } | 702 } |
| 723 } | 703 } |
| 724 | 704 |
| 725 | 705 |
| 726 #undef __ | 706 #undef __ |
| 727 | 707 |
| 728 } } // namespace v8::internal | 708 } } // namespace v8::internal |
| 729 | 709 |
| 730 #endif // V8_TARGET_ARCH_MIPS | 710 #endif // V8_TARGET_ARCH_MIPS |
| OLD | NEW |