OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 8351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8362 Register double_value = rdi; | 8362 Register double_value = rdi; |
8363 Label done, exponent_63_plus; | 8363 Label done, exponent_63_plus; |
8364 // Get double and extract exponent. | 8364 // Get double and extract exponent. |
8365 __ movq(double_value, FieldOperand(source, HeapNumber::kValueOffset)); | 8365 __ movq(double_value, FieldOperand(source, HeapNumber::kValueOffset)); |
8366 // Clear result preemptively, in case we need to return zero. | 8366 // Clear result preemptively, in case we need to return zero. |
8367 __ xorl(result, result); | 8367 __ xorl(result, result); |
8368 __ movq(xmm0, double_value); // Save copy in xmm0 in case we need it there. | 8368 __ movq(xmm0, double_value); // Save copy in xmm0 in case we need it there. |
8369 // Double to remove sign bit, shift exponent down to least significant bits. | 8369 // Double to remove sign bit, shift exponent down to least significant bits. |
8370 // and subtract bias to get the unshifted, unbiased exponent. | 8370 // and subtract bias to get the unshifted, unbiased exponent. |
8371 __ lea(double_exponent, Operand(double_value, double_value, times_1, 0)); | 8371 __ lea(double_exponent, Operand(double_value, double_value, times_1, 0)); |
8372 __ shr(double_exponent, Immediate(64 - HeapNumber::KExponentBits)); | 8372 __ shr(double_exponent, Immediate(64 - HeapNumber::kExponentBits)); |
8373 __ subl(double_exponent, Immediate(HeapNumber::kExponentBias)); | 8373 __ subl(double_exponent, Immediate(HeapNumber::kExponentBias)); |
8374 // Check whether the exponent is too big for a 63 bit unsigned integer. | 8374 // Check whether the exponent is too big for a 63 bit unsigned integer. |
8375 __ cmpl(double_exponent, Immediate(63)); | 8375 __ cmpl(double_exponent, Immediate(63)); |
8376 __ j(above_equal, &exponent_63_plus); | 8376 __ j(above_equal, &exponent_63_plus); |
8377 // Handle exponent range 0..62. | 8377 // Handle exponent range 0..62. |
8378 __ cvttsd2siq(result, xmm0); | 8378 __ cvttsd2siq(result, xmm0); |
8379 __ jmp(&done); | 8379 __ jmp(&done); |
8380 | 8380 |
8381 __ bind(&exponent_63_plus); | 8381 __ bind(&exponent_63_plus); |
8382 // Exponent negative or 63+. | 8382 // Exponent negative or 63+. |
(...skipping 3561 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11944 } | 11944 } |
11945 | 11945 |
11946 #endif | 11946 #endif |
11947 | 11947 |
11948 | 11948 |
11949 #undef __ | 11949 #undef __ |
11950 | 11950 |
11951 } } // namespace v8::internal | 11951 } } // namespace v8::internal |
11952 | 11952 |
11953 #endif // V8_TARGET_ARCH_X64 | 11953 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |