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

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

Issue 6676060: Improved modulo operation in lithium as well as bailout on -0.... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' 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
« no previous file with comments | « src/arm/lithium-arm.h ('k') | src/arm/lithium-codegen-arm.cc » ('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 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 1327 matching lines...) Expand 10 before | Expand all | Expand 10 after
1338 return AssignEnvironment(AssignPointerMap( 1338 return AssignEnvironment(AssignPointerMap(
1339 DefineFixed(new LDivI(dividend, divisor), r0))); 1339 DefineFixed(new LDivI(dividend, divisor), r0)));
1340 } else { 1340 } else {
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 // TODO(1042) The fixed register allocation
1349 // is needed because we call GenericBinaryOpStub from
1350 // the generated code, which requires registers r0
1351 // and r1 to be used. We should remove that
1352 // when we provide a native implementation.
1353 ASSERT(instr->left()->representation().IsInteger32()); 1348 ASSERT(instr->left()->representation().IsInteger32());
1354 ASSERT(instr->right()->representation().IsInteger32()); 1349 ASSERT(instr->right()->representation().IsInteger32());
1355 1350
1356 LInstruction* result; 1351 LModI* mod;
1357 if (instr->HasPowerOf2Divisor()) { 1352 if (instr->HasPowerOf2Divisor()) {
1358 ASSERT(!instr->CheckFlag(HValue::kCanBeDivByZero)); 1353 ASSERT(!instr->CheckFlag(HValue::kCanBeDivByZero));
1359 LOperand* value = UseRegisterAtStart(instr->left()); 1354 LOperand* value = UseRegisterAtStart(instr->left());
1360 LModI* mod = new LModI(value, UseOrConstant(instr->right())); 1355 mod = new LModI(value, UseOrConstant(instr->right()));
1361 result = DefineSameAsFirst(mod);
1362 result = AssignEnvironment(result);
1363 } else { 1356 } else {
1364 LOperand* value = UseFixed(instr->left(), r0); 1357 LOperand* dividend = UseRegister(instr->left());
1365 LOperand* divisor = UseFixed(instr->right(), r1); 1358 LOperand* divisor = UseRegisterAtStart(instr->right());
1366 result = DefineFixed(new LModI(value, divisor), r0); 1359 mod = new LModI(dividend,
1367 result = AssignEnvironment(AssignPointerMap(result)); 1360 divisor,
1361 TempRegister(),
1362 FixedTemp(d1),
1363 FixedTemp(d2));
1368 } 1364 }
1369 1365
1370 return result; 1366 return AssignEnvironment(DefineSameAsFirst(mod));
1371 } else if (instr->representation().IsTagged()) { 1367 } else if (instr->representation().IsTagged()) {
1372 return DoArithmeticT(Token::MOD, instr); 1368 return DoArithmeticT(Token::MOD, instr);
1373 } else { 1369 } else {
1374 ASSERT(instr->representation().IsDouble()); 1370 ASSERT(instr->representation().IsDouble());
1375 // We call a C function for double modulo. It can't trigger a GC. 1371 // We call a C function for double modulo. It can't trigger a GC.
1376 // We need to use fixed result register for the call. 1372 // We need to use fixed result register for the call.
1377 // TODO(fschneider): Allow any register as input registers. 1373 // TODO(fschneider): Allow any register as input registers.
1378 LOperand* left = UseFixedDouble(instr->left(), d1); 1374 LOperand* left = UseFixedDouble(instr->left(), d1);
1379 LOperand* right = UseFixedDouble(instr->right(), d2); 1375 LOperand* right = UseFixedDouble(instr->right(), d2);
1380 LArithmeticD* result = new LArithmeticD(Token::MOD, left, right); 1376 LArithmeticD* result = new LArithmeticD(Token::MOD, left, right);
(...skipping 690 matching lines...) Expand 10 before | Expand all | Expand 10 after
2071 2067
2072 2068
2073 LInstruction* LChunkBuilder::DoLeaveInlined(HLeaveInlined* instr) { 2069 LInstruction* LChunkBuilder::DoLeaveInlined(HLeaveInlined* instr) {
2074 HEnvironment* outer = current_block_->last_environment()->outer(); 2070 HEnvironment* outer = current_block_->last_environment()->outer();
2075 current_block_->UpdateEnvironment(outer); 2071 current_block_->UpdateEnvironment(outer);
2076 return NULL; 2072 return NULL;
2077 } 2073 }
2078 2074
2079 2075
2080 } } // namespace v8::internal 2076 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/arm/lithium-arm.h ('k') | src/arm/lithium-codegen-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698