| OLD | NEW |
| 1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 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 1422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1433 case Token::DIV: | 1433 case Token::DIV: |
| 1434 // Divide rdx:rax by rbx (where rdx:rax is equivalent to the smi in eax). | 1434 // Divide rdx:rax by rbx (where rdx:rax is equivalent to the smi in eax). |
| 1435 __ idiv(rbx); | 1435 __ idiv(rbx); |
| 1436 // Check that the remainder is zero. | 1436 // Check that the remainder is zero. |
| 1437 __ testq(rdx, rdx); | 1437 __ testq(rdx, rdx); |
| 1438 __ j(not_zero, slow); | 1438 __ j(not_zero, slow); |
| 1439 // Check for the corner case of dividing the most negative smi | 1439 // Check for the corner case of dividing the most negative smi |
| 1440 // by -1. We cannot use the overflow flag, since it is not set | 1440 // by -1. We cannot use the overflow flag, since it is not set |
| 1441 // by idiv instruction. | 1441 // by idiv instruction. |
| 1442 ASSERT(kSmiTag == 0 && kSmiTagSize == 1); | 1442 ASSERT(kSmiTag == 0 && kSmiTagSize == 1); |
| 1443 // TODO(X64):TODO(Smi): Smi implementation dependent constant. | 1443 // TODO(X64): TODO(Smi): Smi implementation dependent constant. |
| 1444 // Value is Smi::fromInt(-(1<<31)) / Smi::fromInt(-1) | 1444 // Value is Smi::fromInt(-(1<<31)) / Smi::fromInt(-1) |
| 1445 __ cmpq(rax, Immediate(0x40000000)); | 1445 __ cmpq(rax, Immediate(0x40000000)); |
| 1446 __ j(equal, slow); | 1446 __ j(equal, slow); |
| 1447 // Check for negative zero result. | 1447 // Check for negative zero result. |
| 1448 __ NegativeZeroTest(rax, rcx, slow); // use ecx = x | y | 1448 __ NegativeZeroTest(rax, rcx, slow); // use ecx = x | y |
| 1449 // Tag the result and store it in register rax. | 1449 // Tag the result and store it in register rax. |
| 1450 ASSERT(kSmiTagSize == kTimes2); // adjust code if not the case | 1450 ASSERT(kSmiTagSize == kTimes2); // adjust code if not the case |
| 1451 __ lea(rax, Operand(rax, rax, kTimes1, kSmiTag)); | 1451 __ lea(rax, Operand(rax, rax, kTimes1, kSmiTag)); |
| 1452 break; | 1452 break; |
| 1453 | 1453 |
| (...skipping 590 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2044 __ addq(rsp, Immediate(2 * kPointerSize)); // remove markers | 2044 __ addq(rsp, Immediate(2 * kPointerSize)); // remove markers |
| 2045 | 2045 |
| 2046 // Restore frame pointer and return. | 2046 // Restore frame pointer and return. |
| 2047 __ pop(rbp); | 2047 __ pop(rbp); |
| 2048 __ ret(0); | 2048 __ ret(0); |
| 2049 } | 2049 } |
| 2050 | 2050 |
| 2051 #undef __ | 2051 #undef __ |
| 2052 | 2052 |
| 2053 } } // namespace v8::internal | 2053 } } // namespace v8::internal |
| OLD | NEW |