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 2070 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2081 __ bind(¬_smi); | 2081 __ bind(¬_smi); |
2082 __ CheckMap(rax, factory()->heap_number_map(), &slow, DONT_DO_SMI_CHECK); | 2082 __ CheckMap(rax, factory()->heap_number_map(), &slow, DONT_DO_SMI_CHECK); |
2083 __ movq(rbx, FieldOperand(rax, HeapNumber::kValueOffset)); | 2083 __ movq(rbx, FieldOperand(rax, HeapNumber::kValueOffset)); |
2084 | 2084 |
2085 // Check the sign of the argument. If the argument is positive, | 2085 // Check the sign of the argument. If the argument is positive, |
2086 // just return it. | 2086 // just return it. |
2087 Label negative_sign; | 2087 Label negative_sign; |
2088 const int sign_mask_shift = | 2088 const int sign_mask_shift = |
2089 (HeapNumber::kExponentOffset - HeapNumber::kValueOffset) * kBitsPerByte; | 2089 (HeapNumber::kExponentOffset - HeapNumber::kValueOffset) * kBitsPerByte; |
2090 __ movq(rdi, static_cast<int64_t>(HeapNumber::kSignMask) << sign_mask_shift, | 2090 __ movq(rdi, static_cast<int64_t>(HeapNumber::kSignMask) << sign_mask_shift, |
2091 RelocInfo::NONE); | 2091 RelocInfo::NONE64); |
2092 __ testq(rbx, rdi); | 2092 __ testq(rbx, rdi); |
2093 __ j(not_zero, &negative_sign); | 2093 __ j(not_zero, &negative_sign); |
2094 __ ret(2 * kPointerSize); | 2094 __ ret(2 * kPointerSize); |
2095 | 2095 |
2096 // If the argument is negative, clear the sign, and return a new | 2096 // If the argument is negative, clear the sign, and return a new |
2097 // number. We still have the sign mask in rdi. | 2097 // number. We still have the sign mask in rdi. |
2098 __ bind(&negative_sign); | 2098 __ bind(&negative_sign); |
2099 __ xor_(rbx, rdi); | 2099 __ xor_(rbx, rdi); |
2100 __ AllocateHeapNumber(rax, rdx, &slow); | 2100 __ AllocateHeapNumber(rax, rdx, &slow); |
2101 __ movq(FieldOperand(rax, HeapNumber::kValueOffset), rbx); | 2101 __ movq(FieldOperand(rax, HeapNumber::kValueOffset), rbx); |
(...skipping 1785 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3887 __ Move(FieldOperand(rdi, JSObject::kMapOffset), | 3887 __ Move(FieldOperand(rdi, JSObject::kMapOffset), |
3888 masm->isolate()->factory()->fixed_double_array_map()); | 3888 masm->isolate()->factory()->fixed_double_array_map()); |
3889 __ Move(FieldOperand(rdi, FixedDoubleArray::kLengthOffset), | 3889 __ Move(FieldOperand(rdi, FixedDoubleArray::kLengthOffset), |
3890 Smi::FromInt(JSArray::kPreallocatedArrayElements)); | 3890 Smi::FromInt(JSArray::kPreallocatedArrayElements)); |
3891 | 3891 |
3892 // Increment the length of the array. | 3892 // Increment the length of the array. |
3893 __ SmiToInteger32(rcx, rcx); | 3893 __ SmiToInteger32(rcx, rcx); |
3894 __ StoreNumberToDoubleElements(rax, rdi, rcx, xmm0, | 3894 __ StoreNumberToDoubleElements(rax, rdi, rcx, xmm0, |
3895 &restore_key_transition_elements_kind); | 3895 &restore_key_transition_elements_kind); |
3896 | 3896 |
3897 __ movq(r8, BitCast<int64_t, uint64_t>(kHoleNanInt64), RelocInfo::NONE); | 3897 __ movq(r8, BitCast<int64_t, uint64_t>(kHoleNanInt64), RelocInfo::NONE64); |
3898 for (int i = 1; i < JSArray::kPreallocatedArrayElements; i++) { | 3898 for (int i = 1; i < JSArray::kPreallocatedArrayElements; i++) { |
3899 __ movq(FieldOperand(rdi, FixedDoubleArray::OffsetOfElementAt(i)), r8); | 3899 __ movq(FieldOperand(rdi, FixedDoubleArray::OffsetOfElementAt(i)), r8); |
3900 } | 3900 } |
3901 | 3901 |
3902 // Install the new backing store in the JSArray. | 3902 // Install the new backing store in the JSArray. |
3903 __ movq(FieldOperand(rdx, JSObject::kElementsOffset), rdi); | 3903 __ movq(FieldOperand(rdx, JSObject::kElementsOffset), rdi); |
3904 __ RecordWriteField(rdx, JSObject::kElementsOffset, rdi, rbx, | 3904 __ RecordWriteField(rdx, JSObject::kElementsOffset, rdi, rbx, |
3905 kDontSaveFPRegs, EMIT_REMEMBERED_SET, OMIT_SMI_CHECK); | 3905 kDontSaveFPRegs, EMIT_REMEMBERED_SET, OMIT_SMI_CHECK); |
3906 | 3906 |
3907 // Increment the length of the array. | 3907 // Increment the length of the array. |
(...skipping 20 matching lines...) Expand all Loading... |
3928 __ jmp(ic_slow, RelocInfo::CODE_TARGET); | 3928 __ jmp(ic_slow, RelocInfo::CODE_TARGET); |
3929 } | 3929 } |
3930 } | 3930 } |
3931 | 3931 |
3932 | 3932 |
3933 #undef __ | 3933 #undef __ |
3934 | 3934 |
3935 } } // namespace v8::internal | 3935 } } // namespace v8::internal |
3936 | 3936 |
3937 #endif // V8_TARGET_ARCH_X64 | 3937 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |