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 797 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
808 LInstruction* LChunkBuilder::DoSoftDeoptimize(HSoftDeoptimize* instr) { | 808 LInstruction* LChunkBuilder::DoSoftDeoptimize(HSoftDeoptimize* instr) { |
809 return AssignEnvironment(new LDeoptimize); | 809 return AssignEnvironment(new LDeoptimize); |
810 } | 810 } |
811 | 811 |
812 | 812 |
813 LInstruction* LChunkBuilder::DoDeoptimize(HDeoptimize* instr) { | 813 LInstruction* LChunkBuilder::DoDeoptimize(HDeoptimize* instr) { |
814 return AssignEnvironment(new LDeoptimize); | 814 return AssignEnvironment(new LDeoptimize); |
815 } | 815 } |
816 | 816 |
817 | 817 |
818 LInstruction* LChunkBuilder::DoBit(Token::Value op, | |
819 HBitwiseBinaryOperation* instr) { | |
820 if (instr->representation().IsInteger32()) { | |
821 ASSERT(instr->left()->representation().IsInteger32()); | |
822 ASSERT(instr->right()->representation().IsInteger32()); | |
823 | |
824 LOperand* left = UseRegisterAtStart(instr->LeastConstantOperand()); | |
825 LOperand* right = UseOrConstantAtStart(instr->MostConstantOperand()); | |
826 return DefineSameAsFirst(new LBitI(op, left, right)); | |
827 } else { | |
828 ASSERT(instr->representation().IsTagged()); | |
829 ASSERT(instr->left()->representation().IsTagged()); | |
830 ASSERT(instr->right()->representation().IsTagged()); | |
831 | |
832 LOperand* left = UseFixed(instr->left(), rdx); | |
833 LOperand* right = UseFixed(instr->right(), rax); | |
834 LArithmeticT* result = new LArithmeticT(op, left, right); | |
835 return MarkAsCall(DefineFixed(result, rax), instr); | |
836 } | |
837 } | |
838 | |
839 | |
840 LInstruction* LChunkBuilder::DoShift(Token::Value op, | 818 LInstruction* LChunkBuilder::DoShift(Token::Value op, |
841 HBitwiseBinaryOperation* instr) { | 819 HBitwiseBinaryOperation* instr) { |
842 if (instr->representation().IsTagged()) { | 820 if (instr->representation().IsTagged()) { |
843 ASSERT(instr->left()->representation().IsTagged()); | 821 ASSERT(instr->left()->representation().IsTagged()); |
844 ASSERT(instr->right()->representation().IsTagged()); | 822 ASSERT(instr->right()->representation().IsTagged()); |
845 | 823 |
846 LOperand* left = UseFixed(instr->left(), rdx); | 824 LOperand* left = UseFixed(instr->left(), rdx); |
847 LOperand* right = UseFixed(instr->right(), rax); | 825 LOperand* right = UseFixed(instr->right(), rax); |
848 LArithmeticT* result = new LArithmeticT(op, left, right); | 826 LArithmeticT* result = new LArithmeticT(op, left, right); |
849 return MarkAsCall(DefineFixed(result, rax), instr); | 827 return MarkAsCall(DefineFixed(result, rax), instr); |
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1232 LInstruction* LChunkBuilder::DoSar(HSar* instr) { | 1210 LInstruction* LChunkBuilder::DoSar(HSar* instr) { |
1233 return DoShift(Token::SAR, instr); | 1211 return DoShift(Token::SAR, instr); |
1234 } | 1212 } |
1235 | 1213 |
1236 | 1214 |
1237 LInstruction* LChunkBuilder::DoShl(HShl* instr) { | 1215 LInstruction* LChunkBuilder::DoShl(HShl* instr) { |
1238 return DoShift(Token::SHL, instr); | 1216 return DoShift(Token::SHL, instr); |
1239 } | 1217 } |
1240 | 1218 |
1241 | 1219 |
1242 LInstruction* LChunkBuilder::DoBitAnd(HBitAnd* instr) { | 1220 LInstruction* LChunkBuilder::DoBitwise(HBitwise* instr) { |
1243 return DoBit(Token::BIT_AND, instr); | 1221 if (instr->representation().IsInteger32()) { |
| 1222 ASSERT(instr->left()->representation().IsInteger32()); |
| 1223 ASSERT(instr->right()->representation().IsInteger32()); |
| 1224 |
| 1225 LOperand* left = UseRegisterAtStart(instr->LeastConstantOperand()); |
| 1226 LOperand* right = UseOrConstantAtStart(instr->MostConstantOperand()); |
| 1227 return DefineSameAsFirst(new LBitI(left, right)); |
| 1228 } else { |
| 1229 ASSERT(instr->representation().IsTagged()); |
| 1230 ASSERT(instr->left()->representation().IsTagged()); |
| 1231 ASSERT(instr->right()->representation().IsTagged()); |
| 1232 |
| 1233 LOperand* left = UseFixed(instr->left(), rdx); |
| 1234 LOperand* right = UseFixed(instr->right(), rax); |
| 1235 LArithmeticT* result = new LArithmeticT(instr->op(), left, right); |
| 1236 return MarkAsCall(DefineFixed(result, rax), instr); |
| 1237 } |
1244 } | 1238 } |
1245 | 1239 |
1246 | 1240 |
1247 LInstruction* LChunkBuilder::DoBitNot(HBitNot* instr) { | 1241 LInstruction* LChunkBuilder::DoBitNot(HBitNot* instr) { |
1248 ASSERT(instr->value()->representation().IsInteger32()); | 1242 ASSERT(instr->value()->representation().IsInteger32()); |
1249 ASSERT(instr->representation().IsInteger32()); | 1243 ASSERT(instr->representation().IsInteger32()); |
1250 LOperand* input = UseRegisterAtStart(instr->value()); | 1244 LOperand* input = UseRegisterAtStart(instr->value()); |
1251 LBitNotI* result = new LBitNotI(input); | 1245 LBitNotI* result = new LBitNotI(input); |
1252 return DefineSameAsFirst(result); | 1246 return DefineSameAsFirst(result); |
1253 } | 1247 } |
1254 | 1248 |
1255 | 1249 |
1256 LInstruction* LChunkBuilder::DoBitOr(HBitOr* instr) { | |
1257 return DoBit(Token::BIT_OR, instr); | |
1258 } | |
1259 | |
1260 | |
1261 LInstruction* LChunkBuilder::DoBitXor(HBitXor* instr) { | |
1262 return DoBit(Token::BIT_XOR, instr); | |
1263 } | |
1264 | |
1265 | |
1266 LInstruction* LChunkBuilder::DoDiv(HDiv* instr) { | 1250 LInstruction* LChunkBuilder::DoDiv(HDiv* instr) { |
1267 if (instr->representation().IsDouble()) { | 1251 if (instr->representation().IsDouble()) { |
1268 return DoArithmeticD(Token::DIV, instr); | 1252 return DoArithmeticD(Token::DIV, instr); |
1269 } else if (instr->representation().IsInteger32()) { | 1253 } else if (instr->representation().IsInteger32()) { |
1270 // The temporary operand is necessary to ensure that right is not allocated | 1254 // The temporary operand is necessary to ensure that right is not allocated |
1271 // into rdx. | 1255 // into rdx. |
1272 LOperand* temp = FixedTemp(rdx); | 1256 LOperand* temp = FixedTemp(rdx); |
1273 LOperand* dividend = UseFixed(instr->left(), rax); | 1257 LOperand* dividend = UseFixed(instr->left(), rax); |
1274 LOperand* divisor = UseRegister(instr->right()); | 1258 LOperand* divisor = UseRegister(instr->right()); |
1275 LDivI* result = new LDivI(dividend, divisor, temp); | 1259 LDivI* result = new LDivI(dividend, divisor, temp); |
(...skipping 933 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2209 LOperand* key = UseOrConstantAtStart(instr->key()); | 2193 LOperand* key = UseOrConstantAtStart(instr->key()); |
2210 LOperand* object = UseOrConstantAtStart(instr->object()); | 2194 LOperand* object = UseOrConstantAtStart(instr->object()); |
2211 LIn* result = new LIn(key, object); | 2195 LIn* result = new LIn(key, object); |
2212 return MarkAsCall(DefineFixed(result, rax), instr); | 2196 return MarkAsCall(DefineFixed(result, rax), instr); |
2213 } | 2197 } |
2214 | 2198 |
2215 | 2199 |
2216 } } // namespace v8::internal | 2200 } } // namespace v8::internal |
2217 | 2201 |
2218 #endif // V8_TARGET_ARCH_X64 | 2202 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |