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

Side by Side Diff: src/arm/lithium-arm.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/arm/lithium-arm.h ('k') | src/hydrogen.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 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 DefineAsRegister(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* left = UseFixed(instr->left(), r1);
838 LOperand* right = UseFixed(instr->right(), r0);
839 LArithmeticT* result = new LArithmeticT(op, left, right);
840 return MarkAsCall(DefineFixed(result, r0), instr);
841 }
842 }
843
844
845 LInstruction* LChunkBuilder::DoShift(Token::Value op, 823 LInstruction* LChunkBuilder::DoShift(Token::Value op,
846 HBitwiseBinaryOperation* instr) { 824 HBitwiseBinaryOperation* instr) {
847 if (instr->representation().IsTagged()) { 825 if (instr->representation().IsTagged()) {
848 ASSERT(instr->left()->representation().IsTagged()); 826 ASSERT(instr->left()->representation().IsTagged());
849 ASSERT(instr->right()->representation().IsTagged()); 827 ASSERT(instr->right()->representation().IsTagged());
850 828
851 LOperand* left = UseFixed(instr->left(), r1); 829 LOperand* left = UseFixed(instr->left(), r1);
852 LOperand* right = UseFixed(instr->right(), r0); 830 LOperand* right = UseFixed(instr->right(), r0);
853 LArithmeticT* result = new LArithmeticT(op, left, right); 831 LArithmeticT* result = new LArithmeticT(op, left, right);
854 return MarkAsCall(DefineFixed(result, r0), instr); 832 return MarkAsCall(DefineFixed(result, r0), instr);
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after
1236 LInstruction* LChunkBuilder::DoSar(HSar* instr) { 1214 LInstruction* LChunkBuilder::DoSar(HSar* instr) {
1237 return DoShift(Token::SAR, instr); 1215 return DoShift(Token::SAR, instr);
1238 } 1216 }
1239 1217
1240 1218
1241 LInstruction* LChunkBuilder::DoShl(HShl* instr) { 1219 LInstruction* LChunkBuilder::DoShl(HShl* instr) {
1242 return DoShift(Token::SHL, instr); 1220 return DoShift(Token::SHL, instr);
1243 } 1221 }
1244 1222
1245 1223
1246 LInstruction* LChunkBuilder::DoBitAnd(HBitAnd* instr) { 1224 LInstruction* LChunkBuilder::DoBitwise(HBitwise* instr) {
1247 return DoBit(Token::BIT_AND, instr); 1225 if (instr->representation().IsInteger32()) {
1226 ASSERT(instr->left()->representation().IsInteger32());
1227 ASSERT(instr->right()->representation().IsInteger32());
1228
1229 LOperand* left = UseRegisterAtStart(instr->LeastConstantOperand());
1230 LOperand* right = UseOrConstantAtStart(instr->MostConstantOperand());
1231 return DefineAsRegister(new LBitI(left, right));
1232 } else {
1233 ASSERT(instr->representation().IsTagged());
1234 ASSERT(instr->left()->representation().IsTagged());
1235 ASSERT(instr->right()->representation().IsTagged());
1236
1237 LOperand* left = UseFixed(instr->left(), r1);
1238 LOperand* right = UseFixed(instr->right(), r0);
1239 LArithmeticT* result = new LArithmeticT(instr->op(), left, right);
1240 return MarkAsCall(DefineFixed(result, r0), instr);
1241 }
1248 } 1242 }
1249 1243
1250 1244
1251 LInstruction* LChunkBuilder::DoBitNot(HBitNot* instr) { 1245 LInstruction* LChunkBuilder::DoBitNot(HBitNot* instr) {
1252 ASSERT(instr->value()->representation().IsInteger32()); 1246 ASSERT(instr->value()->representation().IsInteger32());
1253 ASSERT(instr->representation().IsInteger32()); 1247 ASSERT(instr->representation().IsInteger32());
1254 return DefineAsRegister(new LBitNotI(UseRegisterAtStart(instr->value()))); 1248 return DefineAsRegister(new LBitNotI(UseRegisterAtStart(instr->value())));
1255 } 1249 }
1256 1250
1257 1251
1258 LInstruction* LChunkBuilder::DoBitOr(HBitOr* instr) {
1259 return DoBit(Token::BIT_OR, instr);
1260 }
1261
1262
1263 LInstruction* LChunkBuilder::DoBitXor(HBitXor* instr) {
1264 return DoBit(Token::BIT_XOR, instr);
1265 }
1266
1267
1268 LInstruction* LChunkBuilder::DoDiv(HDiv* instr) { 1252 LInstruction* LChunkBuilder::DoDiv(HDiv* instr) {
1269 if (instr->representation().IsDouble()) { 1253 if (instr->representation().IsDouble()) {
1270 return DoArithmeticD(Token::DIV, instr); 1254 return DoArithmeticD(Token::DIV, instr);
1271 } else if (instr->representation().IsInteger32()) { 1255 } else if (instr->representation().IsInteger32()) {
1272 // TODO(1042) The fixed register allocation 1256 // TODO(1042) The fixed register allocation
1273 // is needed because we call TypeRecordingBinaryOpStub from 1257 // is needed because we call TypeRecordingBinaryOpStub from
1274 // the generated code, which requires registers r0 1258 // the generated code, which requires registers r0
1275 // and r1 to be used. We should remove that 1259 // and r1 to be used. We should remove that
1276 // when we provide a native implementation. 1260 // when we provide a native implementation.
1277 LOperand* dividend = UseFixed(instr->left(), r0); 1261 LOperand* dividend = UseFixed(instr->left(), r0);
(...skipping 930 matching lines...) Expand 10 before | Expand all | Expand 10 after
2208 2192
2209 LInstruction* LChunkBuilder::DoIn(HIn* instr) { 2193 LInstruction* LChunkBuilder::DoIn(HIn* instr) {
2210 LOperand* key = UseRegisterAtStart(instr->key()); 2194 LOperand* key = UseRegisterAtStart(instr->key());
2211 LOperand* object = UseRegisterAtStart(instr->object()); 2195 LOperand* object = UseRegisterAtStart(instr->object());
2212 LIn* result = new LIn(key, object); 2196 LIn* result = new LIn(key, object);
2213 return MarkAsCall(DefineFixed(result, r0), instr); 2197 return MarkAsCall(DefineFixed(result, r0), instr);
2214 } 2198 }
2215 2199
2216 2200
2217 } } // namespace v8::internal 2201 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/arm/lithium-arm.h ('k') | src/hydrogen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698