| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 998 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1009 // Reduce the dividend by the divisor. | 1009 // Reduce the dividend by the divisor. |
| 1010 __ subl(left_reg, right_reg); | 1010 __ subl(left_reg, right_reg); |
| 1011 // Check if the dividend is less than the divisor. | 1011 // Check if the dividend is less than the divisor. |
| 1012 __ cmpl(left_reg, right_reg); | 1012 __ cmpl(left_reg, right_reg); |
| 1013 __ j(less, &remainder_eq_dividend, Label::kNear); | 1013 __ j(less, &remainder_eq_dividend, Label::kNear); |
| 1014 } | 1014 } |
| 1015 __ movl(left_reg, scratch); | 1015 __ movl(left_reg, scratch); |
| 1016 | 1016 |
| 1017 // Slow case, using idiv instruction. | 1017 // Slow case, using idiv instruction. |
| 1018 __ bind(&slow); | 1018 __ bind(&slow); |
| 1019 |
| 1020 // Check for (kMinInt % -1). |
| 1021 if (instr->hydrogen()->CheckFlag(HValue::kCanOverflow)) { |
| 1022 Label left_not_min_int; |
| 1023 __ cmpl(left_reg, Immediate(kMinInt)); |
| 1024 __ j(not_zero, &left_not_min_int, Label::kNear); |
| 1025 __ cmpl(right_reg, Immediate(-1)); |
| 1026 DeoptimizeIf(zero, instr->environment()); |
| 1027 __ bind(&left_not_min_int); |
| 1028 } |
| 1029 |
| 1019 // Sign extend eax to edx. | 1030 // Sign extend eax to edx. |
| 1020 // (We are using only the low 32 bits of the values.) | 1031 // (We are using only the low 32 bits of the values.) |
| 1021 __ cdq(); | 1032 __ cdq(); |
| 1022 | 1033 |
| 1023 // Check for (0 % -x) that will produce negative zero. | 1034 // Check for (0 % -x) that will produce negative zero. |
| 1024 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) { | 1035 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) { |
| 1025 Label positive_left; | 1036 Label positive_left; |
| 1026 Label done; | 1037 Label done; |
| 1027 __ testl(left_reg, left_reg); | 1038 __ testl(left_reg, left_reg); |
| 1028 __ j(not_sign, &positive_left, Label::kNear); | 1039 __ j(not_sign, &positive_left, Label::kNear); |
| (...skipping 4499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5528 FixedArray::kHeaderSize - kPointerSize)); | 5539 FixedArray::kHeaderSize - kPointerSize)); |
| 5529 __ bind(&done); | 5540 __ bind(&done); |
| 5530 } | 5541 } |
| 5531 | 5542 |
| 5532 | 5543 |
| 5533 #undef __ | 5544 #undef __ |
| 5534 | 5545 |
| 5535 } } // namespace v8::internal | 5546 } } // namespace v8::internal |
| 5536 | 5547 |
| 5537 #endif // V8_TARGET_ARCH_X64 | 5548 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |