| 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 1906 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1917 __ mov(eax, Operand(esp, 1 * kPointerSize)); | 1917 __ mov(eax, Operand(esp, 1 * kPointerSize)); |
| 1918 | 1918 |
| 1919 // Check if the argument is a smi. | 1919 // Check if the argument is a smi. |
| 1920 Label smi; | 1920 Label smi; |
| 1921 STATIC_ASSERT(kSmiTag == 0); | 1921 STATIC_ASSERT(kSmiTag == 0); |
| 1922 __ test(eax, Immediate(kSmiTagMask)); | 1922 __ test(eax, Immediate(kSmiTagMask)); |
| 1923 __ j(zero, &smi); | 1923 __ j(zero, &smi); |
| 1924 | 1924 |
| 1925 // Check if the argument is a heap number and load its value into xmm0. | 1925 // Check if the argument is a heap number and load its value into xmm0. |
| 1926 Label slow; | 1926 Label slow; |
| 1927 __ CheckMap(eax, factory()->heap_number_map(), &slow, true); | 1927 __ CheckMap(eax, factory()->heap_number_map(), &slow, DONT_DO_SMI_CHECK); |
| 1928 __ movdbl(xmm0, FieldOperand(eax, HeapNumber::kValueOffset)); | 1928 __ movdbl(xmm0, FieldOperand(eax, HeapNumber::kValueOffset)); |
| 1929 | 1929 |
| 1930 // Check if the argument is strictly positive. Note this also | 1930 // Check if the argument is strictly positive. Note this also |
| 1931 // discards NaN. | 1931 // discards NaN. |
| 1932 __ xorpd(xmm1, xmm1); | 1932 __ xorpd(xmm1, xmm1); |
| 1933 __ ucomisd(xmm0, xmm1); | 1933 __ ucomisd(xmm0, xmm1); |
| 1934 __ j(below_equal, &slow); | 1934 __ j(below_equal, &slow); |
| 1935 | 1935 |
| 1936 // Do a truncating conversion. | 1936 // Do a truncating conversion. |
| 1937 __ cvttsd2si(eax, Operand(xmm0)); | 1937 __ cvttsd2si(eax, Operand(xmm0)); |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2061 // This only happens for the most negative smi. | 2061 // This only happens for the most negative smi. |
| 2062 Label slow; | 2062 Label slow; |
| 2063 __ j(negative, &slow); | 2063 __ j(negative, &slow); |
| 2064 | 2064 |
| 2065 // Smi case done. | 2065 // Smi case done. |
| 2066 __ ret(2 * kPointerSize); | 2066 __ ret(2 * kPointerSize); |
| 2067 | 2067 |
| 2068 // Check if the argument is a heap number and load its exponent and | 2068 // Check if the argument is a heap number and load its exponent and |
| 2069 // sign into ebx. | 2069 // sign into ebx. |
| 2070 __ bind(¬_smi); | 2070 __ bind(¬_smi); |
| 2071 __ CheckMap(eax, factory()->heap_number_map(), &slow, true); | 2071 __ CheckMap(eax, factory()->heap_number_map(), &slow, DONT_DO_SMI_CHECK); |
| 2072 __ mov(ebx, FieldOperand(eax, HeapNumber::kExponentOffset)); | 2072 __ mov(ebx, FieldOperand(eax, HeapNumber::kExponentOffset)); |
| 2073 | 2073 |
| 2074 // Check the sign of the argument. If the argument is positive, | 2074 // Check the sign of the argument. If the argument is positive, |
| 2075 // just return it. | 2075 // just return it. |
| 2076 Label negative_sign; | 2076 Label negative_sign; |
| 2077 __ test(ebx, Immediate(HeapNumber::kSignMask)); | 2077 __ test(ebx, Immediate(HeapNumber::kSignMask)); |
| 2078 __ j(not_zero, &negative_sign); | 2078 __ j(not_zero, &negative_sign); |
| 2079 __ ret(2 * kPointerSize); | 2079 __ ret(2 * kPointerSize); |
| 2080 | 2080 |
| 2081 // If the argument is negative, clear the sign, and return a new | 2081 // If the argument is negative, clear the sign, and return a new |
| (...skipping 1233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3315 | 3315 |
| 3316 // Check that the object isn't a smi. | 3316 // Check that the object isn't a smi. |
| 3317 __ test(edx, Immediate(kSmiTagMask)); | 3317 __ test(edx, Immediate(kSmiTagMask)); |
| 3318 __ j(zero, &slow); | 3318 __ j(zero, &slow); |
| 3319 | 3319 |
| 3320 // Check that the key is a smi. | 3320 // Check that the key is a smi. |
| 3321 __ test(eax, Immediate(kSmiTagMask)); | 3321 __ test(eax, Immediate(kSmiTagMask)); |
| 3322 __ j(not_zero, &slow); | 3322 __ j(not_zero, &slow); |
| 3323 | 3323 |
| 3324 // Check that the map matches. | 3324 // Check that the map matches. |
| 3325 __ CheckMap(edx, Handle<Map>(receiver->map()), &slow, false); | 3325 __ CheckMap(edx, Handle<Map>(receiver->map()), &slow, DO_SMI_CHECK); |
| 3326 __ mov(ebx, FieldOperand(edx, JSObject::kElementsOffset)); | 3326 __ mov(ebx, FieldOperand(edx, JSObject::kElementsOffset)); |
| 3327 | 3327 |
| 3328 // eax: key, known to be a smi. | 3328 // eax: key, known to be a smi. |
| 3329 // edx: receiver, known to be a JSObject. | 3329 // edx: receiver, known to be a JSObject. |
| 3330 // ebx: elements object, known to be an external array. | 3330 // ebx: elements object, known to be an external array. |
| 3331 // Check that the index is in range. | 3331 // Check that the index is in range. |
| 3332 __ mov(ecx, eax); | 3332 __ mov(ecx, eax); |
| 3333 __ SmiUntag(ecx); // Untag the index. | 3333 __ SmiUntag(ecx); // Untag the index. |
| 3334 __ cmp(ecx, FieldOperand(ebx, ExternalArray::kLengthOffset)); | 3334 __ cmp(ecx, FieldOperand(ebx, ExternalArray::kLengthOffset)); |
| 3335 // Unsigned comparison catches both negative and too-large values. | 3335 // Unsigned comparison catches both negative and too-large values. |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3469 // -- edx : receiver | 3469 // -- edx : receiver |
| 3470 // -- esp[0] : return address | 3470 // -- esp[0] : return address |
| 3471 // ----------------------------------- | 3471 // ----------------------------------- |
| 3472 Label slow, check_heap_number; | 3472 Label slow, check_heap_number; |
| 3473 | 3473 |
| 3474 // Check that the object isn't a smi. | 3474 // Check that the object isn't a smi. |
| 3475 __ test(edx, Immediate(kSmiTagMask)); | 3475 __ test(edx, Immediate(kSmiTagMask)); |
| 3476 __ j(zero, &slow); | 3476 __ j(zero, &slow); |
| 3477 | 3477 |
| 3478 // Check that the map matches. | 3478 // Check that the map matches. |
| 3479 __ CheckMap(edx, Handle<Map>(receiver->map()), &slow, false); | 3479 __ CheckMap(edx, Handle<Map>(receiver->map()), &slow, DO_SMI_CHECK); |
| 3480 | 3480 |
| 3481 // Check that the key is a smi. | 3481 // Check that the key is a smi. |
| 3482 __ test(ecx, Immediate(kSmiTagMask)); | 3482 __ test(ecx, Immediate(kSmiTagMask)); |
| 3483 __ j(not_zero, &slow); | 3483 __ j(not_zero, &slow); |
| 3484 | 3484 |
| 3485 // Check that the index is in range. | 3485 // Check that the index is in range. |
| 3486 __ mov(edi, FieldOperand(edx, JSObject::kElementsOffset)); | 3486 __ mov(edi, FieldOperand(edx, JSObject::kElementsOffset)); |
| 3487 __ mov(ebx, ecx); | 3487 __ mov(ebx, ecx); |
| 3488 __ SmiUntag(ebx); | 3488 __ SmiUntag(ebx); |
| 3489 __ cmp(ebx, FieldOperand(edi, ExternalArray::kLengthOffset)); | 3489 __ cmp(ebx, FieldOperand(edi, ExternalArray::kLengthOffset)); |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3675 | 3675 |
| 3676 return GetCode(flags); | 3676 return GetCode(flags); |
| 3677 } | 3677 } |
| 3678 | 3678 |
| 3679 | 3679 |
| 3680 #undef __ | 3680 #undef __ |
| 3681 | 3681 |
| 3682 } } // namespace v8::internal | 3682 } } // namespace v8::internal |
| 3683 | 3683 |
| 3684 #endif // V8_TARGET_ARCH_IA32 | 3684 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |