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

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

Issue 166793002: Fixed and improved code for integral division. Fixed and extended tests. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: A64 fixes and cleanup Created 6 years, 10 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
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 1301 matching lines...) Expand 10 before | Expand all | Expand 10 after
1312 } 1312 }
1313 } 1313 }
1314 1314
1315 1315
1316 LInstruction* LChunkBuilder::DoDiv(HDiv* instr) { 1316 LInstruction* LChunkBuilder::DoDiv(HDiv* instr) {
1317 if (instr->representation().IsSmiOrInteger32()) { 1317 if (instr->representation().IsSmiOrInteger32()) {
1318 ASSERT(instr->left()->representation().Equals(instr->representation())); 1318 ASSERT(instr->left()->representation().Equals(instr->representation()));
1319 ASSERT(instr->right()->representation().Equals(instr->representation())); 1319 ASSERT(instr->right()->representation().Equals(instr->representation()));
1320 if (instr->RightIsPowerOf2()) { 1320 if (instr->RightIsPowerOf2()) {
1321 ASSERT(!instr->CheckFlag(HValue::kCanBeDivByZero)); 1321 ASSERT(!instr->CheckFlag(HValue::kCanBeDivByZero));
1322 LOperand* value = UseRegisterAtStart(instr->left()); 1322 LOperand* value = UseRegister(instr->left());
1323 LDivI* div = 1323 LDivI* div =
1324 new(zone()) LDivI(value, UseOrConstant(instr->right()), NULL); 1324 new(zone()) LDivI(value, UseOrConstant(instr->right()), NULL);
1325 return AssignEnvironment(DefineSameAsFirst(div)); 1325 return AssignEnvironment(DefineAsRegister(div));
1326 } 1326 }
1327 // The temporary operand is necessary to ensure that right is not allocated 1327 // The temporary operand is necessary to ensure that right is not allocated
1328 // into edx. 1328 // into edx.
1329 LOperand* temp = FixedTemp(edx); 1329 LOperand* temp = FixedTemp(edx);
1330 LOperand* dividend = UseFixed(instr->left(), eax); 1330 LOperand* dividend = UseFixed(instr->left(), eax);
1331 LOperand* divisor = UseRegister(instr->right()); 1331 LOperand* divisor = UseRegister(instr->right());
1332 LDivI* result = new(zone()) LDivI(dividend, divisor, temp); 1332 LDivI* result = new(zone()) LDivI(dividend, divisor, temp);
1333 return AssignEnvironment(DefineFixed(result, eax)); 1333 return AssignEnvironment(DefineFixed(result, eax));
1334 } else if (instr->representation().IsDouble()) { 1334 } else if (instr->representation().IsDouble()) {
1335 return DoArithmeticD(Token::DIV, instr); 1335 return DoArithmeticD(Token::DIV, instr);
(...skipping 1246 matching lines...) Expand 10 before | Expand all | Expand 10 after
2582 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { 2582 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) {
2583 LOperand* object = UseRegister(instr->object()); 2583 LOperand* object = UseRegister(instr->object());
2584 LOperand* index = UseTempRegister(instr->index()); 2584 LOperand* index = UseTempRegister(instr->index());
2585 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); 2585 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index));
2586 } 2586 }
2587 2587
2588 2588
2589 } } // namespace v8::internal 2589 } } // namespace v8::internal
2590 2590
2591 #endif // V8_TARGET_ARCH_IA32 2591 #endif // V8_TARGET_ARCH_IA32
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698