Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(405)

Side by Side Diff: src/arm/lithium-arm.cc

Issue 16082008: Increase sanity of integer division handling on ARM (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: addressed Rodolph's comments Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/arm/lithium-arm.h ('k') | src/arm/lithium-codegen-arm.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1327 matching lines...) Expand 10 before | Expand all | Expand 10 after
1338 1338
1339 1339
1340 LInstruction* LChunkBuilder::DoDiv(HDiv* instr) { 1340 LInstruction* LChunkBuilder::DoDiv(HDiv* instr) {
1341 if (instr->representation().IsDouble()) { 1341 if (instr->representation().IsDouble()) {
1342 return DoArithmeticD(Token::DIV, instr); 1342 return DoArithmeticD(Token::DIV, instr);
1343 } else if (instr->representation().IsInteger32()) { 1343 } else if (instr->representation().IsInteger32()) {
1344 if (instr->HasPowerOf2Divisor()) { 1344 if (instr->HasPowerOf2Divisor()) {
1345 ASSERT(!instr->CheckFlag(HValue::kCanBeDivByZero)); 1345 ASSERT(!instr->CheckFlag(HValue::kCanBeDivByZero));
1346 LOperand* value = UseRegisterAtStart(instr->left()); 1346 LOperand* value = UseRegisterAtStart(instr->left());
1347 LDivI* div = 1347 LDivI* div =
1348 new(zone()) LDivI(value, UseOrConstant(instr->right())); 1348 new(zone()) LDivI(value, UseOrConstant(instr->right()), NULL);
1349 return AssignEnvironment(DefineSameAsFirst(div)); 1349 return AssignEnvironment(DefineSameAsFirst(div));
1350 } 1350 }
1351 // TODO(1042) The fixed register allocation 1351 LOperand* dividend = UseRegister(instr->left());
1352 // is needed because we call TypeRecordingBinaryOpStub from 1352 LOperand* divisor = UseRegister(instr->right());
1353 // the generated code, which requires registers r0 1353 LOperand* temp = CpuFeatures::IsSupported(SUDIV) ? NULL : FixedTemp(d4);
1354 // and r1 to be used. We should remove that 1354 LDivI* div = new(zone()) LDivI(dividend, divisor, temp);
1355 // when we provide a native implementation. 1355 return AssignEnvironment(DefineAsRegister(div));
1356 LOperand* dividend = UseFixed(instr->left(), r0);
1357 LOperand* divisor = UseFixed(instr->right(), r1);
1358 return AssignEnvironment(AssignPointerMap(
1359 DefineFixed(new(zone()) LDivI(dividend, divisor), r0)));
1360 } else { 1356 } else {
1361 return DoArithmeticT(Token::DIV, instr); 1357 return DoArithmeticT(Token::DIV, instr);
1362 } 1358 }
1363 } 1359 }
1364 1360
1365 1361
1366 bool LChunkBuilder::HasMagicNumberForDivisor(int32_t divisor) { 1362 bool LChunkBuilder::HasMagicNumberForDivisor(int32_t divisor) {
1367 uint32_t divisor_abs = abs(divisor); 1363 uint32_t divisor_abs = abs(divisor);
1368 // Dividing by 0, 1, and powers of 2 is easy. 1364 // Dividing by 0, 1, and powers of 2 is easy.
1369 // Note that IsPowerOf2(0) returns true; 1365 // Note that IsPowerOf2(0) returns true;
(...skipping 1262 matching lines...) Expand 10 before | Expand all | Expand 10 after
2632 2628
2633 2629
2634 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { 2630 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) {
2635 LOperand* object = UseRegister(instr->object()); 2631 LOperand* object = UseRegister(instr->object());
2636 LOperand* index = UseRegister(instr->index()); 2632 LOperand* index = UseRegister(instr->index());
2637 return DefineAsRegister(new(zone()) LLoadFieldByIndex(object, index)); 2633 return DefineAsRegister(new(zone()) LLoadFieldByIndex(object, index));
2638 } 2634 }
2639 2635
2640 2636
2641 } } // namespace v8::internal 2637 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/arm/lithium-arm.h ('k') | src/arm/lithium-codegen-arm.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698