| OLD | NEW |
| 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 Loading... |
| 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(), a1); | |
| 838 LOperand* right = UseFixed(instr->right(), a0); | |
| 839 LArithmeticT* result = new LArithmeticT(op, left, right); | |
| 840 return MarkAsCall(DefineFixed(result, v0), 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(), a1); | 829 LOperand* left = UseFixed(instr->left(), a1); |
| 852 LOperand* right = UseFixed(instr->right(), a0); | 830 LOperand* right = UseFixed(instr->right(), a0); |
| 853 LArithmeticT* result = new LArithmeticT(op, left, right); | 831 LArithmeticT* result = new LArithmeticT(op, left, right); |
| 854 return MarkAsCall(DefineFixed(result, v0), instr); | 832 return MarkAsCall(DefineFixed(result, v0), instr); |
| (...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1235 LInstruction* LChunkBuilder::DoSar(HSar* instr) { | 1213 LInstruction* LChunkBuilder::DoSar(HSar* instr) { |
| 1236 return DoShift(Token::SAR, instr); | 1214 return DoShift(Token::SAR, instr); |
| 1237 } | 1215 } |
| 1238 | 1216 |
| 1239 | 1217 |
| 1240 LInstruction* LChunkBuilder::DoShl(HShl* instr) { | 1218 LInstruction* LChunkBuilder::DoShl(HShl* instr) { |
| 1241 return DoShift(Token::SHL, instr); | 1219 return DoShift(Token::SHL, instr); |
| 1242 } | 1220 } |
| 1243 | 1221 |
| 1244 | 1222 |
| 1245 LInstruction* LChunkBuilder::DoBitAnd(HBitAnd* instr) { | 1223 LInstruction* LChunkBuilder::DoBitwise(HBitwise* instr) { |
| 1246 return DoBit(Token::BIT_AND, instr); | 1224 if (instr->representation().IsInteger32()) { |
| 1225 ASSERT(instr->left()->representation().IsInteger32()); |
| 1226 ASSERT(instr->right()->representation().IsInteger32()); |
| 1227 |
| 1228 LOperand* left = UseRegisterAtStart(instr->LeastConstantOperand()); |
| 1229 LOperand* right = UseOrConstantAtStart(instr->MostConstantOperand()); |
| 1230 return DefineAsRegister(new LBitI(left, right)); |
| 1231 } else { |
| 1232 ASSERT(instr->representation().IsTagged()); |
| 1233 ASSERT(instr->left()->representation().IsTagged()); |
| 1234 ASSERT(instr->right()->representation().IsTagged()); |
| 1235 |
| 1236 LOperand* left = UseFixed(instr->left(), a1); |
| 1237 LOperand* right = UseFixed(instr->right(), a0); |
| 1238 LArithmeticT* result = new LArithmeticT(instr->op(), left, right); |
| 1239 return MarkAsCall(DefineFixed(result, v0), instr); |
| 1240 } |
| 1247 } | 1241 } |
| 1248 | 1242 |
| 1249 | 1243 |
| 1250 LInstruction* LChunkBuilder::DoBitNot(HBitNot* instr) { | 1244 LInstruction* LChunkBuilder::DoBitNot(HBitNot* instr) { |
| 1251 ASSERT(instr->value()->representation().IsInteger32()); | 1245 ASSERT(instr->value()->representation().IsInteger32()); |
| 1252 ASSERT(instr->representation().IsInteger32()); | 1246 ASSERT(instr->representation().IsInteger32()); |
| 1253 return DefineAsRegister(new LBitNotI(UseRegisterAtStart(instr->value()))); | 1247 return DefineAsRegister(new LBitNotI(UseRegisterAtStart(instr->value()))); |
| 1254 } | 1248 } |
| 1255 | 1249 |
| 1256 | 1250 |
| 1257 LInstruction* LChunkBuilder::DoBitOr(HBitOr* instr) { | |
| 1258 return DoBit(Token::BIT_OR, instr); | |
| 1259 } | |
| 1260 | |
| 1261 | |
| 1262 LInstruction* LChunkBuilder::DoBitXor(HBitXor* instr) { | |
| 1263 return DoBit(Token::BIT_XOR, instr); | |
| 1264 } | |
| 1265 | |
| 1266 | |
| 1267 LInstruction* LChunkBuilder::DoDiv(HDiv* instr) { | 1251 LInstruction* LChunkBuilder::DoDiv(HDiv* instr) { |
| 1268 if (instr->representation().IsDouble()) { | 1252 if (instr->representation().IsDouble()) { |
| 1269 return DoArithmeticD(Token::DIV, instr); | 1253 return DoArithmeticD(Token::DIV, instr); |
| 1270 } else if (instr->representation().IsInteger32()) { | 1254 } else if (instr->representation().IsInteger32()) { |
| 1271 // TODO(1042) The fixed register allocation | 1255 // TODO(1042) The fixed register allocation |
| 1272 // is needed because we call TypeRecordingBinaryOpStub from | 1256 // is needed because we call TypeRecordingBinaryOpStub from |
| 1273 // the generated code, which requires registers a0 | 1257 // the generated code, which requires registers a0 |
| 1274 // and a1 to be used. We should remove that | 1258 // and a1 to be used. We should remove that |
| 1275 // when we provide a native implementation. | 1259 // when we provide a native implementation. |
| 1276 LOperand* dividend = UseFixed(instr->left(), a0); | 1260 LOperand* dividend = UseFixed(instr->left(), a0); |
| (...skipping 932 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2209 | 2193 |
| 2210 LInstruction* LChunkBuilder::DoIn(HIn* instr) { | 2194 LInstruction* LChunkBuilder::DoIn(HIn* instr) { |
| 2211 LOperand* key = UseRegisterAtStart(instr->key()); | 2195 LOperand* key = UseRegisterAtStart(instr->key()); |
| 2212 LOperand* object = UseRegisterAtStart(instr->object()); | 2196 LOperand* object = UseRegisterAtStart(instr->object()); |
| 2213 LIn* result = new LIn(key, object); | 2197 LIn* result = new LIn(key, object); |
| 2214 return MarkAsCall(DefineFixed(result, v0), instr); | 2198 return MarkAsCall(DefineFixed(result, v0), instr); |
| 2215 } | 2199 } |
| 2216 | 2200 |
| 2217 | 2201 |
| 2218 } } // namespace v8::internal | 2202 } } // namespace v8::internal |
| OLD | NEW |