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

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

Issue 6665006: Reduce strength of ModI for power-of-2 divisor. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: port to arm and x64 Created 9 years, 9 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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 1329 matching lines...) Expand 10 before | Expand all | Expand 10 after
1340 ASSERT(instr->representation().IsTagged()); 1340 ASSERT(instr->representation().IsTagged());
1341 return DoArithmeticT(Token::DIV, instr); 1341 return DoArithmeticT(Token::DIV, instr);
1342 } 1342 }
1343 } 1343 }
1344 1344
1345 1345
1346 LInstruction* LChunkBuilder::DoMod(HMod* instr) { 1346 LInstruction* LChunkBuilder::DoMod(HMod* instr) {
1347 if (instr->representation().IsInteger32()) { 1347 if (instr->representation().IsInteger32()) {
1348 ASSERT(instr->left()->representation().IsInteger32()); 1348 ASSERT(instr->left()->representation().IsInteger32());
1349 ASSERT(instr->right()->representation().IsInteger32()); 1349 ASSERT(instr->right()->representation().IsInteger32());
1350 // The temporary operand is necessary to ensure that right is not allocated 1350
1351 // into edx. 1351 LInstruction* result;
1352 LOperand* temp = FixedTemp(rdx); 1352 if (instr->HasPowerOf2Divisor()) {
1353 LOperand* value = UseFixed(instr->left(), rax); 1353 ASSERT(!instr->CheckFlag(HValue::kCanBeDivByZero));
1354 LOperand* divisor = UseRegister(instr->right()); 1354 LOperand* value = UseRegisterAtStart(instr->left());
1355 LModI* mod = new LModI(value, divisor, temp); 1355 LModI* mod = new LModI(value, UseOrConstant(instr->right()), NULL);
1356 LInstruction* result = DefineFixed(mod, rdx); 1356 result = DefineSameAsFirst(mod);
1357 } else {
1358 // The temporary operand is necessary to ensure that right is not allocate d
1359 // into edx.
1360 LOperand* temp = FixedTemp(rdx);
1361 LOperand* value = UseFixed(instr->left(), rax);
1362 LOperand* divisor = UseRegister(instr->right());
1363 LModI* mod = new LModI(value, divisor, temp);
1364 result = DefineFixed(mod, rdx);
1365 }
1366
1357 return (instr->CheckFlag(HValue::kBailoutOnMinusZero) || 1367 return (instr->CheckFlag(HValue::kBailoutOnMinusZero) ||
1358 instr->CheckFlag(HValue::kCanBeDivByZero)) 1368 instr->CheckFlag(HValue::kCanBeDivByZero))
1359 ? AssignEnvironment(result) 1369 ? AssignEnvironment(result)
1360 : result; 1370 : result;
1361 } else if (instr->representation().IsTagged()) { 1371 } else if (instr->representation().IsTagged()) {
1362 return DoArithmeticT(Token::MOD, instr); 1372 return DoArithmeticT(Token::MOD, instr);
1363 } else { 1373 } else {
1364 ASSERT(instr->representation().IsDouble()); 1374 ASSERT(instr->representation().IsDouble());
1365 // We call a C function for double modulo. It can't trigger a GC. 1375 // We call a C function for double modulo. It can't trigger a GC.
1366 // We need to use fixed result register for the call. 1376 // We need to use fixed result register for the call.
(...skipping 674 matching lines...) Expand 10 before | Expand all | Expand 10 after
2041 2051
2042 LInstruction* LChunkBuilder::DoLeaveInlined(HLeaveInlined* instr) { 2052 LInstruction* LChunkBuilder::DoLeaveInlined(HLeaveInlined* instr) {
2043 HEnvironment* outer = current_block_->last_environment()->outer(); 2053 HEnvironment* outer = current_block_->last_environment()->outer();
2044 current_block_->UpdateEnvironment(outer); 2054 current_block_->UpdateEnvironment(outer);
2045 return NULL; 2055 return NULL;
2046 } 2056 }
2047 2057
2048 } } // namespace v8::internal 2058 } } // namespace v8::internal
2049 2059
2050 #endif // V8_TARGET_ARCH_X64 2060 #endif // V8_TARGET_ARCH_X64
OLDNEW
« src/arm/lithium-codegen-arm.cc ('K') | « src/x64/lithium-codegen-x64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698