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 1887 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1898 // This only happens for the most negative smi. | 1898 // This only happens for the most negative smi. |
1899 Label slow; | 1899 Label slow; |
1900 __ j(negative, &slow); | 1900 __ j(negative, &slow); |
1901 | 1901 |
1902 // Smi case done. | 1902 // Smi case done. |
1903 __ Integer32ToSmi(rax, rax); | 1903 __ Integer32ToSmi(rax, rax); |
1904 __ ret(2 * kPointerSize); | 1904 __ ret(2 * kPointerSize); |
1905 | 1905 |
1906 // Check if the argument is a heap number and load its value. | 1906 // Check if the argument is a heap number and load its value. |
1907 __ bind(¬_smi); | 1907 __ bind(¬_smi); |
1908 __ CheckMap(rax, factory()->heap_number_map(), &slow, true); | 1908 __ CheckMap(rax, factory()->heap_number_map(), &slow, DONT_DO_SMI_CHECK); |
1909 __ movq(rbx, FieldOperand(rax, HeapNumber::kValueOffset)); | 1909 __ movq(rbx, FieldOperand(rax, HeapNumber::kValueOffset)); |
1910 | 1910 |
1911 // Check the sign of the argument. If the argument is positive, | 1911 // Check the sign of the argument. If the argument is positive, |
1912 // just return it. | 1912 // just return it. |
1913 Label negative_sign; | 1913 Label negative_sign; |
1914 const int sign_mask_shift = | 1914 const int sign_mask_shift = |
1915 (HeapNumber::kExponentOffset - HeapNumber::kValueOffset) * kBitsPerByte; | 1915 (HeapNumber::kExponentOffset - HeapNumber::kValueOffset) * kBitsPerByte; |
1916 __ movq(rdi, static_cast<int64_t>(HeapNumber::kSignMask) << sign_mask_shift, | 1916 __ movq(rdi, static_cast<int64_t>(HeapNumber::kSignMask) << sign_mask_shift, |
1917 RelocInfo::NONE); | 1917 RelocInfo::NONE); |
1918 __ testq(rbx, rdi); | 1918 __ testq(rbx, rdi); |
(...skipping 1211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3130 // ----------------------------------- | 3130 // ----------------------------------- |
3131 Label slow; | 3131 Label slow; |
3132 | 3132 |
3133 // Check that the object isn't a smi. | 3133 // Check that the object isn't a smi. |
3134 __ JumpIfSmi(rdx, &slow); | 3134 __ JumpIfSmi(rdx, &slow); |
3135 | 3135 |
3136 // Check that the key is a smi. | 3136 // Check that the key is a smi. |
3137 __ JumpIfNotSmi(rax, &slow); | 3137 __ JumpIfNotSmi(rax, &slow); |
3138 | 3138 |
3139 // Check that the map matches. | 3139 // Check that the map matches. |
3140 __ CheckMap(rdx, Handle<Map>(receiver->map()), &slow, false); | 3140 __ CheckMap(rdx, Handle<Map>(receiver->map()), &slow, DO_SMI_CHECK); |
3141 __ movq(rbx, FieldOperand(rdx, JSObject::kElementsOffset)); | 3141 __ movq(rbx, FieldOperand(rdx, JSObject::kElementsOffset)); |
3142 | 3142 |
3143 // Check that the index is in range. | 3143 // Check that the index is in range. |
3144 __ SmiToInteger32(rcx, rax); | 3144 __ SmiToInteger32(rcx, rax); |
3145 __ cmpl(rcx, FieldOperand(rbx, ExternalArray::kLengthOffset)); | 3145 __ cmpl(rcx, FieldOperand(rbx, ExternalArray::kLengthOffset)); |
3146 // Unsigned comparison catches both negative and too-large values. | 3146 // Unsigned comparison catches both negative and too-large values. |
3147 __ j(above_equal, &slow); | 3147 __ j(above_equal, &slow); |
3148 | 3148 |
3149 // rax: index (as a smi) | 3149 // rax: index (as a smi) |
3150 // rdx: receiver (JSObject) | 3150 // rdx: receiver (JSObject) |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3260 // -- rcx : key | 3260 // -- rcx : key |
3261 // -- rdx : receiver | 3261 // -- rdx : receiver |
3262 // -- rsp[0] : return address | 3262 // -- rsp[0] : return address |
3263 // ----------------------------------- | 3263 // ----------------------------------- |
3264 Label slow; | 3264 Label slow; |
3265 | 3265 |
3266 // Check that the object isn't a smi. | 3266 // Check that the object isn't a smi. |
3267 __ JumpIfSmi(rdx, &slow); | 3267 __ JumpIfSmi(rdx, &slow); |
3268 | 3268 |
3269 // Check that the map matches. | 3269 // Check that the map matches. |
3270 __ CheckMap(rdx, Handle<Map>(receiver->map()), &slow, false); | 3270 __ CheckMap(rdx, Handle<Map>(receiver->map()), &slow, DO_SMI_CHECK); |
3271 __ movq(rbx, FieldOperand(rdx, JSObject::kElementsOffset)); | 3271 __ movq(rbx, FieldOperand(rdx, JSObject::kElementsOffset)); |
3272 | 3272 |
3273 // Check that the key is a smi. | 3273 // Check that the key is a smi. |
3274 __ JumpIfNotSmi(rcx, &slow); | 3274 __ JumpIfNotSmi(rcx, &slow); |
3275 | 3275 |
3276 // Check that the index is in range. | 3276 // Check that the index is in range. |
3277 __ SmiToInteger32(rdi, rcx); // Untag the index. | 3277 __ SmiToInteger32(rdi, rcx); // Untag the index. |
3278 __ cmpl(rdi, FieldOperand(rbx, ExternalArray::kLengthOffset)); | 3278 __ cmpl(rdi, FieldOperand(rbx, ExternalArray::kLengthOffset)); |
3279 // Unsigned comparison catches both negative and too-large values. | 3279 // Unsigned comparison catches both negative and too-large values. |
3280 __ j(above_equal, &slow); | 3280 __ j(above_equal, &slow); |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3424 __ TailCallRuntime(Runtime::kSetProperty, 5, 1); | 3424 __ TailCallRuntime(Runtime::kSetProperty, 5, 1); |
3425 | 3425 |
3426 return GetCode(flags); | 3426 return GetCode(flags); |
3427 } | 3427 } |
3428 | 3428 |
3429 #undef __ | 3429 #undef __ |
3430 | 3430 |
3431 } } // namespace v8::internal | 3431 } } // namespace v8::internal |
3432 | 3432 |
3433 #endif // V8_TARGET_ARCH_X64 | 3433 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |