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 806 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
817 ASSERT(instr->right()->representation().IsInteger32()); | 817 ASSERT(instr->right()->representation().IsInteger32()); |
818 | 818 |
819 LOperand* left = UseRegisterAtStart(instr->LeastConstantOperand()); | 819 LOperand* left = UseRegisterAtStart(instr->LeastConstantOperand()); |
820 LOperand* right = UseOrConstantAtStart(instr->MostConstantOperand()); | 820 LOperand* right = UseOrConstantAtStart(instr->MostConstantOperand()); |
821 return DefineSameAsFirst(new LBitI(op, left, right)); | 821 return DefineSameAsFirst(new LBitI(op, left, right)); |
822 } else { | 822 } else { |
823 ASSERT(instr->representation().IsTagged()); | 823 ASSERT(instr->representation().IsTagged()); |
824 ASSERT(instr->left()->representation().IsTagged()); | 824 ASSERT(instr->left()->representation().IsTagged()); |
825 ASSERT(instr->right()->representation().IsTagged()); | 825 ASSERT(instr->right()->representation().IsTagged()); |
826 | 826 |
827 LOperand* context = UseFixed(instr->context(), esi); | |
827 LOperand* left = UseFixed(instr->left(), edx); | 828 LOperand* left = UseFixed(instr->left(), edx); |
828 LOperand* right = UseFixed(instr->right(), eax); | 829 LOperand* right = UseFixed(instr->right(), eax); |
829 LArithmeticT* result = new LArithmeticT(op, left, right); | 830 LArithmeticT* result = new LArithmeticT(op, context, left, right); |
830 return MarkAsCall(DefineFixed(result, eax), instr); | 831 return MarkAsCall(DefineFixed(result, eax), instr); |
831 } | 832 } |
832 } | 833 } |
833 | 834 |
834 | 835 |
835 LInstruction* LChunkBuilder::DoShift(Token::Value op, | 836 LInstruction* LChunkBuilder::DoShift(Token::Value op, |
836 HBitwiseBinaryOperation* instr) { | 837 HBitwiseBinaryOperation* instr) { |
837 if (instr->representation().IsTagged()) { | 838 if (instr->representation().IsTagged()) { |
838 ASSERT(instr->left()->representation().IsTagged()); | 839 ASSERT(instr->left()->representation().IsTagged()); |
839 ASSERT(instr->right()->representation().IsTagged()); | 840 ASSERT(instr->right()->representation().IsTagged()); |
840 | 841 |
842 LOperand* context = UseFixed(instr->context(), esi); | |
841 LOperand* left = UseFixed(instr->left(), edx); | 843 LOperand* left = UseFixed(instr->left(), edx); |
842 LOperand* right = UseFixed(instr->right(), eax); | 844 LOperand* right = UseFixed(instr->right(), eax); |
843 LArithmeticT* result = new LArithmeticT(op, left, right); | 845 LArithmeticT* result = new LArithmeticT(op, context, left, right); |
844 return MarkAsCall(DefineFixed(result, eax), instr); | 846 return MarkAsCall(DefineFixed(result, eax), instr); |
845 } | 847 } |
846 | 848 |
847 ASSERT(instr->representation().IsInteger32()); | 849 ASSERT(instr->representation().IsInteger32()); |
848 ASSERT(instr->OperandAt(0)->representation().IsInteger32()); | 850 ASSERT(instr->left()->representation().IsInteger32()); |
849 ASSERT(instr->OperandAt(1)->representation().IsInteger32()); | 851 ASSERT(instr->right()->representation().IsInteger32()); |
850 LOperand* left = UseRegisterAtStart(instr->OperandAt(0)); | 852 LOperand* left = UseRegisterAtStart(instr->left()); |
851 | 853 |
852 HValue* right_value = instr->OperandAt(1); | 854 HValue* right_value = instr->right(); |
853 LOperand* right = NULL; | 855 LOperand* right = NULL; |
854 int constant_value = 0; | 856 int constant_value = 0; |
855 if (right_value->IsConstant()) { | 857 if (right_value->IsConstant()) { |
856 HConstant* constant = HConstant::cast(right_value); | 858 HConstant* constant = HConstant::cast(right_value); |
857 right = chunk_->DefineConstantOperand(constant); | 859 right = chunk_->DefineConstantOperand(constant); |
858 constant_value = constant->Integer32Value() & 0x1f; | 860 constant_value = constant->Integer32Value() & 0x1f; |
859 } else { | 861 } else { |
860 right = UseFixed(right_value, ecx); | 862 right = UseFixed(right_value, ecx); |
861 } | 863 } |
862 | 864 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
896 HArithmeticBinaryOperation* instr) { | 898 HArithmeticBinaryOperation* instr) { |
897 ASSERT(op == Token::ADD || | 899 ASSERT(op == Token::ADD || |
898 op == Token::DIV || | 900 op == Token::DIV || |
899 op == Token::MOD || | 901 op == Token::MOD || |
900 op == Token::MUL || | 902 op == Token::MUL || |
901 op == Token::SUB); | 903 op == Token::SUB); |
902 HValue* left = instr->left(); | 904 HValue* left = instr->left(); |
903 HValue* right = instr->right(); | 905 HValue* right = instr->right(); |
904 ASSERT(left->representation().IsTagged()); | 906 ASSERT(left->representation().IsTagged()); |
905 ASSERT(right->representation().IsTagged()); | 907 ASSERT(right->representation().IsTagged()); |
908 LOperand* context = UseFixed(instr->context(), esi); | |
906 LOperand* left_operand = UseFixed(left, edx); | 909 LOperand* left_operand = UseFixed(left, edx); |
907 LOperand* right_operand = UseFixed(right, eax); | 910 LOperand* right_operand = UseFixed(right, eax); |
908 LArithmeticT* result = new LArithmeticT(op, left_operand, right_operand); | 911 LArithmeticT* result = |
912 new LArithmeticT(op, context, left_operand, right_operand); | |
909 return MarkAsCall(DefineFixed(result, eax), instr); | 913 return MarkAsCall(DefineFixed(result, eax), instr); |
910 } | 914 } |
911 | 915 |
916 | |
912 void LChunkBuilder::DoBasicBlock(HBasicBlock* block, HBasicBlock* next_block) { | 917 void LChunkBuilder::DoBasicBlock(HBasicBlock* block, HBasicBlock* next_block) { |
913 ASSERT(is_building()); | 918 ASSERT(is_building()); |
914 current_block_ = block; | 919 current_block_ = block; |
915 next_block_ = next_block; | 920 next_block_ = next_block; |
916 if (block->IsStartBlock()) { | 921 if (block->IsStartBlock()) { |
917 block->UpdateEnvironment(graph_->start_environment()); | 922 block->UpdateEnvironment(graph_->start_environment()); |
918 argument_count_ = 0; | 923 argument_count_ = 0; |
919 } else if (block->predecessors()->length() == 1) { | 924 } else if (block->predecessors()->length() == 1) { |
920 // We have a single predecessor => copy environment and outgoing | 925 // We have a single predecessor => copy environment and outgoing |
921 // argument count from the predecessor. | 926 // argument count from the predecessor. |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1148 LOperand* context = UseFixed(instr->context(), esi); | 1153 LOperand* context = UseFixed(instr->context(), esi); |
1149 LInstanceOf* result = new LInstanceOf(context, left, right); | 1154 LInstanceOf* result = new LInstanceOf(context, left, right); |
1150 return MarkAsCall(DefineFixed(result, eax), instr); | 1155 return MarkAsCall(DefineFixed(result, eax), instr); |
1151 } | 1156 } |
1152 | 1157 |
1153 | 1158 |
1154 LInstruction* LChunkBuilder::DoInstanceOfKnownGlobal( | 1159 LInstruction* LChunkBuilder::DoInstanceOfKnownGlobal( |
1155 HInstanceOfKnownGlobal* instr) { | 1160 HInstanceOfKnownGlobal* instr) { |
1156 LInstanceOfKnownGlobal* result = | 1161 LInstanceOfKnownGlobal* result = |
1157 new LInstanceOfKnownGlobal( | 1162 new LInstanceOfKnownGlobal( |
1158 UseFixed(instr->value(), InstanceofStub::left()), | 1163 UseFixed(instr->context(), esi), |
1164 UseFixed(instr->left(), InstanceofStub::left()), | |
1159 FixedTemp(edi)); | 1165 FixedTemp(edi)); |
1160 return MarkAsCall(DefineFixed(result, eax), instr); | 1166 return MarkAsCall(DefineFixed(result, eax), instr); |
1161 } | 1167 } |
1162 | 1168 |
1163 | 1169 |
1164 LInstruction* LChunkBuilder::DoApplyArguments(HApplyArguments* instr) { | 1170 LInstruction* LChunkBuilder::DoApplyArguments(HApplyArguments* instr) { |
1165 LOperand* function = UseFixed(instr->function(), edi); | 1171 LOperand* function = UseFixed(instr->function(), edi); |
1166 LOperand* receiver = UseFixed(instr->receiver(), eax); | 1172 LOperand* receiver = UseFixed(instr->receiver(), eax); |
1167 LOperand* length = UseFixed(instr->length(), ebx); | 1173 LOperand* length = UseFixed(instr->length(), ebx); |
1168 LOperand* elements = UseFixed(instr->elements(), ecx); | 1174 LOperand* elements = UseFixed(instr->elements(), ecx); |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1225 LInvokeFunction* result = new LInvokeFunction(context, function); | 1231 LInvokeFunction* result = new LInvokeFunction(context, function); |
1226 return MarkAsCall(DefineFixed(result, eax), instr, CANNOT_DEOPTIMIZE_EAGERLY); | 1232 return MarkAsCall(DefineFixed(result, eax), instr, CANNOT_DEOPTIMIZE_EAGERLY); |
1227 } | 1233 } |
1228 | 1234 |
1229 | 1235 |
1230 LInstruction* LChunkBuilder::DoUnaryMathOperation(HUnaryMathOperation* instr) { | 1236 LInstruction* LChunkBuilder::DoUnaryMathOperation(HUnaryMathOperation* instr) { |
1231 BuiltinFunctionId op = instr->op(); | 1237 BuiltinFunctionId op = instr->op(); |
1232 if (op == kMathLog) { | 1238 if (op == kMathLog) { |
1233 ASSERT(instr->representation().IsDouble()); | 1239 ASSERT(instr->representation().IsDouble()); |
1234 ASSERT(instr->value()->representation().IsDouble()); | 1240 ASSERT(instr->value()->representation().IsDouble()); |
1241 LOperand* context = UseAny(instr->context()); // Not actually used. | |
1235 LOperand* input = UseRegisterAtStart(instr->value()); | 1242 LOperand* input = UseRegisterAtStart(instr->value()); |
1236 LUnaryMathOperation* result = new LUnaryMathOperation(input); | 1243 LUnaryMathOperation* result = new LUnaryMathOperation(context, input); |
1237 return DefineSameAsFirst(result); | 1244 return DefineSameAsFirst(result); |
1238 } else if (op == kMathSin || op == kMathCos) { | 1245 } else if (op == kMathSin || op == kMathCos) { |
1246 LOperand* context = UseFixed(instr->context(), esi); | |
1239 LOperand* input = UseFixedDouble(instr->value(), xmm1); | 1247 LOperand* input = UseFixedDouble(instr->value(), xmm1); |
1240 LUnaryMathOperation* result = new LUnaryMathOperation(input); | 1248 LUnaryMathOperation* result = new LUnaryMathOperation(context, input); |
1241 return MarkAsCall(DefineFixedDouble(result, xmm1), instr); | 1249 return MarkAsCall(DefineFixedDouble(result, xmm1), instr); |
1242 } else { | 1250 } else { |
1243 LOperand* input = UseRegisterAtStart(instr->value()); | 1251 LOperand* input = UseRegisterAtStart(instr->value()); |
1244 LUnaryMathOperation* result = new LUnaryMathOperation(input); | 1252 LOperand* context = UseAny(instr->context()); // Deferred use by MathAbs. |
1253 LUnaryMathOperation* result = new LUnaryMathOperation(context, input); | |
1245 switch (op) { | 1254 switch (op) { |
1246 case kMathAbs: | 1255 case kMathAbs: |
1247 return AssignEnvironment(AssignPointerMap(DefineSameAsFirst(result))); | 1256 return AssignEnvironment(AssignPointerMap(DefineSameAsFirst(result))); |
1248 case kMathFloor: | 1257 case kMathFloor: |
1249 return AssignEnvironment(DefineAsRegister(result)); | 1258 return AssignEnvironment(DefineAsRegister(result)); |
1250 case kMathRound: | 1259 case kMathRound: |
1251 return AssignEnvironment(DefineAsRegister(result)); | 1260 return AssignEnvironment(DefineAsRegister(result)); |
1252 case kMathSqrt: | 1261 case kMathSqrt: |
1253 return DefineSameAsFirst(result); | 1262 return DefineSameAsFirst(result); |
1254 case kMathPowHalf: | 1263 case kMathPowHalf: |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1305 LInstruction* LChunkBuilder::DoCallFunction(HCallFunction* instr) { | 1314 LInstruction* LChunkBuilder::DoCallFunction(HCallFunction* instr) { |
1306 LOperand* context = UseFixed(instr->context(), esi); | 1315 LOperand* context = UseFixed(instr->context(), esi); |
1307 argument_count_ -= instr->argument_count(); | 1316 argument_count_ -= instr->argument_count(); |
1308 LCallFunction* result = new LCallFunction(context); | 1317 LCallFunction* result = new LCallFunction(context); |
1309 return MarkAsCall(DefineFixed(result, eax), instr); | 1318 return MarkAsCall(DefineFixed(result, eax), instr); |
1310 } | 1319 } |
1311 | 1320 |
1312 | 1321 |
1313 LInstruction* LChunkBuilder::DoCallRuntime(HCallRuntime* instr) { | 1322 LInstruction* LChunkBuilder::DoCallRuntime(HCallRuntime* instr) { |
1314 argument_count_ -= instr->argument_count(); | 1323 argument_count_ -= instr->argument_count(); |
1315 return MarkAsCall(DefineFixed(new LCallRuntime, eax), instr); | 1324 LOperand* context = UseFixed(instr->context(), esi); |
1325 return MarkAsCall(DefineFixed(new LCallRuntime(context), eax), instr); | |
1316 } | 1326 } |
1317 | 1327 |
1318 | 1328 |
1319 LInstruction* LChunkBuilder::DoShr(HShr* instr) { | 1329 LInstruction* LChunkBuilder::DoShr(HShr* instr) { |
1320 return DoShift(Token::SHR, instr); | 1330 return DoShift(Token::SHR, instr); |
1321 } | 1331 } |
1322 | 1332 |
1323 | 1333 |
1324 LInstruction* LChunkBuilder::DoSar(HSar* instr) { | 1334 LInstruction* LChunkBuilder::DoSar(HSar* instr) { |
1325 return DoShift(Token::SAR, instr); | 1335 return DoShift(Token::SAR, instr); |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1504 } else if (r.IsDouble()) { | 1514 } else if (r.IsDouble()) { |
1505 ASSERT(instr->left()->representation().IsDouble()); | 1515 ASSERT(instr->left()->representation().IsDouble()); |
1506 ASSERT(instr->right()->representation().IsDouble()); | 1516 ASSERT(instr->right()->representation().IsDouble()); |
1507 LOperand* left = UseRegisterAtStart(instr->left()); | 1517 LOperand* left = UseRegisterAtStart(instr->left()); |
1508 LOperand* right = UseRegisterAtStart(instr->right()); | 1518 LOperand* right = UseRegisterAtStart(instr->right()); |
1509 return DefineAsRegister(new LCmpID(left, right)); | 1519 return DefineAsRegister(new LCmpID(left, right)); |
1510 } else { | 1520 } else { |
1511 ASSERT(instr->left()->representation().IsTagged()); | 1521 ASSERT(instr->left()->representation().IsTagged()); |
1512 ASSERT(instr->right()->representation().IsTagged()); | 1522 ASSERT(instr->right()->representation().IsTagged()); |
1513 bool reversed = (op == Token::GT || op == Token::LTE); | 1523 bool reversed = (op == Token::GT || op == Token::LTE); |
1524 LOperand* context = UseFixed(instr->context(), esi); | |
1514 LOperand* left = UseFixed(instr->left(), reversed ? eax : edx); | 1525 LOperand* left = UseFixed(instr->left(), reversed ? eax : edx); |
1515 LOperand* right = UseFixed(instr->right(), reversed ? edx : eax); | 1526 LOperand* right = UseFixed(instr->right(), reversed ? edx : eax); |
1516 LCmpT* result = new LCmpT(left, right); | 1527 LCmpT* result = new LCmpT(context, left, right); |
1517 return MarkAsCall(DefineFixed(result, eax), instr); | 1528 return MarkAsCall(DefineFixed(result, eax), instr); |
1518 } | 1529 } |
1519 } | 1530 } |
1520 | 1531 |
1521 | 1532 |
1522 LInstruction* LChunkBuilder::DoCompareObjectEq(HCompareObjectEq* instr) { | 1533 LInstruction* LChunkBuilder::DoCompareObjectEq(HCompareObjectEq* instr) { |
1523 LOperand* left = UseRegisterAtStart(instr->left()); | 1534 LOperand* left = UseRegisterAtStart(instr->left()); |
1524 LOperand* right = UseRegisterAtStart(instr->right()); | 1535 LOperand* right = UseRegisterAtStart(instr->right()); |
1525 LCmpObjectEq* result = new LCmpObjectEq(left, right); | 1536 LCmpObjectEq* result = new LCmpObjectEq(left, right); |
1526 return DefineAsRegister(result); | 1537 return DefineAsRegister(result); |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1639 | 1650 |
1640 | 1651 |
1641 LInstruction* LChunkBuilder::DoAbnormalExit(HAbnormalExit* instr) { | 1652 LInstruction* LChunkBuilder::DoAbnormalExit(HAbnormalExit* instr) { |
1642 // The control instruction marking the end of a block that completed | 1653 // The control instruction marking the end of a block that completed |
1643 // abruptly (e.g., threw an exception). There is nothing specific to do. | 1654 // abruptly (e.g., threw an exception). There is nothing specific to do. |
1644 return NULL; | 1655 return NULL; |
1645 } | 1656 } |
1646 | 1657 |
1647 | 1658 |
1648 LInstruction* LChunkBuilder::DoThrow(HThrow* instr) { | 1659 LInstruction* LChunkBuilder::DoThrow(HThrow* instr) { |
1660 LOperand* context = UseFixed(instr->context(), esi); | |
1649 LOperand* value = UseFixed(instr->value(), eax); | 1661 LOperand* value = UseFixed(instr->value(), eax); |
1650 return MarkAsCall(new LThrow(value), instr); | 1662 return MarkAsCall(new LThrow(context, value), instr); |
1651 } | 1663 } |
1652 | 1664 |
1653 | 1665 |
1654 LInstruction* LChunkBuilder::DoUseConst(HUseConst* instr) { | 1666 LInstruction* LChunkBuilder::DoUseConst(HUseConst* instr) { |
1655 return NULL; | 1667 return NULL; |
1656 } | 1668 } |
1657 | 1669 |
1658 | 1670 |
1659 LInstruction* LChunkBuilder::DoForceRepresentation(HForceRepresentation* bad) { | 1671 LInstruction* LChunkBuilder::DoForceRepresentation(HForceRepresentation* bad) { |
1660 // All HForceRepresentation instructions should be eliminated in the | 1672 // All HForceRepresentation instructions should be eliminated in the |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1898 LInstruction* LChunkBuilder::DoLoadNamedField(HLoadNamedField* instr) { | 1910 LInstruction* LChunkBuilder::DoLoadNamedField(HLoadNamedField* instr) { |
1899 ASSERT(instr->representation().IsTagged()); | 1911 ASSERT(instr->representation().IsTagged()); |
1900 LOperand* obj = UseRegisterAtStart(instr->object()); | 1912 LOperand* obj = UseRegisterAtStart(instr->object()); |
1901 return DefineAsRegister(new LLoadNamedField(obj)); | 1913 return DefineAsRegister(new LLoadNamedField(obj)); |
1902 } | 1914 } |
1903 | 1915 |
1904 | 1916 |
1905 LInstruction* LChunkBuilder::DoLoadNamedFieldPolymorphic( | 1917 LInstruction* LChunkBuilder::DoLoadNamedFieldPolymorphic( |
1906 HLoadNamedFieldPolymorphic* instr) { | 1918 HLoadNamedFieldPolymorphic* instr) { |
1907 ASSERT(instr->representation().IsTagged()); | 1919 ASSERT(instr->representation().IsTagged()); |
1920 LOperand* context = UseFixed(instr->context(), esi); | |
1908 if (instr->need_generic()) { | 1921 if (instr->need_generic()) { |
1909 LOperand* obj = UseFixed(instr->object(), eax); | 1922 LOperand* obj = UseFixed(instr->object(), eax); |
1910 LLoadNamedFieldPolymorphic* result = new LLoadNamedFieldPolymorphic(obj); | 1923 LLoadNamedFieldPolymorphic* result = |
1924 new LLoadNamedFieldPolymorphic(context,obj); | |
1911 return MarkAsCall(DefineFixed(result, eax), instr); | 1925 return MarkAsCall(DefineFixed(result, eax), instr); |
1912 } else { | 1926 } else { |
1913 LOperand* obj = UseRegisterAtStart(instr->object()); | 1927 LOperand* obj = UseRegisterAtStart(instr->object()); |
1914 LLoadNamedFieldPolymorphic* result = new LLoadNamedFieldPolymorphic(obj); | 1928 LLoadNamedFieldPolymorphic* result = |
1929 new LLoadNamedFieldPolymorphic(context, obj); | |
1915 return AssignEnvironment(DefineAsRegister(result)); | 1930 return AssignEnvironment(DefineAsRegister(result)); |
1916 } | 1931 } |
1917 } | 1932 } |
1918 | 1933 |
1919 | 1934 |
1920 LInstruction* LChunkBuilder::DoLoadNamedGeneric(HLoadNamedGeneric* instr) { | 1935 LInstruction* LChunkBuilder::DoLoadNamedGeneric(HLoadNamedGeneric* instr) { |
1921 LOperand* context = UseFixed(instr->context(), esi); | 1936 LOperand* context = UseFixed(instr->context(), esi); |
1922 LOperand* object = UseFixed(instr->object(), eax); | 1937 LOperand* object = UseFixed(instr->object(), eax); |
1923 LLoadNamedGeneric* result = new LLoadNamedGeneric(context, object); | 1938 LLoadNamedGeneric* result = new LLoadNamedGeneric(context, object); |
1924 return MarkAsCall(DefineFixed(result, eax), instr); | 1939 return MarkAsCall(DefineFixed(result, eax), instr); |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2085 LOperand* context = UseFixed(instr->context(), esi); | 2100 LOperand* context = UseFixed(instr->context(), esi); |
2086 LOperand* object = UseFixed(instr->object(), edx); | 2101 LOperand* object = UseFixed(instr->object(), edx); |
2087 LOperand* value = UseFixed(instr->value(), eax); | 2102 LOperand* value = UseFixed(instr->value(), eax); |
2088 | 2103 |
2089 LStoreNamedGeneric* result = new LStoreNamedGeneric(context, object, value); | 2104 LStoreNamedGeneric* result = new LStoreNamedGeneric(context, object, value); |
2090 return MarkAsCall(result, instr); | 2105 return MarkAsCall(result, instr); |
2091 } | 2106 } |
2092 | 2107 |
2093 | 2108 |
2094 LInstruction* LChunkBuilder::DoStringAdd(HStringAdd* instr) { | 2109 LInstruction* LChunkBuilder::DoStringAdd(HStringAdd* instr) { |
2110 LOperand* context = UseFixed(instr->context(), esi); | |
2095 LOperand* left = UseOrConstantAtStart(instr->left()); | 2111 LOperand* left = UseOrConstantAtStart(instr->left()); |
2096 LOperand* right = UseOrConstantAtStart(instr->right()); | 2112 LOperand* right = UseOrConstantAtStart(instr->right()); |
2097 return MarkAsCall(DefineFixed(new LStringAdd(left, right), eax), instr); | 2113 LStringAdd* string_add = new LStringAdd(context, left, right); |
2114 return MarkAsCall(DefineFixed(string_add, eax), instr); | |
2098 } | 2115 } |
2099 | 2116 |
2100 | 2117 |
2101 LInstruction* LChunkBuilder::DoStringCharCodeAt(HStringCharCodeAt* instr) { | 2118 LInstruction* LChunkBuilder::DoStringCharCodeAt(HStringCharCodeAt* instr) { |
2102 LOperand* string = UseRegister(instr->string()); | 2119 LOperand* string = UseRegister(instr->string()); |
2103 LOperand* index = UseRegisterOrConstant(instr->index()); | 2120 LOperand* index = UseRegisterOrConstant(instr->index()); |
2104 LStringCharCodeAt* result = new LStringCharCodeAt(string, index); | 2121 LOperand* context = UseAny(instr->context()); |
2122 LStringCharCodeAt* result = new LStringCharCodeAt(context, string, index); | |
2105 return AssignEnvironment(AssignPointerMap(DefineAsRegister(result))); | 2123 return AssignEnvironment(AssignPointerMap(DefineAsRegister(result))); |
2106 } | 2124 } |
2107 | 2125 |
2108 | 2126 |
2109 LInstruction* LChunkBuilder::DoStringCharFromCode(HStringCharFromCode* instr) { | 2127 LInstruction* LChunkBuilder::DoStringCharFromCode(HStringCharFromCode* instr) { |
2110 LOperand* char_code = UseRegister(instr->value()); | 2128 LOperand* char_code = UseRegister(instr->value()); |
2111 LStringCharFromCode* result = new LStringCharFromCode(char_code); | 2129 LOperand* context = UseAny(instr->context()); |
2130 LStringCharFromCode* result = new LStringCharFromCode(context, char_code); | |
2112 return AssignPointerMap(DefineAsRegister(result)); | 2131 return AssignPointerMap(DefineAsRegister(result)); |
2113 } | 2132 } |
2114 | 2133 |
2115 | 2134 |
2116 LInstruction* LChunkBuilder::DoStringLength(HStringLength* instr) { | 2135 LInstruction* LChunkBuilder::DoStringLength(HStringLength* instr) { |
2117 LOperand* string = UseRegisterAtStart(instr->value()); | 2136 LOperand* string = UseRegisterAtStart(instr->value()); |
2118 return DefineAsRegister(new LStringLength(string)); | 2137 return DefineAsRegister(new LStringLength(string)); |
2119 } | 2138 } |
2120 | 2139 |
2121 | 2140 |
2122 LInstruction* LChunkBuilder::DoArrayLiteral(HArrayLiteral* instr) { | 2141 LInstruction* LChunkBuilder::DoArrayLiteral(HArrayLiteral* instr) { |
2123 return MarkAsCall(DefineFixed(new LArrayLiteral, eax), instr); | 2142 LOperand* context = UseFixed(instr->context(), esi); |
2143 return MarkAsCall(DefineFixed(new LArrayLiteral(context), eax), instr); | |
2124 } | 2144 } |
2125 | 2145 |
2126 | 2146 |
2127 LInstruction* LChunkBuilder::DoObjectLiteral(HObjectLiteral* instr) { | 2147 LInstruction* LChunkBuilder::DoObjectLiteral(HObjectLiteral* instr) { |
2128 LOperand* context = UseFixed(instr->context(), esi); | 2148 LOperand* context = UseFixed(instr->context(), esi); |
2129 return MarkAsCall(DefineFixed(new LObjectLiteral(context), eax), instr); | 2149 return MarkAsCall(DefineFixed(new LObjectLiteral(context), eax), instr); |
2130 } | 2150 } |
2131 | 2151 |
2132 | 2152 |
2133 LInstruction* LChunkBuilder::DoRegExpLiteral(HRegExpLiteral* instr) { | 2153 LInstruction* LChunkBuilder::DoRegExpLiteral(HRegExpLiteral* instr) { |
2134 return MarkAsCall(DefineFixed(new LRegExpLiteral, eax), instr); | 2154 LOperand* context = UseFixed(instr->context(), esi); |
2155 return MarkAsCall(DefineFixed(new LRegExpLiteral(context), eax), instr); | |
2135 } | 2156 } |
2136 | 2157 |
2137 | 2158 |
2138 LInstruction* LChunkBuilder::DoFunctionLiteral(HFunctionLiteral* instr) { | 2159 LInstruction* LChunkBuilder::DoFunctionLiteral(HFunctionLiteral* instr) { |
2139 return MarkAsCall(DefineFixed(new LFunctionLiteral, eax), instr); | 2160 LOperand* context = UseFixed(instr->context(), esi); |
2161 return MarkAsCall(DefineFixed(new LFunctionLiteral(context), eax), instr); | |
2140 } | 2162 } |
2141 | 2163 |
2142 | 2164 |
2143 LInstruction* LChunkBuilder::DoDeleteProperty(HDeleteProperty* instr) { | 2165 LInstruction* LChunkBuilder::DoDeleteProperty(HDeleteProperty* instr) { |
2144 LDeleteProperty* result = | 2166 LDeleteProperty* result = |
2145 new LDeleteProperty(UseAtStart(instr->object()), | 2167 new LDeleteProperty(UseFixed(instr->context(), esi), |
Kevin Millikin (Chromium)
2011/06/29 08:36:20
I like to name these UseXXX subexpressions and lin
William Hesse
2011/06/29 10:30:21
Done.
| |
2168 UseAtStart(instr->object()), | |
2146 UseOrConstantAtStart(instr->key())); | 2169 UseOrConstantAtStart(instr->key())); |
2147 return MarkAsCall(DefineFixed(result, eax), instr); | 2170 return MarkAsCall(DefineFixed(result, eax), instr); |
2148 } | 2171 } |
2149 | 2172 |
2150 | 2173 |
2151 LInstruction* LChunkBuilder::DoOsrEntry(HOsrEntry* instr) { | 2174 LInstruction* LChunkBuilder::DoOsrEntry(HOsrEntry* instr) { |
2152 allocator_->MarkAsOsrEntry(); | 2175 allocator_->MarkAsOsrEntry(); |
2153 current_block_->last_environment()->set_ast_id(instr->ast_id()); | 2176 current_block_->last_environment()->set_ast_id(instr->ast_id()); |
2154 return AssignEnvironment(new LOsrEntry); | 2177 return AssignEnvironment(new LOsrEntry); |
2155 } | 2178 } |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2198 | 2221 |
2199 | 2222 |
2200 LInstruction* LChunkBuilder::DoToFastProperties(HToFastProperties* instr) { | 2223 LInstruction* LChunkBuilder::DoToFastProperties(HToFastProperties* instr) { |
2201 LOperand* object = UseFixed(instr->value(), eax); | 2224 LOperand* object = UseFixed(instr->value(), eax); |
2202 LToFastProperties* result = new LToFastProperties(object); | 2225 LToFastProperties* result = new LToFastProperties(object); |
2203 return MarkAsCall(DefineFixed(result, eax), instr); | 2226 return MarkAsCall(DefineFixed(result, eax), instr); |
2204 } | 2227 } |
2205 | 2228 |
2206 | 2229 |
2207 LInstruction* LChunkBuilder::DoTypeof(HTypeof* instr) { | 2230 LInstruction* LChunkBuilder::DoTypeof(HTypeof* instr) { |
2208 LTypeof* result = new LTypeof(UseAtStart(instr->value())); | 2231 LTypeof* result = new LTypeof(UseFixed(instr->context(), esi), |
2232 UseAtStart(instr->value())); | |
2209 return MarkAsCall(DefineFixed(result, eax), instr); | 2233 return MarkAsCall(DefineFixed(result, eax), instr); |
2210 } | 2234 } |
2211 | 2235 |
2212 | 2236 |
2213 LInstruction* LChunkBuilder::DoTypeofIs(HTypeofIs* instr) { | 2237 LInstruction* LChunkBuilder::DoTypeofIs(HTypeofIs* instr) { |
2214 return DefineSameAsFirst(new LTypeofIs(UseRegister(instr->value()))); | 2238 return DefineSameAsFirst(new LTypeofIs(UseRegister(instr->value()))); |
2215 } | 2239 } |
2216 | 2240 |
2217 | 2241 |
2218 LInstruction* LChunkBuilder::DoIsConstructCall(HIsConstructCall* instr) { | 2242 LInstruction* LChunkBuilder::DoIsConstructCall(HIsConstructCall* instr) { |
(...skipping 28 matching lines...) Expand all Loading... | |
2247 ClearInstructionPendingDeoptimizationEnvironment(); | 2271 ClearInstructionPendingDeoptimizationEnvironment(); |
2248 return result; | 2272 return result; |
2249 } | 2273 } |
2250 | 2274 |
2251 return NULL; | 2275 return NULL; |
2252 } | 2276 } |
2253 | 2277 |
2254 | 2278 |
2255 LInstruction* LChunkBuilder::DoStackCheck(HStackCheck* instr) { | 2279 LInstruction* LChunkBuilder::DoStackCheck(HStackCheck* instr) { |
2256 if (instr->is_function_entry()) { | 2280 if (instr->is_function_entry()) { |
2257 return MarkAsCall(new LStackCheck, instr); | 2281 return MarkAsCall(new LStackCheck(UseFixed(instr->context(), esi)), instr); |
2258 } else { | 2282 } else { |
2259 ASSERT(instr->is_backwards_branch()); | 2283 ASSERT(instr->is_backwards_branch()); |
2260 return AssignEnvironment(AssignPointerMap(new LStackCheck)); | 2284 return AssignEnvironment(AssignPointerMap( |
2285 » new LStackCheck(UseAny(instr->context())))); | |
2261 } | 2286 } |
2262 } | 2287 } |
2263 | 2288 |
2264 | 2289 |
2265 LInstruction* LChunkBuilder::DoEnterInlined(HEnterInlined* instr) { | 2290 LInstruction* LChunkBuilder::DoEnterInlined(HEnterInlined* instr) { |
2266 HEnvironment* outer = current_block_->last_environment(); | 2291 HEnvironment* outer = current_block_->last_environment(); |
2267 HConstant* undefined = graph()->GetConstantUndefined(); | 2292 HConstant* undefined = graph()->GetConstantUndefined(); |
2268 HEnvironment* inner = outer->CopyForInlining(instr->closure(), | 2293 HEnvironment* inner = outer->CopyForInlining(instr->closure(), |
2269 instr->function(), | 2294 instr->function(), |
2270 undefined, | 2295 undefined, |
(...skipping 15 matching lines...) Expand all Loading... | |
2286 LOperand* key = UseOrConstantAtStart(instr->key()); | 2311 LOperand* key = UseOrConstantAtStart(instr->key()); |
2287 LOperand* object = UseOrConstantAtStart(instr->object()); | 2312 LOperand* object = UseOrConstantAtStart(instr->object()); |
2288 LIn* result = new LIn(key, object); | 2313 LIn* result = new LIn(key, object); |
2289 return MarkAsCall(DefineFixed(result, eax), instr); | 2314 return MarkAsCall(DefineFixed(result, eax), instr); |
2290 } | 2315 } |
2291 | 2316 |
2292 | 2317 |
2293 } } // namespace v8::internal | 2318 } } // namespace v8::internal |
2294 | 2319 |
2295 #endif // V8_TARGET_ARCH_IA32 | 2320 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |