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 1183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1194 if (instr->HasNoUses()) return NULL; | 1194 if (instr->HasNoUses()) return NULL; |
1195 LOperand* value = UseRegisterAtStart(instr->value()); | 1195 LOperand* value = UseRegisterAtStart(instr->value()); |
1196 return DefineAsRegister(new(zone()) LBitNotI(value)); | 1196 return DefineAsRegister(new(zone()) LBitNotI(value)); |
1197 } | 1197 } |
1198 | 1198 |
1199 | 1199 |
1200 LInstruction* LChunkBuilder::DoDiv(HDiv* instr) { | 1200 LInstruction* LChunkBuilder::DoDiv(HDiv* instr) { |
1201 if (instr->representation().IsDouble()) { | 1201 if (instr->representation().IsDouble()) { |
1202 return DoArithmeticD(Token::DIV, instr); | 1202 return DoArithmeticD(Token::DIV, instr); |
1203 } else if (instr->representation().IsInteger32()) { | 1203 } else if (instr->representation().IsInteger32()) { |
| 1204 if (instr->HasPowerOf2Divisor()) { |
| 1205 ASSERT(!instr->CheckFlag(HValue::kCanBeDivByZero)); |
| 1206 LOperand* value = UseRegisterAtStart(instr->left()); |
| 1207 LDivI* div = |
| 1208 new(zone()) LDivI(value, UseOrConstant(instr->right())); |
| 1209 return AssignEnvironment(DefineSameAsFirst(div)); |
| 1210 } |
1204 // TODO(1042) The fixed register allocation | 1211 // TODO(1042) The fixed register allocation |
1205 // is needed because we call TypeRecordingBinaryOpStub from | 1212 // is needed because we call TypeRecordingBinaryOpStub from |
1206 // the generated code, which requires registers r0 | 1213 // the generated code, which requires registers r0 |
1207 // and r1 to be used. We should remove that | 1214 // and r1 to be used. We should remove that |
1208 // when we provide a native implementation. | 1215 // when we provide a native implementation. |
1209 LOperand* dividend = UseFixed(instr->left(), r0); | 1216 LOperand* dividend = UseFixed(instr->left(), r0); |
1210 LOperand* divisor = UseFixed(instr->right(), r1); | 1217 LOperand* divisor = UseFixed(instr->right(), r1); |
1211 return AssignEnvironment(AssignPointerMap( | 1218 return AssignEnvironment(AssignPointerMap( |
1212 DefineFixed(new(zone()) LDivI(dividend, divisor), r0))); | 1219 DefineFixed(new(zone()) LDivI(dividend, divisor), r0))); |
1213 } else { | 1220 } else { |
(...skipping 1201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2415 | 2422 |
2416 | 2423 |
2417 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { | 2424 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { |
2418 LOperand* object = UseRegister(instr->object()); | 2425 LOperand* object = UseRegister(instr->object()); |
2419 LOperand* index = UseRegister(instr->index()); | 2426 LOperand* index = UseRegister(instr->index()); |
2420 return DefineAsRegister(new(zone()) LLoadFieldByIndex(object, index)); | 2427 return DefineAsRegister(new(zone()) LLoadFieldByIndex(object, index)); |
2421 } | 2428 } |
2422 | 2429 |
2423 | 2430 |
2424 } } // namespace v8::internal | 2431 } } // namespace v8::internal |
OLD | NEW |