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 2756 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2767 Immediate(Map::kMaximumBitField2FastHoleySmiElementValue)); | 2767 Immediate(Map::kMaximumBitField2FastHoleySmiElementValue)); |
2768 j(above, fail, distance); | 2768 j(above, fail, distance); |
2769 } | 2769 } |
2770 | 2770 |
2771 | 2771 |
2772 void MacroAssembler::StoreNumberToDoubleElements( | 2772 void MacroAssembler::StoreNumberToDoubleElements( |
2773 Register maybe_number, | 2773 Register maybe_number, |
2774 Register elements, | 2774 Register elements, |
2775 Register index, | 2775 Register index, |
2776 XMMRegister xmm_scratch, | 2776 XMMRegister xmm_scratch, |
2777 Label* fail) { | 2777 Label* fail, |
| 2778 int elements_offset) { |
2778 Label smi_value, is_nan, maybe_nan, not_nan, have_double_value, done; | 2779 Label smi_value, is_nan, maybe_nan, not_nan, have_double_value, done; |
2779 | 2780 |
2780 JumpIfSmi(maybe_number, &smi_value, Label::kNear); | 2781 JumpIfSmi(maybe_number, &smi_value, Label::kNear); |
2781 | 2782 |
2782 CheckMap(maybe_number, | 2783 CheckMap(maybe_number, |
2783 isolate()->factory()->heap_number_map(), | 2784 isolate()->factory()->heap_number_map(), |
2784 fail, | 2785 fail, |
2785 DONT_DO_SMI_CHECK); | 2786 DONT_DO_SMI_CHECK); |
2786 | 2787 |
2787 // Double value, canonicalize NaN. | 2788 // Double value, canonicalize NaN. |
2788 uint32_t offset = HeapNumber::kValueOffset + sizeof(kHoleNanLower32); | 2789 uint32_t offset = HeapNumber::kValueOffset + sizeof(kHoleNanLower32); |
2789 cmpl(FieldOperand(maybe_number, offset), | 2790 cmpl(FieldOperand(maybe_number, offset), |
2790 Immediate(kNaNOrInfinityLowerBoundUpper32)); | 2791 Immediate(kNaNOrInfinityLowerBoundUpper32)); |
2791 j(greater_equal, &maybe_nan, Label::kNear); | 2792 j(greater_equal, &maybe_nan, Label::kNear); |
2792 | 2793 |
2793 bind(¬_nan); | 2794 bind(¬_nan); |
2794 movsd(xmm_scratch, FieldOperand(maybe_number, HeapNumber::kValueOffset)); | 2795 movsd(xmm_scratch, FieldOperand(maybe_number, HeapNumber::kValueOffset)); |
2795 bind(&have_double_value); | 2796 bind(&have_double_value); |
2796 movsd(FieldOperand(elements, index, times_8, FixedDoubleArray::kHeaderSize), | 2797 movsd(FieldOperand(elements, index, times_8, |
| 2798 FixedDoubleArray::kHeaderSize - elements_offset), |
2797 xmm_scratch); | 2799 xmm_scratch); |
2798 jmp(&done); | 2800 jmp(&done); |
2799 | 2801 |
2800 bind(&maybe_nan); | 2802 bind(&maybe_nan); |
2801 // Could be NaN or Infinity. If fraction is not zero, it's NaN, otherwise | 2803 // Could be NaN or Infinity. If fraction is not zero, it's NaN, otherwise |
2802 // it's an Infinity, and the non-NaN code path applies. | 2804 // it's an Infinity, and the non-NaN code path applies. |
2803 j(greater, &is_nan, Label::kNear); | 2805 j(greater, &is_nan, Label::kNear); |
2804 cmpl(FieldOperand(maybe_number, HeapNumber::kValueOffset), Immediate(0)); | 2806 cmpl(FieldOperand(maybe_number, HeapNumber::kValueOffset), Immediate(0)); |
2805 j(zero, ¬_nan); | 2807 j(zero, ¬_nan); |
2806 bind(&is_nan); | 2808 bind(&is_nan); |
2807 // Convert all NaNs to the same canonical NaN value when they are stored in | 2809 // Convert all NaNs to the same canonical NaN value when they are stored in |
2808 // the double array. | 2810 // the double array. |
2809 Set(kScratchRegister, BitCast<uint64_t>( | 2811 Set(kScratchRegister, BitCast<uint64_t>( |
2810 FixedDoubleArray::canonical_not_the_hole_nan_as_double())); | 2812 FixedDoubleArray::canonical_not_the_hole_nan_as_double())); |
2811 movq(xmm_scratch, kScratchRegister); | 2813 movq(xmm_scratch, kScratchRegister); |
2812 jmp(&have_double_value, Label::kNear); | 2814 jmp(&have_double_value, Label::kNear); |
2813 | 2815 |
2814 bind(&smi_value); | 2816 bind(&smi_value); |
2815 // Value is a smi. convert to a double and store. | 2817 // Value is a smi. convert to a double and store. |
2816 // Preserve original value. | 2818 // Preserve original value. |
2817 SmiToInteger32(kScratchRegister, maybe_number); | 2819 SmiToInteger32(kScratchRegister, maybe_number); |
2818 cvtlsi2sd(xmm_scratch, kScratchRegister); | 2820 cvtlsi2sd(xmm_scratch, kScratchRegister); |
2819 movsd(FieldOperand(elements, index, times_8, FixedDoubleArray::kHeaderSize), | 2821 movsd(FieldOperand(elements, index, times_8, |
| 2822 FixedDoubleArray::kHeaderSize - elements_offset), |
2820 xmm_scratch); | 2823 xmm_scratch); |
2821 bind(&done); | 2824 bind(&done); |
2822 } | 2825 } |
2823 | 2826 |
2824 | 2827 |
2825 void MacroAssembler::CompareMap(Register obj, | 2828 void MacroAssembler::CompareMap(Register obj, |
2826 Handle<Map> map, | 2829 Handle<Map> map, |
2827 Label* early_success, | 2830 Label* early_success, |
2828 CompareMapMode mode) { | 2831 CompareMapMode mode) { |
2829 Cmp(FieldOperand(obj, HeapObject::kMapOffset), map); | 2832 Cmp(FieldOperand(obj, HeapObject::kMapOffset), map); |
(...skipping 1735 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4565 | 4568 |
4566 movq(rcx, FieldOperand(rbx, Map::kPrototypeOffset)); | 4569 movq(rcx, FieldOperand(rbx, Map::kPrototypeOffset)); |
4567 cmpq(rcx, null_value); | 4570 cmpq(rcx, null_value); |
4568 j(not_equal, &next); | 4571 j(not_equal, &next); |
4569 } | 4572 } |
4570 | 4573 |
4571 | 4574 |
4572 } } // namespace v8::internal | 4575 } } // namespace v8::internal |
4573 | 4576 |
4574 #endif // V8_TARGET_ARCH_X64 | 4577 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |