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

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

Issue 6328009: Move swapping of operands for commutative binary operations to the lithium IR... Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 9 years, 11 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/hydrogen-instructions.h ('k') | src/x64/lithium-x64.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 715 matching lines...) Expand 10 before | Expand all | Expand 10 after
726 return AssignEnvironment(new LDeoptimize); 726 return AssignEnvironment(new LDeoptimize);
727 } 727 }
728 728
729 729
730 LInstruction* LChunkBuilder::DoBit(Token::Value op, 730 LInstruction* LChunkBuilder::DoBit(Token::Value op,
731 HBitwiseBinaryOperation* instr) { 731 HBitwiseBinaryOperation* instr) {
732 if (instr->representation().IsInteger32()) { 732 if (instr->representation().IsInteger32()) {
733 ASSERT(instr->left()->representation().IsInteger32()); 733 ASSERT(instr->left()->representation().IsInteger32());
734 ASSERT(instr->right()->representation().IsInteger32()); 734 ASSERT(instr->right()->representation().IsInteger32());
735 735
736 LOperand* left = UseRegisterAtStart(instr->LeastConstantOperand()); 736 LOperand* left = UseRegisterAtStart(instr->left()->IsConstant()
737 LOperand* right = UseOrConstantAtStart(instr->MostConstantOperand()); 737 ? instr->right()
738 : instr->left());
739 LOperand* right = UseOrConstantAtStart(instr->left()->IsConstant()
740 ? instr->left()
741 : instr->right());
738 return DefineSameAsFirst(new LBitI(op, left, right)); 742 return DefineSameAsFirst(new LBitI(op, left, right));
739 } else { 743 } else {
740 ASSERT(instr->representation().IsTagged()); 744 ASSERT(instr->representation().IsTagged());
741 ASSERT(instr->left()->representation().IsTagged()); 745 ASSERT(instr->left()->representation().IsTagged());
742 ASSERT(instr->right()->representation().IsTagged()); 746 ASSERT(instr->right()->representation().IsTagged());
743 747
744 LOperand* left = UseFixed(instr->left(), edx); 748 LOperand* left = UseFixed(instr->left(), edx);
745 LOperand* right = UseFixed(instr->right(), eax); 749 LOperand* right = UseFixed(instr->right(), eax);
746 LArithmeticT* result = new LArithmeticT(op, left, right); 750 LArithmeticT* result = new LArithmeticT(op, left, right);
747 return MarkAsCall(DefineFixed(result, eax), instr); 751 return MarkAsCall(DefineFixed(result, eax), instr);
(...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after
1299 LArithmeticD* result = new LArithmeticD(Token::MOD, left, right); 1303 LArithmeticD* result = new LArithmeticD(Token::MOD, left, right);
1300 return MarkAsCall(DefineFixedDouble(result, xmm1), instr); 1304 return MarkAsCall(DefineFixedDouble(result, xmm1), instr);
1301 } 1305 }
1302 } 1306 }
1303 1307
1304 1308
1305 LInstruction* LChunkBuilder::DoMul(HMul* instr) { 1309 LInstruction* LChunkBuilder::DoMul(HMul* instr) {
1306 if (instr->representation().IsInteger32()) { 1310 if (instr->representation().IsInteger32()) {
1307 ASSERT(instr->left()->representation().IsInteger32()); 1311 ASSERT(instr->left()->representation().IsInteger32());
1308 ASSERT(instr->right()->representation().IsInteger32()); 1312 ASSERT(instr->right()->representation().IsInteger32());
1309 LOperand* left = UseRegisterAtStart(instr->LeastConstantOperand()); 1313 LOperand* left = UseRegisterAtStart(instr->left()->IsConstant()
1310 LOperand* right = UseOrConstant(instr->MostConstantOperand()); 1314 ? instr->right()
1315 : instr->left());
1316 LOperand* right = UseOrConstant(instr->left()->IsConstant()
1317 ? instr->left()
1318 : instr->right());
1311 LOperand* temp = NULL; 1319 LOperand* temp = NULL;
1312 if (instr->CheckFlag(HValue::kBailoutOnMinusZero)) { 1320 if (instr->CheckFlag(HValue::kBailoutOnMinusZero)) {
1313 temp = TempRegister(); 1321 temp = TempRegister();
1314 } 1322 }
1315 LMulI* mul = new LMulI(left, right, temp); 1323 LMulI* mul = new LMulI(left, right, temp);
1316 return AssignEnvironment(DefineSameAsFirst(mul)); 1324 return AssignEnvironment(DefineSameAsFirst(mul));
1317 } else if (instr->representation().IsDouble()) { 1325 } else if (instr->representation().IsDouble()) {
1318 return DoArithmeticD(Token::MUL, instr); 1326 return DoArithmeticD(Token::MUL, instr);
1319 } else { 1327 } else {
1320 ASSERT(instr->representation().IsTagged()); 1328 ASSERT(instr->representation().IsTagged());
(...skipping 20 matching lines...) Expand all
1341 ASSERT(instr->representation().IsTagged()); 1349 ASSERT(instr->representation().IsTagged());
1342 return DoArithmeticT(Token::SUB, instr); 1350 return DoArithmeticT(Token::SUB, instr);
1343 } 1351 }
1344 } 1352 }
1345 1353
1346 1354
1347 LInstruction* LChunkBuilder::DoAdd(HAdd* instr) { 1355 LInstruction* LChunkBuilder::DoAdd(HAdd* instr) {
1348 if (instr->representation().IsInteger32()) { 1356 if (instr->representation().IsInteger32()) {
1349 ASSERT(instr->left()->representation().IsInteger32()); 1357 ASSERT(instr->left()->representation().IsInteger32());
1350 ASSERT(instr->right()->representation().IsInteger32()); 1358 ASSERT(instr->right()->representation().IsInteger32());
1351 LOperand* left = UseRegisterAtStart(instr->LeastConstantOperand()); 1359 LOperand* left = UseRegisterAtStart(instr->left()->IsConstant()
1352 LOperand* right = UseOrConstantAtStart(instr->MostConstantOperand()); 1360 ? instr->right()
1361 : instr->left());
1362 LOperand* right = UseOrConstantAtStart(instr->left()->IsConstant()
1363 ? instr->left()
1364 : instr->right());
1353 LAddI* add = new LAddI(left, right); 1365 LAddI* add = new LAddI(left, right);
1354 LInstruction* result = DefineSameAsFirst(add); 1366 LInstruction* result = DefineSameAsFirst(add);
1355 if (instr->CheckFlag(HValue::kCanOverflow)) { 1367 if (instr->CheckFlag(HValue::kCanOverflow)) {
1356 result = AssignEnvironment(result); 1368 result = AssignEnvironment(result);
1357 } 1369 }
1358 return result; 1370 return result;
1359 } else if (instr->representation().IsDouble()) { 1371 } else if (instr->representation().IsDouble()) {
1360 return DoArithmeticD(Token::ADD, instr); 1372 return DoArithmeticD(Token::ADD, instr);
1361 } else { 1373 } else {
1362 ASSERT(instr->representation().IsTagged()); 1374 ASSERT(instr->representation().IsTagged());
(...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after
1891 LInstruction* LChunkBuilder::DoLeaveInlined(HLeaveInlined* instr) { 1903 LInstruction* LChunkBuilder::DoLeaveInlined(HLeaveInlined* instr) {
1892 HEnvironment* outer = current_block_->last_environment()->outer(); 1904 HEnvironment* outer = current_block_->last_environment()->outer();
1893 current_block_->UpdateEnvironment(outer); 1905 current_block_->UpdateEnvironment(outer);
1894 return NULL; 1906 return NULL;
1895 } 1907 }
1896 1908
1897 1909
1898 } } // namespace v8::internal 1910 } } // namespace v8::internal
1899 1911
1900 #endif // V8_TARGET_ARCH_IA32 1912 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/hydrogen-instructions.h ('k') | src/x64/lithium-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698