OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 2706 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2717 STATIC_ASSERT(FAST_SMI_ONLY_ELEMENTS == 0); | 2717 STATIC_ASSERT(FAST_SMI_ONLY_ELEMENTS == 0); |
2718 cmpb(FieldOperand(map, Map::kBitField2Offset), | 2718 cmpb(FieldOperand(map, Map::kBitField2Offset), |
2719 Immediate(Map::kMaximumBitField2FastSmiOnlyElementValue)); | 2719 Immediate(Map::kMaximumBitField2FastSmiOnlyElementValue)); |
2720 j(above, fail, distance); | 2720 j(above, fail, distance); |
2721 } | 2721 } |
2722 | 2722 |
2723 | 2723 |
2724 void MacroAssembler::StoreNumberToDoubleElements( | 2724 void MacroAssembler::StoreNumberToDoubleElements( |
2725 Register maybe_number, | 2725 Register maybe_number, |
2726 Register elements, | 2726 Register elements, |
2727 Register key, | 2727 Register index, |
2728 XMMRegister xmm_scratch, | 2728 XMMRegister xmm_scratch, |
2729 Label* fail) { | 2729 Label* fail) { |
2730 Label smi_value, is_nan, maybe_nan, not_nan, have_double_value, done; | 2730 Label smi_value, is_nan, maybe_nan, not_nan, have_double_value, done; |
2731 | 2731 |
2732 JumpIfSmi(maybe_number, &smi_value, Label::kNear); | 2732 JumpIfSmi(maybe_number, &smi_value, Label::kNear); |
2733 | 2733 |
2734 CheckMap(maybe_number, | 2734 CheckMap(maybe_number, |
2735 isolate()->factory()->heap_number_map(), | 2735 isolate()->factory()->heap_number_map(), |
2736 fail, | 2736 fail, |
2737 DONT_DO_SMI_CHECK); | 2737 DONT_DO_SMI_CHECK); |
2738 | 2738 |
2739 // Double value, canonicalize NaN. | 2739 // Double value, canonicalize NaN. |
2740 uint32_t offset = HeapNumber::kValueOffset + sizeof(kHoleNanLower32); | 2740 uint32_t offset = HeapNumber::kValueOffset + sizeof(kHoleNanLower32); |
2741 cmpl(FieldOperand(maybe_number, offset), | 2741 cmpl(FieldOperand(maybe_number, offset), |
2742 Immediate(kNaNOrInfinityLowerBoundUpper32)); | 2742 Immediate(kNaNOrInfinityLowerBoundUpper32)); |
2743 j(greater_equal, &maybe_nan, Label::kNear); | 2743 j(greater_equal, &maybe_nan, Label::kNear); |
2744 | 2744 |
2745 bind(¬_nan); | 2745 bind(¬_nan); |
2746 movsd(xmm_scratch, FieldOperand(maybe_number, HeapNumber::kValueOffset)); | 2746 movsd(xmm_scratch, FieldOperand(maybe_number, HeapNumber::kValueOffset)); |
2747 bind(&have_double_value); | 2747 bind(&have_double_value); |
2748 movsd(FieldOperand(elements, key, times_8, FixedDoubleArray::kHeaderSize), | 2748 movsd(FieldOperand(elements, index, times_8, FixedDoubleArray::kHeaderSize), |
2749 xmm_scratch); | 2749 xmm_scratch); |
2750 jmp(&done); | 2750 jmp(&done); |
2751 | 2751 |
2752 bind(&maybe_nan); | 2752 bind(&maybe_nan); |
2753 // Could be NaN or Infinity. If fraction is not zero, it's NaN, otherwise | 2753 // Could be NaN or Infinity. If fraction is not zero, it's NaN, otherwise |
2754 // it's an Infinity, and the non-NaN code path applies. | 2754 // it's an Infinity, and the non-NaN code path applies. |
2755 j(greater, &is_nan, Label::kNear); | 2755 j(greater, &is_nan, Label::kNear); |
2756 cmpl(FieldOperand(maybe_number, HeapNumber::kValueOffset), Immediate(0)); | 2756 cmpl(FieldOperand(maybe_number, HeapNumber::kValueOffset), Immediate(0)); |
2757 j(zero, ¬_nan); | 2757 j(zero, ¬_nan); |
2758 bind(&is_nan); | 2758 bind(&is_nan); |
2759 // Convert all NaNs to the same canonical NaN value when they are stored in | 2759 // Convert all NaNs to the same canonical NaN value when they are stored in |
2760 // the double array. | 2760 // the double array. |
2761 Set(kScratchRegister, BitCast<uint64_t>( | 2761 Set(kScratchRegister, BitCast<uint64_t>( |
2762 FixedDoubleArray::canonical_not_the_hole_nan_as_double())); | 2762 FixedDoubleArray::canonical_not_the_hole_nan_as_double())); |
2763 movq(xmm_scratch, kScratchRegister); | 2763 movq(xmm_scratch, kScratchRegister); |
2764 jmp(&have_double_value, Label::kNear); | 2764 jmp(&have_double_value, Label::kNear); |
2765 | 2765 |
2766 bind(&smi_value); | 2766 bind(&smi_value); |
2767 // Value is a smi. convert to a double and store. | 2767 // Value is a smi. convert to a double and store. |
2768 // Preserve original value. | 2768 // Preserve original value. |
2769 SmiToInteger32(kScratchRegister, maybe_number); | 2769 SmiToInteger32(kScratchRegister, maybe_number); |
2770 cvtlsi2sd(xmm_scratch, kScratchRegister); | 2770 cvtlsi2sd(xmm_scratch, kScratchRegister); |
2771 movsd(FieldOperand(elements, key, times_8, FixedDoubleArray::kHeaderSize), | 2771 movsd(FieldOperand(elements, index, times_8, FixedDoubleArray::kHeaderSize), |
2772 xmm_scratch); | 2772 xmm_scratch); |
2773 bind(&done); | 2773 bind(&done); |
2774 } | 2774 } |
2775 | 2775 |
2776 | 2776 |
2777 void MacroAssembler::CheckMap(Register obj, | 2777 void MacroAssembler::CheckMap(Register obj, |
2778 Handle<Map> map, | 2778 Handle<Map> map, |
2779 Label* fail, | 2779 Label* fail, |
2780 SmiCheckType smi_check_type) { | 2780 SmiCheckType smi_check_type) { |
2781 if (smi_check_type == DO_SMI_CHECK) { | 2781 if (smi_check_type == DO_SMI_CHECK) { |
(...skipping 1545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4327 | 4327 |
4328 and_(bitmap_scratch, Immediate(~Page::kPageAlignmentMask)); | 4328 and_(bitmap_scratch, Immediate(~Page::kPageAlignmentMask)); |
4329 addl(Operand(bitmap_scratch, MemoryChunk::kLiveBytesOffset), length); | 4329 addl(Operand(bitmap_scratch, MemoryChunk::kLiveBytesOffset), length); |
4330 | 4330 |
4331 bind(&done); | 4331 bind(&done); |
4332 } | 4332 } |
4333 | 4333 |
4334 } } // namespace v8::internal | 4334 } } // namespace v8::internal |
4335 | 4335 |
4336 #endif // V8_TARGET_ARCH_X64 | 4336 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |