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

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

Issue 8426005: Merge IR classes for different bitwise operations AND, OR and XOR into one class. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 9 years, 1 month 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/ia32/lithium-ia32.h ('k') | src/x64/lithium-x64.h » ('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 802 matching lines...) Expand 10 before | Expand all | Expand 10 after
813 LInstruction* LChunkBuilder::DoSoftDeoptimize(HSoftDeoptimize* instr) { 813 LInstruction* LChunkBuilder::DoSoftDeoptimize(HSoftDeoptimize* instr) {
814 return AssignEnvironment(new LDeoptimize); 814 return AssignEnvironment(new LDeoptimize);
815 } 815 }
816 816
817 817
818 LInstruction* LChunkBuilder::DoDeoptimize(HDeoptimize* instr) { 818 LInstruction* LChunkBuilder::DoDeoptimize(HDeoptimize* instr) {
819 return AssignEnvironment(new LDeoptimize); 819 return AssignEnvironment(new LDeoptimize);
820 } 820 }
821 821
822 822
823 LInstruction* LChunkBuilder::DoBit(Token::Value op,
824 HBitwiseBinaryOperation* instr) {
825 if (instr->representation().IsInteger32()) {
826 ASSERT(instr->left()->representation().IsInteger32());
827 ASSERT(instr->right()->representation().IsInteger32());
828
829 LOperand* left = UseRegisterAtStart(instr->LeastConstantOperand());
830 LOperand* right = UseOrConstantAtStart(instr->MostConstantOperand());
831 return DefineSameAsFirst(new LBitI(op, left, right));
832 } else {
833 ASSERT(instr->representation().IsTagged());
834 ASSERT(instr->left()->representation().IsTagged());
835 ASSERT(instr->right()->representation().IsTagged());
836
837 LOperand* context = UseFixed(instr->context(), esi);
838 LOperand* left = UseFixed(instr->left(), edx);
839 LOperand* right = UseFixed(instr->right(), eax);
840 LArithmeticT* result = new LArithmeticT(op, context, left, right);
841 return MarkAsCall(DefineFixed(result, eax), instr);
842 }
843 }
844
845
846 LInstruction* LChunkBuilder::DoShift(Token::Value op, 823 LInstruction* LChunkBuilder::DoShift(Token::Value op,
847 HBitwiseBinaryOperation* instr) { 824 HBitwiseBinaryOperation* instr) {
848 if (instr->representation().IsTagged()) { 825 if (instr->representation().IsTagged()) {
849 ASSERT(instr->left()->representation().IsTagged()); 826 ASSERT(instr->left()->representation().IsTagged());
850 ASSERT(instr->right()->representation().IsTagged()); 827 ASSERT(instr->right()->representation().IsTagged());
851 828
852 LOperand* context = UseFixed(instr->context(), esi); 829 LOperand* context = UseFixed(instr->context(), esi);
853 LOperand* left = UseFixed(instr->left(), edx); 830 LOperand* left = UseFixed(instr->left(), edx);
854 LOperand* right = UseFixed(instr->right(), eax); 831 LOperand* right = UseFixed(instr->right(), eax);
855 LArithmeticT* result = new LArithmeticT(op, context, left, right); 832 LArithmeticT* result = new LArithmeticT(op, context, left, right);
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after
1271 LInstruction* LChunkBuilder::DoSar(HSar* instr) { 1248 LInstruction* LChunkBuilder::DoSar(HSar* instr) {
1272 return DoShift(Token::SAR, instr); 1249 return DoShift(Token::SAR, instr);
1273 } 1250 }
1274 1251
1275 1252
1276 LInstruction* LChunkBuilder::DoShl(HShl* instr) { 1253 LInstruction* LChunkBuilder::DoShl(HShl* instr) {
1277 return DoShift(Token::SHL, instr); 1254 return DoShift(Token::SHL, instr);
1278 } 1255 }
1279 1256
1280 1257
1281 LInstruction* LChunkBuilder::DoBitAnd(HBitAnd* instr) { 1258 LInstruction* LChunkBuilder::DoBitwise(HBitwise* instr) {
1282 return DoBit(Token::BIT_AND, instr); 1259 if (instr->representation().IsInteger32()) {
1260 ASSERT(instr->left()->representation().IsInteger32());
1261 ASSERT(instr->right()->representation().IsInteger32());
1262
1263 LOperand* left = UseRegisterAtStart(instr->LeastConstantOperand());
1264 LOperand* right = UseOrConstantAtStart(instr->MostConstantOperand());
1265 return DefineSameAsFirst(new LBitI(left, right));
1266 } else {
1267 ASSERT(instr->representation().IsTagged());
1268 ASSERT(instr->left()->representation().IsTagged());
1269 ASSERT(instr->right()->representation().IsTagged());
1270
1271 LOperand* context = UseFixed(instr->context(), esi);
1272 LOperand* left = UseFixed(instr->left(), edx);
1273 LOperand* right = UseFixed(instr->right(), eax);
1274 LArithmeticT* result = new LArithmeticT(instr->op(), context, left, right);
1275 return MarkAsCall(DefineFixed(result, eax), instr);
1276 }
1283 } 1277 }
1284 1278
1285 1279
1286 LInstruction* LChunkBuilder::DoBitNot(HBitNot* instr) { 1280 LInstruction* LChunkBuilder::DoBitNot(HBitNot* instr) {
1287 ASSERT(instr->value()->representation().IsInteger32()); 1281 ASSERT(instr->value()->representation().IsInteger32());
1288 ASSERT(instr->representation().IsInteger32()); 1282 ASSERT(instr->representation().IsInteger32());
1289 LOperand* input = UseRegisterAtStart(instr->value()); 1283 LOperand* input = UseRegisterAtStart(instr->value());
1290 LBitNotI* result = new LBitNotI(input); 1284 LBitNotI* result = new LBitNotI(input);
1291 return DefineSameAsFirst(result); 1285 return DefineSameAsFirst(result);
1292 } 1286 }
1293 1287
1294 1288
1295 LInstruction* LChunkBuilder::DoBitOr(HBitOr* instr) {
1296 return DoBit(Token::BIT_OR, instr);
1297 }
1298
1299
1300 LInstruction* LChunkBuilder::DoBitXor(HBitXor* instr) {
1301 return DoBit(Token::BIT_XOR, instr);
1302 }
1303
1304
1305 LInstruction* LChunkBuilder::DoDiv(HDiv* instr) { 1289 LInstruction* LChunkBuilder::DoDiv(HDiv* instr) {
1306 if (instr->representation().IsDouble()) { 1290 if (instr->representation().IsDouble()) {
1307 return DoArithmeticD(Token::DIV, instr); 1291 return DoArithmeticD(Token::DIV, instr);
1308 } else if (instr->representation().IsInteger32()) { 1292 } else if (instr->representation().IsInteger32()) {
1309 // The temporary operand is necessary to ensure that right is not allocated 1293 // The temporary operand is necessary to ensure that right is not allocated
1310 // into edx. 1294 // into edx.
1311 LOperand* temp = FixedTemp(edx); 1295 LOperand* temp = FixedTemp(edx);
1312 LOperand* dividend = UseFixed(instr->left(), eax); 1296 LOperand* dividend = UseFixed(instr->left(), eax);
1313 LOperand* divisor = UseRegister(instr->right()); 1297 LOperand* divisor = UseRegister(instr->right());
1314 LDivI* result = new LDivI(dividend, divisor, temp); 1298 LDivI* result = new LDivI(dividend, divisor, temp);
(...skipping 995 matching lines...) Expand 10 before | Expand all | Expand 10 after
2310 LOperand* key = UseOrConstantAtStart(instr->key()); 2294 LOperand* key = UseOrConstantAtStart(instr->key());
2311 LOperand* object = UseOrConstantAtStart(instr->object()); 2295 LOperand* object = UseOrConstantAtStart(instr->object());
2312 LIn* result = new LIn(context, key, object); 2296 LIn* result = new LIn(context, key, object);
2313 return MarkAsCall(DefineFixed(result, eax), instr); 2297 return MarkAsCall(DefineFixed(result, eax), instr);
2314 } 2298 }
2315 2299
2316 2300
2317 } } // namespace v8::internal 2301 } } // namespace v8::internal
2318 2302
2319 #endif // V8_TARGET_ARCH_IA32 2303 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ia32/lithium-ia32.h ('k') | src/x64/lithium-x64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698