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 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 } | 206 } |
207 | 207 |
208 Label valid_result; | 208 Label valid_result; |
209 Label return_result; | 209 Label return_result; |
210 // If Invalid Operand or Zero Division exceptions are set, | 210 // If Invalid Operand or Zero Division exceptions are set, |
211 // return NaN. | 211 // return NaN. |
212 __ testb(rax, Immediate(5)); | 212 __ testb(rax, Immediate(5)); |
213 __ j(zero, &valid_result); | 213 __ j(zero, &valid_result); |
214 __ fstp(0); // Drop result in st(0). | 214 __ fstp(0); // Drop result in st(0). |
215 int64_t kNaNValue = V8_INT64_C(0x7ff8000000000000); | 215 int64_t kNaNValue = V8_INT64_C(0x7ff8000000000000); |
216 __ movq(rcx, kNaNValue); | 216 __ MoveInteger64(rcx, kNaNValue); |
217 __ movq(Operand(rsp, kPointerSize), rcx); | 217 __ movq(Operand(rsp, kPointerSize), rcx); |
218 __ movsd(xmm0, Operand(rsp, kPointerSize)); | 218 __ movsd(xmm0, Operand(rsp, kPointerSize)); |
219 __ jmp(&return_result); | 219 __ jmp(&return_result); |
220 | 220 |
221 // If result is valid, return that. | 221 // If result is valid, return that. |
222 __ bind(&valid_result); | 222 __ bind(&valid_result); |
223 __ fstp_d(Operand(rsp, kPointerSize)); | 223 __ fstp_d(Operand(rsp, kPointerSize)); |
224 __ movsd(xmm0, Operand(rsp, kPointerSize)); | 224 __ movsd(xmm0, Operand(rsp, kPointerSize)); |
225 | 225 |
226 // Clean up FPU stack and exceptions and return xmm0 | 226 // Clean up FPU stack and exceptions and return xmm0 |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
331 kDontSaveFPRegs, | 331 kDontSaveFPRegs, |
332 EMIT_REMEMBERED_SET, | 332 EMIT_REMEMBERED_SET, |
333 OMIT_SMI_CHECK); | 333 OMIT_SMI_CHECK); |
334 | 334 |
335 // Convert smis to doubles and holes to hole NaNs. The Array's length | 335 // Convert smis to doubles and holes to hole NaNs. The Array's length |
336 // remains unchanged. | 336 // remains unchanged. |
337 STATIC_ASSERT(FixedDoubleArray::kLengthOffset == FixedArray::kLengthOffset); | 337 STATIC_ASSERT(FixedDoubleArray::kLengthOffset == FixedArray::kLengthOffset); |
338 STATIC_ASSERT(FixedDoubleArray::kHeaderSize == FixedArray::kHeaderSize); | 338 STATIC_ASSERT(FixedDoubleArray::kHeaderSize == FixedArray::kHeaderSize); |
339 | 339 |
340 Label loop, entry, convert_hole; | 340 Label loop, entry, convert_hole; |
341 __ movq(r15, BitCast<int64_t, uint64_t>(kHoleNanInt64)); | 341 __ MoveInteger64(r15, BitCast<int64_t, uint64_t>(kHoleNanInt64)); |
342 // r15: the-hole NaN | 342 // r15: the-hole NaN |
343 __ jmp(&entry); | 343 __ jmp(&entry); |
344 | 344 |
345 // Allocate new backing store. | 345 // Allocate new backing store. |
346 __ bind(&new_backing_store); | 346 __ bind(&new_backing_store); |
347 __ lea(rdi, Operand(r9, times_8, FixedArray::kHeaderSize)); | 347 __ lea(rdi, Operand(r9, times_8, FixedArray::kHeaderSize)); |
348 __ Allocate(rdi, r14, r11, r15, fail, TAG_OBJECT); | 348 __ Allocate(rdi, r14, r11, r15, fail, TAG_OBJECT); |
349 // Set backing store's map | 349 // Set backing store's map |
350 __ LoadRoot(rdi, Heap::kFixedDoubleArrayMapRootIndex); | 350 __ LoadRoot(rdi, Heap::kFixedDoubleArrayMapRootIndex); |
351 __ movq(FieldOperand(r14, HeapObject::kMapOffset), rdi); | 351 __ movq(FieldOperand(r14, HeapObject::kMapOffset), rdi); |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
433 // r9 : number of elements | 433 // r9 : number of elements |
434 __ lea(rdi, Operand(r9, times_pointer_size, FixedArray::kHeaderSize)); | 434 __ lea(rdi, Operand(r9, times_pointer_size, FixedArray::kHeaderSize)); |
435 __ Allocate(rdi, r11, r14, r15, &gc_required, TAG_OBJECT); | 435 __ Allocate(rdi, r11, r14, r15, &gc_required, TAG_OBJECT); |
436 // r11: destination FixedArray | 436 // r11: destination FixedArray |
437 __ LoadRoot(rdi, Heap::kFixedArrayMapRootIndex); | 437 __ LoadRoot(rdi, Heap::kFixedArrayMapRootIndex); |
438 __ movq(FieldOperand(r11, HeapObject::kMapOffset), rdi); | 438 __ movq(FieldOperand(r11, HeapObject::kMapOffset), rdi); |
439 __ Integer32ToSmi(r14, r9); | 439 __ Integer32ToSmi(r14, r9); |
440 __ movq(FieldOperand(r11, FixedArray::kLengthOffset), r14); | 440 __ movq(FieldOperand(r11, FixedArray::kLengthOffset), r14); |
441 | 441 |
442 // Prepare for conversion loop. | 442 // Prepare for conversion loop. |
443 __ movq(rsi, BitCast<int64_t, uint64_t>(kHoleNanInt64)); | 443 __ MoveInteger64(rsi, BitCast<int64_t, uint64_t>(kHoleNanInt64)); |
444 __ LoadRoot(rdi, Heap::kTheHoleValueRootIndex); | 444 __ LoadRoot(rdi, Heap::kTheHoleValueRootIndex); |
445 // rsi: the-hole NaN | 445 // rsi: the-hole NaN |
446 // rdi: pointer to the-hole | 446 // rdi: pointer to the-hole |
447 __ jmp(&entry); | 447 __ jmp(&entry); |
448 | 448 |
449 // Call into runtime if GC is required. | 449 // Call into runtime if GC is required. |
450 __ bind(&gc_required); | 450 __ bind(&gc_required); |
451 __ pop(rax); | 451 __ pop(rax); |
452 __ movq(rsi, Operand(rbp, StandardFrameConstants::kContextOffset)); | 452 __ movq(rsi, Operand(rbp, StandardFrameConstants::kContextOffset)); |
453 __ jmp(fail); | 453 __ jmp(fail); |
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
754 // argument_count_reg_ * times_pointer_size + (receiver - 1) * kPointerSize. | 754 // argument_count_reg_ * times_pointer_size + (receiver - 1) * kPointerSize. |
755 return Operand(base_reg_, argument_count_reg_, times_pointer_size, | 755 return Operand(base_reg_, argument_count_reg_, times_pointer_size, |
756 displacement_to_last_argument + (receiver - 1 - index) * kPointerSize); | 756 displacement_to_last_argument + (receiver - 1 - index) * kPointerSize); |
757 } | 757 } |
758 } | 758 } |
759 | 759 |
760 | 760 |
761 } } // namespace v8::internal | 761 } } // namespace v8::internal |
762 | 762 |
763 #endif // V8_TARGET_ARCH_X64 | 763 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |