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 793 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
804 ASSERT(instr->right()->representation().IsInteger32()); | 804 ASSERT(instr->right()->representation().IsInteger32()); |
805 | 805 |
806 LOperand* left = UseRegisterAtStart(instr->LeastConstantOperand()); | 806 LOperand* left = UseRegisterAtStart(instr->LeastConstantOperand()); |
807 LOperand* right = UseOrConstantAtStart(instr->MostConstantOperand()); | 807 LOperand* right = UseOrConstantAtStart(instr->MostConstantOperand()); |
808 return DefineSameAsFirst(new LBitI(op, left, right)); | 808 return DefineSameAsFirst(new LBitI(op, left, right)); |
809 } else { | 809 } else { |
810 ASSERT(instr->representation().IsTagged()); | 810 ASSERT(instr->representation().IsTagged()); |
811 ASSERT(instr->left()->representation().IsTagged()); | 811 ASSERT(instr->left()->representation().IsTagged()); |
812 ASSERT(instr->right()->representation().IsTagged()); | 812 ASSERT(instr->right()->representation().IsTagged()); |
813 | 813 |
| 814 LOperand* context = UseFixed(instr->context(), esi); |
814 LOperand* left = UseFixed(instr->left(), edx); | 815 LOperand* left = UseFixed(instr->left(), edx); |
815 LOperand* right = UseFixed(instr->right(), eax); | 816 LOperand* right = UseFixed(instr->right(), eax); |
816 LArithmeticT* result = new LArithmeticT(op, left, right); | 817 LArithmeticT* result = new LArithmeticT(op, context, left, right); |
817 return MarkAsCall(DefineFixed(result, eax), instr); | 818 return MarkAsCall(DefineFixed(result, eax), instr); |
818 } | 819 } |
819 } | 820 } |
820 | 821 |
821 | 822 |
822 LInstruction* LChunkBuilder::DoShift(Token::Value op, | 823 LInstruction* LChunkBuilder::DoShift(Token::Value op, |
823 HBitwiseBinaryOperation* instr) { | 824 HBitwiseBinaryOperation* instr) { |
824 if (instr->representation().IsTagged()) { | 825 if (instr->representation().IsTagged()) { |
825 ASSERT(instr->left()->representation().IsTagged()); | 826 ASSERT(instr->left()->representation().IsTagged()); |
826 ASSERT(instr->right()->representation().IsTagged()); | 827 ASSERT(instr->right()->representation().IsTagged()); |
827 | 828 |
| 829 LOperand* context = UseFixed(instr->context(), esi); |
828 LOperand* left = UseFixed(instr->left(), edx); | 830 LOperand* left = UseFixed(instr->left(), edx); |
829 LOperand* right = UseFixed(instr->right(), eax); | 831 LOperand* right = UseFixed(instr->right(), eax); |
830 LArithmeticT* result = new LArithmeticT(op, left, right); | 832 LArithmeticT* result = new LArithmeticT(op, context, left, right); |
831 return MarkAsCall(DefineFixed(result, eax), instr); | 833 return MarkAsCall(DefineFixed(result, eax), instr); |
832 } | 834 } |
833 | 835 |
834 ASSERT(instr->representation().IsInteger32()); | 836 ASSERT(instr->representation().IsInteger32()); |
835 ASSERT(instr->OperandAt(0)->representation().IsInteger32()); | 837 ASSERT(instr->left()->representation().IsInteger32()); |
836 ASSERT(instr->OperandAt(1)->representation().IsInteger32()); | 838 ASSERT(instr->right()->representation().IsInteger32()); |
837 LOperand* left = UseRegisterAtStart(instr->OperandAt(0)); | 839 LOperand* left = UseRegisterAtStart(instr->left()); |
838 | 840 |
839 HValue* right_value = instr->OperandAt(1); | 841 HValue* right_value = instr->right(); |
840 LOperand* right = NULL; | 842 LOperand* right = NULL; |
841 int constant_value = 0; | 843 int constant_value = 0; |
842 if (right_value->IsConstant()) { | 844 if (right_value->IsConstant()) { |
843 HConstant* constant = HConstant::cast(right_value); | 845 HConstant* constant = HConstant::cast(right_value); |
844 right = chunk_->DefineConstantOperand(constant); | 846 right = chunk_->DefineConstantOperand(constant); |
845 constant_value = constant->Integer32Value() & 0x1f; | 847 constant_value = constant->Integer32Value() & 0x1f; |
846 } else { | 848 } else { |
847 right = UseFixed(right_value, ecx); | 849 right = UseFixed(right_value, ecx); |
848 } | 850 } |
849 | 851 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
883 HArithmeticBinaryOperation* instr) { | 885 HArithmeticBinaryOperation* instr) { |
884 ASSERT(op == Token::ADD || | 886 ASSERT(op == Token::ADD || |
885 op == Token::DIV || | 887 op == Token::DIV || |
886 op == Token::MOD || | 888 op == Token::MOD || |
887 op == Token::MUL || | 889 op == Token::MUL || |
888 op == Token::SUB); | 890 op == Token::SUB); |
889 HValue* left = instr->left(); | 891 HValue* left = instr->left(); |
890 HValue* right = instr->right(); | 892 HValue* right = instr->right(); |
891 ASSERT(left->representation().IsTagged()); | 893 ASSERT(left->representation().IsTagged()); |
892 ASSERT(right->representation().IsTagged()); | 894 ASSERT(right->representation().IsTagged()); |
| 895 LOperand* context = UseFixed(instr->context(), esi); |
893 LOperand* left_operand = UseFixed(left, edx); | 896 LOperand* left_operand = UseFixed(left, edx); |
894 LOperand* right_operand = UseFixed(right, eax); | 897 LOperand* right_operand = UseFixed(right, eax); |
895 LArithmeticT* result = new LArithmeticT(op, left_operand, right_operand); | 898 LArithmeticT* result = |
| 899 new LArithmeticT(op, context, left_operand, right_operand); |
896 return MarkAsCall(DefineFixed(result, eax), instr); | 900 return MarkAsCall(DefineFixed(result, eax), instr); |
897 } | 901 } |
898 | 902 |
| 903 |
899 void LChunkBuilder::DoBasicBlock(HBasicBlock* block, HBasicBlock* next_block) { | 904 void LChunkBuilder::DoBasicBlock(HBasicBlock* block, HBasicBlock* next_block) { |
900 ASSERT(is_building()); | 905 ASSERT(is_building()); |
901 current_block_ = block; | 906 current_block_ = block; |
902 next_block_ = next_block; | 907 next_block_ = next_block; |
903 if (block->IsStartBlock()) { | 908 if (block->IsStartBlock()) { |
904 block->UpdateEnvironment(graph_->start_environment()); | 909 block->UpdateEnvironment(graph_->start_environment()); |
905 argument_count_ = 0; | 910 argument_count_ = 0; |
906 } else if (block->predecessors()->length() == 1) { | 911 } else if (block->predecessors()->length() == 1) { |
907 // We have a single predecessor => copy environment and outgoing | 912 // We have a single predecessor => copy environment and outgoing |
908 // argument count from the predecessor. | 913 // argument count from the predecessor. |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1054 LOperand* context = UseFixed(instr->context(), esi); | 1059 LOperand* context = UseFixed(instr->context(), esi); |
1055 LInstanceOf* result = new LInstanceOf(context, left, right); | 1060 LInstanceOf* result = new LInstanceOf(context, left, right); |
1056 return MarkAsCall(DefineFixed(result, eax), instr); | 1061 return MarkAsCall(DefineFixed(result, eax), instr); |
1057 } | 1062 } |
1058 | 1063 |
1059 | 1064 |
1060 LInstruction* LChunkBuilder::DoInstanceOfKnownGlobal( | 1065 LInstruction* LChunkBuilder::DoInstanceOfKnownGlobal( |
1061 HInstanceOfKnownGlobal* instr) { | 1066 HInstanceOfKnownGlobal* instr) { |
1062 LInstanceOfKnownGlobal* result = | 1067 LInstanceOfKnownGlobal* result = |
1063 new LInstanceOfKnownGlobal( | 1068 new LInstanceOfKnownGlobal( |
1064 UseFixed(instr->value(), InstanceofStub::left()), | 1069 UseFixed(instr->context(), esi), |
| 1070 UseFixed(instr->left(), InstanceofStub::left()), |
1065 FixedTemp(edi)); | 1071 FixedTemp(edi)); |
1066 return MarkAsCall(DefineFixed(result, eax), instr); | 1072 return MarkAsCall(DefineFixed(result, eax), instr); |
1067 } | 1073 } |
1068 | 1074 |
1069 | 1075 |
1070 LInstruction* LChunkBuilder::DoApplyArguments(HApplyArguments* instr) { | 1076 LInstruction* LChunkBuilder::DoApplyArguments(HApplyArguments* instr) { |
1071 LOperand* function = UseFixed(instr->function(), edi); | 1077 LOperand* function = UseFixed(instr->function(), edi); |
1072 LOperand* receiver = UseFixed(instr->receiver(), eax); | 1078 LOperand* receiver = UseFixed(instr->receiver(), eax); |
1073 LOperand* length = UseFixed(instr->length(), ebx); | 1079 LOperand* length = UseFixed(instr->length(), ebx); |
1074 LOperand* elements = UseFixed(instr->elements(), ecx); | 1080 LOperand* elements = UseFixed(instr->elements(), ecx); |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1131 LInvokeFunction* result = new LInvokeFunction(context, function); | 1137 LInvokeFunction* result = new LInvokeFunction(context, function); |
1132 return MarkAsCall(DefineFixed(result, eax), instr, CANNOT_DEOPTIMIZE_EAGERLY); | 1138 return MarkAsCall(DefineFixed(result, eax), instr, CANNOT_DEOPTIMIZE_EAGERLY); |
1133 } | 1139 } |
1134 | 1140 |
1135 | 1141 |
1136 LInstruction* LChunkBuilder::DoUnaryMathOperation(HUnaryMathOperation* instr) { | 1142 LInstruction* LChunkBuilder::DoUnaryMathOperation(HUnaryMathOperation* instr) { |
1137 BuiltinFunctionId op = instr->op(); | 1143 BuiltinFunctionId op = instr->op(); |
1138 if (op == kMathLog) { | 1144 if (op == kMathLog) { |
1139 ASSERT(instr->representation().IsDouble()); | 1145 ASSERT(instr->representation().IsDouble()); |
1140 ASSERT(instr->value()->representation().IsDouble()); | 1146 ASSERT(instr->value()->representation().IsDouble()); |
| 1147 LOperand* context = UseAny(instr->context()); // Not actually used. |
1141 LOperand* input = UseRegisterAtStart(instr->value()); | 1148 LOperand* input = UseRegisterAtStart(instr->value()); |
1142 LUnaryMathOperation* result = new LUnaryMathOperation(input); | 1149 LUnaryMathOperation* result = new LUnaryMathOperation(context, input); |
1143 return DefineSameAsFirst(result); | 1150 return DefineSameAsFirst(result); |
1144 } else if (op == kMathSin || op == kMathCos) { | 1151 } else if (op == kMathSin || op == kMathCos) { |
| 1152 LOperand* context = UseFixed(instr->context(), esi); |
1145 LOperand* input = UseFixedDouble(instr->value(), xmm1); | 1153 LOperand* input = UseFixedDouble(instr->value(), xmm1); |
1146 LUnaryMathOperation* result = new LUnaryMathOperation(input); | 1154 LUnaryMathOperation* result = new LUnaryMathOperation(context, input); |
1147 return MarkAsCall(DefineFixedDouble(result, xmm1), instr); | 1155 return MarkAsCall(DefineFixedDouble(result, xmm1), instr); |
1148 } else { | 1156 } else { |
1149 LOperand* input = UseRegisterAtStart(instr->value()); | 1157 LOperand* input = UseRegisterAtStart(instr->value()); |
1150 LUnaryMathOperation* result = new LUnaryMathOperation(input); | 1158 LOperand* context = UseAny(instr->context()); // Deferred use by MathAbs. |
| 1159 LUnaryMathOperation* result = new LUnaryMathOperation(context, input); |
1151 switch (op) { | 1160 switch (op) { |
1152 case kMathAbs: | 1161 case kMathAbs: |
1153 return AssignEnvironment(AssignPointerMap(DefineSameAsFirst(result))); | 1162 return AssignEnvironment(AssignPointerMap(DefineSameAsFirst(result))); |
1154 case kMathFloor: | 1163 case kMathFloor: |
1155 return AssignEnvironment(DefineAsRegister(result)); | 1164 return AssignEnvironment(DefineAsRegister(result)); |
1156 case kMathRound: | 1165 case kMathRound: |
1157 return AssignEnvironment(DefineAsRegister(result)); | 1166 return AssignEnvironment(DefineAsRegister(result)); |
1158 case kMathSqrt: | 1167 case kMathSqrt: |
1159 return DefineSameAsFirst(result); | 1168 return DefineSameAsFirst(result); |
1160 case kMathPowHalf: | 1169 case kMathPowHalf: |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1211 LInstruction* LChunkBuilder::DoCallFunction(HCallFunction* instr) { | 1220 LInstruction* LChunkBuilder::DoCallFunction(HCallFunction* instr) { |
1212 LOperand* context = UseFixed(instr->context(), esi); | 1221 LOperand* context = UseFixed(instr->context(), esi); |
1213 argument_count_ -= instr->argument_count(); | 1222 argument_count_ -= instr->argument_count(); |
1214 LCallFunction* result = new LCallFunction(context); | 1223 LCallFunction* result = new LCallFunction(context); |
1215 return MarkAsCall(DefineFixed(result, eax), instr); | 1224 return MarkAsCall(DefineFixed(result, eax), instr); |
1216 } | 1225 } |
1217 | 1226 |
1218 | 1227 |
1219 LInstruction* LChunkBuilder::DoCallRuntime(HCallRuntime* instr) { | 1228 LInstruction* LChunkBuilder::DoCallRuntime(HCallRuntime* instr) { |
1220 argument_count_ -= instr->argument_count(); | 1229 argument_count_ -= instr->argument_count(); |
1221 return MarkAsCall(DefineFixed(new LCallRuntime, eax), instr); | 1230 LOperand* context = UseFixed(instr->context(), esi); |
| 1231 return MarkAsCall(DefineFixed(new LCallRuntime(context), eax), instr); |
1222 } | 1232 } |
1223 | 1233 |
1224 | 1234 |
1225 LInstruction* LChunkBuilder::DoShr(HShr* instr) { | 1235 LInstruction* LChunkBuilder::DoShr(HShr* instr) { |
1226 return DoShift(Token::SHR, instr); | 1236 return DoShift(Token::SHR, instr); |
1227 } | 1237 } |
1228 | 1238 |
1229 | 1239 |
1230 LInstruction* LChunkBuilder::DoSar(HSar* instr) { | 1240 LInstruction* LChunkBuilder::DoSar(HSar* instr) { |
1231 return DoShift(Token::SAR, instr); | 1241 return DoShift(Token::SAR, instr); |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1396 return MarkAsCall(DefineFixedDouble(result, xmm3), instr, | 1406 return MarkAsCall(DefineFixedDouble(result, xmm3), instr, |
1397 CAN_DEOPTIMIZE_EAGERLY); | 1407 CAN_DEOPTIMIZE_EAGERLY); |
1398 } | 1408 } |
1399 | 1409 |
1400 | 1410 |
1401 LInstruction* LChunkBuilder::DoCompareGeneric(HCompareGeneric* instr) { | 1411 LInstruction* LChunkBuilder::DoCompareGeneric(HCompareGeneric* instr) { |
1402 Token::Value op = instr->token(); | 1412 Token::Value op = instr->token(); |
1403 ASSERT(instr->left()->representation().IsTagged()); | 1413 ASSERT(instr->left()->representation().IsTagged()); |
1404 ASSERT(instr->right()->representation().IsTagged()); | 1414 ASSERT(instr->right()->representation().IsTagged()); |
1405 bool reversed = (op == Token::GT || op == Token::LTE); | 1415 bool reversed = (op == Token::GT || op == Token::LTE); |
| 1416 LOperand* context = UseFixed(instr->context(), esi); |
1406 LOperand* left = UseFixed(instr->left(), reversed ? eax : edx); | 1417 LOperand* left = UseFixed(instr->left(), reversed ? eax : edx); |
1407 LOperand* right = UseFixed(instr->right(), reversed ? edx : eax); | 1418 LOperand* right = UseFixed(instr->right(), reversed ? edx : eax); |
1408 LCmpT* result = new LCmpT(left, right); | 1419 LCmpT* result = new LCmpT(context, left, right); |
1409 return MarkAsCall(DefineFixed(result, eax), instr); | 1420 return MarkAsCall(DefineFixed(result, eax), instr); |
1410 } | 1421 } |
1411 | 1422 |
1412 | 1423 |
1413 LInstruction* LChunkBuilder::DoCompareIDAndBranch( | 1424 LInstruction* LChunkBuilder::DoCompareIDAndBranch( |
1414 HCompareIDAndBranch* instr) { | 1425 HCompareIDAndBranch* instr) { |
1415 Representation r = instr->GetInputRepresentation(); | 1426 Representation r = instr->GetInputRepresentation(); |
1416 if (r.IsInteger32()) { | 1427 if (r.IsInteger32()) { |
1417 ASSERT(instr->left()->representation().IsInteger32()); | 1428 ASSERT(instr->left()->representation().IsInteger32()); |
1418 ASSERT(instr->right()->representation().IsInteger32()); | 1429 ASSERT(instr->right()->representation().IsInteger32()); |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1545 | 1556 |
1546 | 1557 |
1547 LInstruction* LChunkBuilder::DoAbnormalExit(HAbnormalExit* instr) { | 1558 LInstruction* LChunkBuilder::DoAbnormalExit(HAbnormalExit* instr) { |
1548 // The control instruction marking the end of a block that completed | 1559 // The control instruction marking the end of a block that completed |
1549 // abruptly (e.g., threw an exception). There is nothing specific to do. | 1560 // abruptly (e.g., threw an exception). There is nothing specific to do. |
1550 return NULL; | 1561 return NULL; |
1551 } | 1562 } |
1552 | 1563 |
1553 | 1564 |
1554 LInstruction* LChunkBuilder::DoThrow(HThrow* instr) { | 1565 LInstruction* LChunkBuilder::DoThrow(HThrow* instr) { |
| 1566 LOperand* context = UseFixed(instr->context(), esi); |
1555 LOperand* value = UseFixed(instr->value(), eax); | 1567 LOperand* value = UseFixed(instr->value(), eax); |
1556 return MarkAsCall(new LThrow(value), instr); | 1568 return MarkAsCall(new LThrow(context, value), instr); |
1557 } | 1569 } |
1558 | 1570 |
1559 | 1571 |
1560 LInstruction* LChunkBuilder::DoUseConst(HUseConst* instr) { | 1572 LInstruction* LChunkBuilder::DoUseConst(HUseConst* instr) { |
1561 return NULL; | 1573 return NULL; |
1562 } | 1574 } |
1563 | 1575 |
1564 | 1576 |
1565 LInstruction* LChunkBuilder::DoForceRepresentation(HForceRepresentation* bad) { | 1577 LInstruction* LChunkBuilder::DoForceRepresentation(HForceRepresentation* bad) { |
1566 // All HForceRepresentation instructions should be eliminated in the | 1578 // All HForceRepresentation instructions should be eliminated in the |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1804 LInstruction* LChunkBuilder::DoLoadNamedField(HLoadNamedField* instr) { | 1816 LInstruction* LChunkBuilder::DoLoadNamedField(HLoadNamedField* instr) { |
1805 ASSERT(instr->representation().IsTagged()); | 1817 ASSERT(instr->representation().IsTagged()); |
1806 LOperand* obj = UseRegisterAtStart(instr->object()); | 1818 LOperand* obj = UseRegisterAtStart(instr->object()); |
1807 return DefineAsRegister(new LLoadNamedField(obj)); | 1819 return DefineAsRegister(new LLoadNamedField(obj)); |
1808 } | 1820 } |
1809 | 1821 |
1810 | 1822 |
1811 LInstruction* LChunkBuilder::DoLoadNamedFieldPolymorphic( | 1823 LInstruction* LChunkBuilder::DoLoadNamedFieldPolymorphic( |
1812 HLoadNamedFieldPolymorphic* instr) { | 1824 HLoadNamedFieldPolymorphic* instr) { |
1813 ASSERT(instr->representation().IsTagged()); | 1825 ASSERT(instr->representation().IsTagged()); |
| 1826 LOperand* context = UseFixed(instr->context(), esi); |
1814 if (instr->need_generic()) { | 1827 if (instr->need_generic()) { |
1815 LOperand* obj = UseFixed(instr->object(), eax); | 1828 LOperand* obj = UseFixed(instr->object(), eax); |
1816 LLoadNamedFieldPolymorphic* result = new LLoadNamedFieldPolymorphic(obj); | 1829 LLoadNamedFieldPolymorphic* result = |
| 1830 new LLoadNamedFieldPolymorphic(context, obj); |
1817 return MarkAsCall(DefineFixed(result, eax), instr); | 1831 return MarkAsCall(DefineFixed(result, eax), instr); |
1818 } else { | 1832 } else { |
1819 LOperand* obj = UseRegisterAtStart(instr->object()); | 1833 LOperand* obj = UseRegisterAtStart(instr->object()); |
1820 LLoadNamedFieldPolymorphic* result = new LLoadNamedFieldPolymorphic(obj); | 1834 LLoadNamedFieldPolymorphic* result = |
| 1835 new LLoadNamedFieldPolymorphic(context, obj); |
1821 return AssignEnvironment(DefineAsRegister(result)); | 1836 return AssignEnvironment(DefineAsRegister(result)); |
1822 } | 1837 } |
1823 } | 1838 } |
1824 | 1839 |
1825 | 1840 |
1826 LInstruction* LChunkBuilder::DoLoadNamedGeneric(HLoadNamedGeneric* instr) { | 1841 LInstruction* LChunkBuilder::DoLoadNamedGeneric(HLoadNamedGeneric* instr) { |
1827 LOperand* context = UseFixed(instr->context(), esi); | 1842 LOperand* context = UseFixed(instr->context(), esi); |
1828 LOperand* object = UseFixed(instr->object(), eax); | 1843 LOperand* object = UseFixed(instr->object(), eax); |
1829 LLoadNamedGeneric* result = new LLoadNamedGeneric(context, object); | 1844 LLoadNamedGeneric* result = new LLoadNamedGeneric(context, object); |
1830 return MarkAsCall(DefineFixed(result, eax), instr); | 1845 return MarkAsCall(DefineFixed(result, eax), instr); |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1991 LOperand* context = UseFixed(instr->context(), esi); | 2006 LOperand* context = UseFixed(instr->context(), esi); |
1992 LOperand* object = UseFixed(instr->object(), edx); | 2007 LOperand* object = UseFixed(instr->object(), edx); |
1993 LOperand* value = UseFixed(instr->value(), eax); | 2008 LOperand* value = UseFixed(instr->value(), eax); |
1994 | 2009 |
1995 LStoreNamedGeneric* result = new LStoreNamedGeneric(context, object, value); | 2010 LStoreNamedGeneric* result = new LStoreNamedGeneric(context, object, value); |
1996 return MarkAsCall(result, instr); | 2011 return MarkAsCall(result, instr); |
1997 } | 2012 } |
1998 | 2013 |
1999 | 2014 |
2000 LInstruction* LChunkBuilder::DoStringAdd(HStringAdd* instr) { | 2015 LInstruction* LChunkBuilder::DoStringAdd(HStringAdd* instr) { |
| 2016 LOperand* context = UseFixed(instr->context(), esi); |
2001 LOperand* left = UseOrConstantAtStart(instr->left()); | 2017 LOperand* left = UseOrConstantAtStart(instr->left()); |
2002 LOperand* right = UseOrConstantAtStart(instr->right()); | 2018 LOperand* right = UseOrConstantAtStart(instr->right()); |
2003 return MarkAsCall(DefineFixed(new LStringAdd(left, right), eax), instr); | 2019 LStringAdd* string_add = new LStringAdd(context, left, right); |
| 2020 return MarkAsCall(DefineFixed(string_add, eax), instr); |
2004 } | 2021 } |
2005 | 2022 |
2006 | 2023 |
2007 LInstruction* LChunkBuilder::DoStringCharCodeAt(HStringCharCodeAt* instr) { | 2024 LInstruction* LChunkBuilder::DoStringCharCodeAt(HStringCharCodeAt* instr) { |
2008 LOperand* string = UseRegister(instr->string()); | 2025 LOperand* string = UseRegister(instr->string()); |
2009 LOperand* index = UseRegisterOrConstant(instr->index()); | 2026 LOperand* index = UseRegisterOrConstant(instr->index()); |
2010 LStringCharCodeAt* result = new LStringCharCodeAt(string, index); | 2027 LOperand* context = UseAny(instr->context()); |
| 2028 LStringCharCodeAt* result = new LStringCharCodeAt(context, string, index); |
2011 return AssignEnvironment(AssignPointerMap(DefineAsRegister(result))); | 2029 return AssignEnvironment(AssignPointerMap(DefineAsRegister(result))); |
2012 } | 2030 } |
2013 | 2031 |
2014 | 2032 |
2015 LInstruction* LChunkBuilder::DoStringCharFromCode(HStringCharFromCode* instr) { | 2033 LInstruction* LChunkBuilder::DoStringCharFromCode(HStringCharFromCode* instr) { |
2016 LOperand* char_code = UseRegister(instr->value()); | 2034 LOperand* char_code = UseRegister(instr->value()); |
2017 LStringCharFromCode* result = new LStringCharFromCode(char_code); | 2035 LOperand* context = UseAny(instr->context()); |
| 2036 LStringCharFromCode* result = new LStringCharFromCode(context, char_code); |
2018 return AssignPointerMap(DefineAsRegister(result)); | 2037 return AssignPointerMap(DefineAsRegister(result)); |
2019 } | 2038 } |
2020 | 2039 |
2021 | 2040 |
2022 LInstruction* LChunkBuilder::DoStringLength(HStringLength* instr) { | 2041 LInstruction* LChunkBuilder::DoStringLength(HStringLength* instr) { |
2023 LOperand* string = UseRegisterAtStart(instr->value()); | 2042 LOperand* string = UseRegisterAtStart(instr->value()); |
2024 return DefineAsRegister(new LStringLength(string)); | 2043 return DefineAsRegister(new LStringLength(string)); |
2025 } | 2044 } |
2026 | 2045 |
2027 | 2046 |
2028 LInstruction* LChunkBuilder::DoArrayLiteral(HArrayLiteral* instr) { | 2047 LInstruction* LChunkBuilder::DoArrayLiteral(HArrayLiteral* instr) { |
2029 return MarkAsCall(DefineFixed(new LArrayLiteral, eax), instr); | 2048 LOperand* context = UseFixed(instr->context(), esi); |
| 2049 return MarkAsCall(DefineFixed(new LArrayLiteral(context), eax), instr); |
2030 } | 2050 } |
2031 | 2051 |
2032 | 2052 |
2033 LInstruction* LChunkBuilder::DoObjectLiteral(HObjectLiteral* instr) { | 2053 LInstruction* LChunkBuilder::DoObjectLiteral(HObjectLiteral* instr) { |
2034 LOperand* context = UseFixed(instr->context(), esi); | 2054 LOperand* context = UseFixed(instr->context(), esi); |
2035 return MarkAsCall(DefineFixed(new LObjectLiteral(context), eax), instr); | 2055 return MarkAsCall(DefineFixed(new LObjectLiteral(context), eax), instr); |
2036 } | 2056 } |
2037 | 2057 |
2038 | 2058 |
2039 LInstruction* LChunkBuilder::DoRegExpLiteral(HRegExpLiteral* instr) { | 2059 LInstruction* LChunkBuilder::DoRegExpLiteral(HRegExpLiteral* instr) { |
2040 return MarkAsCall(DefineFixed(new LRegExpLiteral, eax), instr); | 2060 LOperand* context = UseFixed(instr->context(), esi); |
| 2061 return MarkAsCall(DefineFixed(new LRegExpLiteral(context), eax), instr); |
2041 } | 2062 } |
2042 | 2063 |
2043 | 2064 |
2044 LInstruction* LChunkBuilder::DoFunctionLiteral(HFunctionLiteral* instr) { | 2065 LInstruction* LChunkBuilder::DoFunctionLiteral(HFunctionLiteral* instr) { |
2045 return MarkAsCall(DefineFixed(new LFunctionLiteral, eax), instr); | 2066 LOperand* context = UseFixed(instr->context(), esi); |
| 2067 return MarkAsCall(DefineFixed(new LFunctionLiteral(context), eax), instr); |
2046 } | 2068 } |
2047 | 2069 |
2048 | 2070 |
2049 LInstruction* LChunkBuilder::DoDeleteProperty(HDeleteProperty* instr) { | 2071 LInstruction* LChunkBuilder::DoDeleteProperty(HDeleteProperty* instr) { |
2050 LDeleteProperty* result = | 2072 LOperand* context = UseFixed(instr->context(), esi); |
2051 new LDeleteProperty(UseAtStart(instr->object()), | 2073 LOperand* object = UseAtStart(instr->object()); |
2052 UseOrConstantAtStart(instr->key())); | 2074 LOperand* key = UseOrConstantAtStart(instr->key()); |
| 2075 LDeleteProperty* result = new LDeleteProperty(context, object, key); |
2053 return MarkAsCall(DefineFixed(result, eax), instr); | 2076 return MarkAsCall(DefineFixed(result, eax), instr); |
2054 } | 2077 } |
2055 | 2078 |
2056 | 2079 |
2057 LInstruction* LChunkBuilder::DoOsrEntry(HOsrEntry* instr) { | 2080 LInstruction* LChunkBuilder::DoOsrEntry(HOsrEntry* instr) { |
2058 allocator_->MarkAsOsrEntry(); | 2081 allocator_->MarkAsOsrEntry(); |
2059 current_block_->last_environment()->set_ast_id(instr->ast_id()); | 2082 current_block_->last_environment()->set_ast_id(instr->ast_id()); |
2060 return AssignEnvironment(new LOsrEntry); | 2083 return AssignEnvironment(new LOsrEntry); |
2061 } | 2084 } |
2062 | 2085 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2104 | 2127 |
2105 | 2128 |
2106 LInstruction* LChunkBuilder::DoToFastProperties(HToFastProperties* instr) { | 2129 LInstruction* LChunkBuilder::DoToFastProperties(HToFastProperties* instr) { |
2107 LOperand* object = UseFixed(instr->value(), eax); | 2130 LOperand* object = UseFixed(instr->value(), eax); |
2108 LToFastProperties* result = new LToFastProperties(object); | 2131 LToFastProperties* result = new LToFastProperties(object); |
2109 return MarkAsCall(DefineFixed(result, eax), instr); | 2132 return MarkAsCall(DefineFixed(result, eax), instr); |
2110 } | 2133 } |
2111 | 2134 |
2112 | 2135 |
2113 LInstruction* LChunkBuilder::DoTypeof(HTypeof* instr) { | 2136 LInstruction* LChunkBuilder::DoTypeof(HTypeof* instr) { |
2114 LTypeof* result = new LTypeof(UseAtStart(instr->value())); | 2137 LOperand* context = UseFixed(instr->context(), esi); |
| 2138 LOperand* value = UseAtStart(instr->value()); |
| 2139 LTypeof* result = new LTypeof(context, value); |
2115 return MarkAsCall(DefineFixed(result, eax), instr); | 2140 return MarkAsCall(DefineFixed(result, eax), instr); |
2116 } | 2141 } |
2117 | 2142 |
2118 | 2143 |
2119 LInstruction* LChunkBuilder::DoTypeofIsAndBranch(HTypeofIsAndBranch* instr) { | 2144 LInstruction* LChunkBuilder::DoTypeofIsAndBranch(HTypeofIsAndBranch* instr) { |
2120 return new LTypeofIsAndBranch(UseTempRegister(instr->value())); | 2145 return new LTypeofIsAndBranch(UseTempRegister(instr->value())); |
2121 } | 2146 } |
2122 | 2147 |
2123 | 2148 |
2124 LInstruction* LChunkBuilder::DoIsConstructCallAndBranch( | 2149 LInstruction* LChunkBuilder::DoIsConstructCallAndBranch( |
(...skipping 29 matching lines...) Expand all Loading... |
2154 ClearInstructionPendingDeoptimizationEnvironment(); | 2179 ClearInstructionPendingDeoptimizationEnvironment(); |
2155 return result; | 2180 return result; |
2156 } | 2181 } |
2157 | 2182 |
2158 return NULL; | 2183 return NULL; |
2159 } | 2184 } |
2160 | 2185 |
2161 | 2186 |
2162 LInstruction* LChunkBuilder::DoStackCheck(HStackCheck* instr) { | 2187 LInstruction* LChunkBuilder::DoStackCheck(HStackCheck* instr) { |
2163 if (instr->is_function_entry()) { | 2188 if (instr->is_function_entry()) { |
2164 return MarkAsCall(new LStackCheck, instr); | 2189 LOperand* context = UseFixed(instr->context(), esi); |
| 2190 return MarkAsCall(new LStackCheck(context), instr); |
2165 } else { | 2191 } else { |
2166 ASSERT(instr->is_backwards_branch()); | 2192 ASSERT(instr->is_backwards_branch()); |
2167 return AssignEnvironment(AssignPointerMap(new LStackCheck)); | 2193 LOperand* context = UseAny(instr->context()); |
| 2194 return AssignEnvironment(AssignPointerMap(new LStackCheck(context))); |
2168 } | 2195 } |
2169 } | 2196 } |
2170 | 2197 |
2171 | 2198 |
2172 LInstruction* LChunkBuilder::DoEnterInlined(HEnterInlined* instr) { | 2199 LInstruction* LChunkBuilder::DoEnterInlined(HEnterInlined* instr) { |
2173 HEnvironment* outer = current_block_->last_environment(); | 2200 HEnvironment* outer = current_block_->last_environment(); |
2174 HConstant* undefined = graph()->GetConstantUndefined(); | 2201 HConstant* undefined = graph()->GetConstantUndefined(); |
2175 HEnvironment* inner = outer->CopyForInlining(instr->closure(), | 2202 HEnvironment* inner = outer->CopyForInlining(instr->closure(), |
2176 instr->function(), | 2203 instr->function(), |
2177 undefined, | 2204 undefined, |
2178 instr->call_kind()); | 2205 instr->call_kind()); |
2179 current_block_->UpdateEnvironment(inner); | 2206 current_block_->UpdateEnvironment(inner); |
2180 chunk_->AddInlinedClosure(instr->closure()); | 2207 chunk_->AddInlinedClosure(instr->closure()); |
2181 return NULL; | 2208 return NULL; |
2182 } | 2209 } |
2183 | 2210 |
2184 | 2211 |
2185 LInstruction* LChunkBuilder::DoLeaveInlined(HLeaveInlined* instr) { | 2212 LInstruction* LChunkBuilder::DoLeaveInlined(HLeaveInlined* instr) { |
2186 HEnvironment* outer = current_block_->last_environment()->outer(); | 2213 HEnvironment* outer = current_block_->last_environment()->outer(); |
2187 current_block_->UpdateEnvironment(outer); | 2214 current_block_->UpdateEnvironment(outer); |
2188 return NULL; | 2215 return NULL; |
2189 } | 2216 } |
2190 | 2217 |
2191 | 2218 |
2192 LInstruction* LChunkBuilder::DoIn(HIn* instr) { | 2219 LInstruction* LChunkBuilder::DoIn(HIn* instr) { |
| 2220 LOperand* context = UseFixed(instr->context(), esi); |
2193 LOperand* key = UseOrConstantAtStart(instr->key()); | 2221 LOperand* key = UseOrConstantAtStart(instr->key()); |
2194 LOperand* object = UseOrConstantAtStart(instr->object()); | 2222 LOperand* object = UseOrConstantAtStart(instr->object()); |
2195 LIn* result = new LIn(key, object); | 2223 LIn* result = new LIn(context, key, object); |
2196 return MarkAsCall(DefineFixed(result, eax), instr); | 2224 return MarkAsCall(DefineFixed(result, eax), instr); |
2197 } | 2225 } |
2198 | 2226 |
2199 | 2227 |
2200 } } // namespace v8::internal | 2228 } } // namespace v8::internal |
2201 | 2229 |
2202 #endif // V8_TARGET_ARCH_IA32 | 2230 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |