| 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 630 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 641 case Token::DIV: | 641 case Token::DIV: |
| 642 // Divide rdx:rax by rbx (where rdx:rax is equivalent to the smi in eax). | 642 // Divide rdx:rax by rbx (where rdx:rax is equivalent to the smi in eax). |
| 643 __ idiv(rbx); | 643 __ idiv(rbx); |
| 644 // Check that the remainder is zero. | 644 // Check that the remainder is zero. |
| 645 __ testq(rdx, rdx); | 645 __ testq(rdx, rdx); |
| 646 __ j(not_zero, slow); | 646 __ j(not_zero, slow); |
| 647 // Check for the corner case of dividing the most negative smi | 647 // Check for the corner case of dividing the most negative smi |
| 648 // by -1. We cannot use the overflow flag, since it is not set | 648 // by -1. We cannot use the overflow flag, since it is not set |
| 649 // by idiv instruction. | 649 // by idiv instruction. |
| 650 ASSERT(kSmiTag == 0 && kSmiTagSize == 1); | 650 ASSERT(kSmiTag == 0 && kSmiTagSize == 1); |
| 651 // TODO(X64):TODO(Smi): Smi implementation dependent constant. | 651 // TODO(X64): TODO(Smi): Smi implementation dependent constant. |
| 652 // Value is Smi::fromInt(-(1<<31)) / Smi::fromInt(-1) | 652 // Value is Smi::fromInt(-(1<<31)) / Smi::fromInt(-1) |
| 653 __ cmpq(rax, Immediate(0x40000000)); | 653 __ cmpq(rax, Immediate(0x40000000)); |
| 654 __ j(equal, slow); | 654 __ j(equal, slow); |
| 655 // Check for negative zero result. | 655 // Check for negative zero result. |
| 656 __ NegativeZeroTest(rax, rcx, slow); // use ecx = x | y | 656 __ NegativeZeroTest(rax, rcx, slow); // use ecx = x | y |
| 657 // Tag the result and store it in register rax. | 657 // Tag the result and store it in register rax. |
| 658 ASSERT(kSmiTagSize == kTimes2); // adjust code if not the case | 658 ASSERT(kSmiTagSize == kTimes2); // adjust code if not the case |
| 659 __ lea(rax, Operand(rax, rax, kTimes1, kSmiTag)); | 659 __ lea(rax, Operand(rax, rax, kTimes1, kSmiTag)); |
| 660 break; | 660 break; |
| 661 | 661 |
| (...skipping 590 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1252 __ addq(rsp, Immediate(2 * kPointerSize)); // remove markers | 1252 __ addq(rsp, Immediate(2 * kPointerSize)); // remove markers |
| 1253 | 1253 |
| 1254 // Restore frame pointer and return. | 1254 // Restore frame pointer and return. |
| 1255 __ pop(rbp); | 1255 __ pop(rbp); |
| 1256 __ ret(0); | 1256 __ ret(0); |
| 1257 } | 1257 } |
| 1258 | 1258 |
| 1259 #undef __ | 1259 #undef __ |
| 1260 | 1260 |
| 1261 } } // namespace v8::internal | 1261 } } // namespace v8::internal |
| OLD | NEW |