OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 969 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
980 | 980 |
981 void LCodeGen::DoUnknownOSRValue(LUnknownOSRValue* instr) { | 981 void LCodeGen::DoUnknownOSRValue(LUnknownOSRValue* instr) { |
982 GenerateOsrPrologue(); | 982 GenerateOsrPrologue(); |
983 } | 983 } |
984 | 984 |
985 | 985 |
986 void LCodeGen::DoModI(LModI* instr) { | 986 void LCodeGen::DoModI(LModI* instr) { |
987 HMod* hmod = instr->hydrogen(); | 987 HMod* hmod = instr->hydrogen(); |
988 HValue* left = hmod->left(); | 988 HValue* left = hmod->left(); |
989 HValue* right = hmod->right(); | 989 HValue* right = hmod->right(); |
990 if (hmod->HasPowerOf2Divisor()) { | 990 if (hmod->RightIsPowerOf2()) { |
991 // TODO(svenpanne) We should really do the strength reduction on the | 991 // TODO(svenpanne) We should really do the strength reduction on the |
992 // Hydrogen level. | 992 // Hydrogen level. |
993 Register left_reg = ToRegister(instr->left()); | 993 Register left_reg = ToRegister(instr->left()); |
994 ASSERT(left_reg.is(ToRegister(instr->result()))); | 994 ASSERT(left_reg.is(ToRegister(instr->result()))); |
995 | 995 |
996 // Note: The code below even works when right contains kMinInt. | 996 // Note: The code below even works when right contains kMinInt. |
997 int32_t divisor = Abs(right->GetInteger32Constant()); | 997 int32_t divisor = Abs(right->GetInteger32Constant()); |
998 | 998 |
999 Label left_is_not_negative, done; | 999 Label left_is_not_negative, done; |
1000 if (left->CanBeNegative()) { | 1000 if (left->CanBeNegative()) { |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1146 // Result just fit in r64, because it's int32 * uint32. | 1146 // Result just fit in r64, because it's int32 * uint32. |
1147 __ imul(reg2, reg1); | 1147 __ imul(reg2, reg1); |
1148 | 1148 |
1149 __ addq(reg2, Immediate(1 << 30)); | 1149 __ addq(reg2, Immediate(1 << 30)); |
1150 __ sar(reg2, Immediate(shift)); | 1150 __ sar(reg2, Immediate(shift)); |
1151 } | 1151 } |
1152 } | 1152 } |
1153 | 1153 |
1154 | 1154 |
1155 void LCodeGen::DoDivI(LDivI* instr) { | 1155 void LCodeGen::DoDivI(LDivI* instr) { |
1156 if (!instr->is_flooring() && instr->hydrogen()->HasPowerOf2Divisor()) { | 1156 if (!instr->is_flooring() && instr->hydrogen()->RightIsPowerOf2()) { |
1157 Register dividend = ToRegister(instr->left()); | 1157 Register dividend = ToRegister(instr->left()); |
1158 int32_t divisor = | 1158 int32_t divisor = |
1159 HConstant::cast(instr->hydrogen()->right())->Integer32Value(); | 1159 HConstant::cast(instr->hydrogen()->right())->Integer32Value(); |
1160 int32_t test_value = 0; | 1160 int32_t test_value = 0; |
1161 int32_t power = 0; | 1161 int32_t power = 0; |
1162 | 1162 |
1163 if (divisor > 0) { | 1163 if (divisor > 0) { |
1164 test_value = divisor - 1; | 1164 test_value = divisor - 1; |
1165 power = WhichPowerOf2(divisor); | 1165 power = WhichPowerOf2(divisor); |
1166 } else { | 1166 } else { |
(...skipping 4463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5630 FixedArray::kHeaderSize - kPointerSize)); | 5630 FixedArray::kHeaderSize - kPointerSize)); |
5631 __ bind(&done); | 5631 __ bind(&done); |
5632 } | 5632 } |
5633 | 5633 |
5634 | 5634 |
5635 #undef __ | 5635 #undef __ |
5636 | 5636 |
5637 } } // namespace v8::internal | 5637 } } // namespace v8::internal |
5638 | 5638 |
5639 #endif // V8_TARGET_ARCH_X64 | 5639 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |