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 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 } | 205 } |
206 | 206 |
207 Label valid_result; | 207 Label valid_result; |
208 Label return_result; | 208 Label return_result; |
209 // If Invalid Operand or Zero Division exceptions are set, | 209 // If Invalid Operand or Zero Division exceptions are set, |
210 // return NaN. | 210 // return NaN. |
211 __ testb(rax, Immediate(5)); | 211 __ testb(rax, Immediate(5)); |
212 __ j(zero, &valid_result); | 212 __ j(zero, &valid_result); |
213 __ fstp(0); // Drop result in st(0). | 213 __ fstp(0); // Drop result in st(0). |
214 int64_t kNaNValue = V8_INT64_C(0x7ff8000000000000); | 214 int64_t kNaNValue = V8_INT64_C(0x7ff8000000000000); |
215 __ movq(rcx, kNaNValue, RelocInfo::NONE); | 215 __ movq(rcx, kNaNValue, RelocInfo::NONE64); |
216 __ movq(Operand(rsp, kPointerSize), rcx); | 216 __ movq(Operand(rsp, kPointerSize), rcx); |
217 __ movsd(xmm0, Operand(rsp, kPointerSize)); | 217 __ movsd(xmm0, Operand(rsp, kPointerSize)); |
218 __ jmp(&return_result); | 218 __ jmp(&return_result); |
219 | 219 |
220 // If result is valid, return that. | 220 // If result is valid, return that. |
221 __ bind(&valid_result); | 221 __ bind(&valid_result); |
222 __ fstp_d(Operand(rsp, kPointerSize)); | 222 __ fstp_d(Operand(rsp, kPointerSize)); |
223 __ movsd(xmm0, Operand(rsp, kPointerSize)); | 223 __ movsd(xmm0, Operand(rsp, kPointerSize)); |
224 | 224 |
225 // Clean up FPU stack and exceptions and return xmm0 | 225 // Clean up FPU stack and exceptions and return xmm0 |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
320 kDontSaveFPRegs, | 320 kDontSaveFPRegs, |
321 EMIT_REMEMBERED_SET, | 321 EMIT_REMEMBERED_SET, |
322 OMIT_SMI_CHECK); | 322 OMIT_SMI_CHECK); |
323 | 323 |
324 // Convert smis to doubles and holes to hole NaNs. The Array's length | 324 // Convert smis to doubles and holes to hole NaNs. The Array's length |
325 // remains unchanged. | 325 // remains unchanged. |
326 STATIC_ASSERT(FixedDoubleArray::kLengthOffset == FixedArray::kLengthOffset); | 326 STATIC_ASSERT(FixedDoubleArray::kLengthOffset == FixedArray::kLengthOffset); |
327 STATIC_ASSERT(FixedDoubleArray::kHeaderSize == FixedArray::kHeaderSize); | 327 STATIC_ASSERT(FixedDoubleArray::kHeaderSize == FixedArray::kHeaderSize); |
328 | 328 |
329 Label loop, entry, convert_hole; | 329 Label loop, entry, convert_hole; |
330 __ movq(r15, BitCast<int64_t, uint64_t>(kHoleNanInt64), RelocInfo::NONE); | 330 __ movq(r15, BitCast<int64_t, uint64_t>(kHoleNanInt64), RelocInfo::NONE64); |
331 // r15: the-hole NaN | 331 // r15: the-hole NaN |
332 __ jmp(&entry); | 332 __ jmp(&entry); |
333 | 333 |
334 // Allocate new backing store. | 334 // Allocate new backing store. |
335 __ bind(&new_backing_store); | 335 __ bind(&new_backing_store); |
336 __ lea(rdi, Operand(r9, times_pointer_size, FixedArray::kHeaderSize)); | 336 __ lea(rdi, Operand(r9, times_pointer_size, FixedArray::kHeaderSize)); |
337 __ AllocateInNewSpace(rdi, r14, r11, r15, fail, TAG_OBJECT); | 337 __ AllocateInNewSpace(rdi, r14, r11, r15, fail, TAG_OBJECT); |
338 // Set backing store's map | 338 // Set backing store's map |
339 __ LoadRoot(rdi, Heap::kFixedDoubleArrayMapRootIndex); | 339 __ LoadRoot(rdi, Heap::kFixedDoubleArrayMapRootIndex); |
340 __ movq(FieldOperand(r14, HeapObject::kMapOffset), rdi); | 340 __ movq(FieldOperand(r14, HeapObject::kMapOffset), rdi); |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
418 // r9 : number of elements | 418 // r9 : number of elements |
419 __ lea(rdi, Operand(r9, times_pointer_size, FixedArray::kHeaderSize)); | 419 __ lea(rdi, Operand(r9, times_pointer_size, FixedArray::kHeaderSize)); |
420 __ AllocateInNewSpace(rdi, r11, r14, r15, &gc_required, TAG_OBJECT); | 420 __ AllocateInNewSpace(rdi, r11, r14, r15, &gc_required, TAG_OBJECT); |
421 // r11: destination FixedArray | 421 // r11: destination FixedArray |
422 __ LoadRoot(rdi, Heap::kFixedArrayMapRootIndex); | 422 __ LoadRoot(rdi, Heap::kFixedArrayMapRootIndex); |
423 __ movq(FieldOperand(r11, HeapObject::kMapOffset), rdi); | 423 __ movq(FieldOperand(r11, HeapObject::kMapOffset), rdi); |
424 __ Integer32ToSmi(r14, r9); | 424 __ Integer32ToSmi(r14, r9); |
425 __ movq(FieldOperand(r11, FixedArray::kLengthOffset), r14); | 425 __ movq(FieldOperand(r11, FixedArray::kLengthOffset), r14); |
426 | 426 |
427 // Prepare for conversion loop. | 427 // Prepare for conversion loop. |
428 __ movq(rsi, BitCast<int64_t, uint64_t>(kHoleNanInt64), RelocInfo::NONE); | 428 __ movq(rsi, BitCast<int64_t, uint64_t>(kHoleNanInt64), RelocInfo::NONE64); |
429 __ LoadRoot(rdi, Heap::kTheHoleValueRootIndex); | 429 __ LoadRoot(rdi, Heap::kTheHoleValueRootIndex); |
430 // rsi: the-hole NaN | 430 // rsi: the-hole NaN |
431 // rdi: pointer to the-hole | 431 // rdi: pointer to the-hole |
432 __ jmp(&entry); | 432 __ jmp(&entry); |
433 | 433 |
434 // Call into runtime if GC is required. | 434 // Call into runtime if GC is required. |
435 __ bind(&gc_required); | 435 __ bind(&gc_required); |
436 __ pop(rax); | 436 __ pop(rax); |
437 __ movq(rsi, Operand(rbp, StandardFrameConstants::kContextOffset)); | 437 __ movq(rsi, Operand(rbp, StandardFrameConstants::kContextOffset)); |
438 __ jmp(fail); | 438 __ jmp(fail); |
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
758 CodePatcher patcher(sequence, young_length); | 758 CodePatcher patcher(sequence, young_length); |
759 patcher.masm()->call(stub->instruction_start()); | 759 patcher.masm()->call(stub->instruction_start()); |
760 patcher.masm()->nop(); | 760 patcher.masm()->nop(); |
761 } | 761 } |
762 } | 762 } |
763 | 763 |
764 | 764 |
765 } } // namespace v8::internal | 765 } } // namespace v8::internal |
766 | 766 |
767 #endif // V8_TARGET_ARCH_X64 | 767 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |