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

Side by Side Diff: src/x64/lithium-x64.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 1222 matching lines...) Expand 10 before | Expand all | Expand 10 after
1233 } 1233 }
1234 } 1234 }
1235 1235
1236 1236
1237 LInstruction* LChunkBuilder::DoDiv(HDiv* instr) { 1237 LInstruction* LChunkBuilder::DoDiv(HDiv* instr) {
1238 if (instr->representation().IsSmiOrInteger32()) { 1238 if (instr->representation().IsSmiOrInteger32()) {
1239 ASSERT(instr->left()->representation().Equals(instr->representation())); 1239 ASSERT(instr->left()->representation().Equals(instr->representation()));
1240 ASSERT(instr->right()->representation().Equals(instr->representation())); 1240 ASSERT(instr->right()->representation().Equals(instr->representation()));
1241 if (instr->RightIsPowerOf2()) { 1241 if (instr->RightIsPowerOf2()) {
1242 ASSERT(!instr->CheckFlag(HValue::kCanBeDivByZero)); 1242 ASSERT(!instr->CheckFlag(HValue::kCanBeDivByZero));
1243 LOperand* value = UseRegisterAtStart(instr->left()); 1243 LOperand* value = UseRegister(instr->left());
1244 LDivI* div = 1244 LDivI* div =
1245 new(zone()) LDivI(value, UseOrConstant(instr->right()), NULL); 1245 new(zone()) LDivI(value, UseOrConstant(instr->right()), NULL);
1246 return AssignEnvironment(DefineSameAsFirst(div)); 1246 return AssignEnvironment(DefineAsRegister(div));
1247 } 1247 }
1248 // The temporary operand is necessary to ensure that right is not allocated 1248 // The temporary operand is necessary to ensure that right is not allocated
1249 // into rdx. 1249 // into rdx.
1250 LOperand* temp = FixedTemp(rdx); 1250 LOperand* temp = FixedTemp(rdx);
1251 LOperand* dividend = UseFixed(instr->left(), rax); 1251 LOperand* dividend = UseFixed(instr->left(), rax);
1252 LOperand* divisor = UseRegister(instr->right()); 1252 LOperand* divisor = UseRegister(instr->right());
1253 LDivI* result = new(zone()) LDivI(dividend, divisor, temp); 1253 LDivI* result = new(zone()) LDivI(dividend, divisor, temp);
1254 return AssignEnvironment(DefineFixed(result, rax)); 1254 return AssignEnvironment(DefineFixed(result, rax));
1255 } else if (instr->representation().IsDouble()) { 1255 } else if (instr->representation().IsDouble()) {
1256 return DoArithmeticD(Token::DIV, instr); 1256 return DoArithmeticD(Token::DIV, instr);
(...skipping 1171 matching lines...) Expand 10 before | Expand all | Expand 10 after
2428 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { 2428 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) {
2429 LOperand* object = UseRegister(instr->object()); 2429 LOperand* object = UseRegister(instr->object());
2430 LOperand* index = UseTempRegister(instr->index()); 2430 LOperand* index = UseTempRegister(instr->index());
2431 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); 2431 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index));
2432 } 2432 }
2433 2433
2434 2434
2435 } } // namespace v8::internal 2435 } } // namespace v8::internal
2436 2436
2437 #endif // V8_TARGET_ARCH_X64 2437 #endif // V8_TARGET_ARCH_X64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698