OLD | NEW |
---|---|
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 761 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
772 } | 772 } |
773 } | 773 } |
774 | 774 |
775 | 775 |
776 LInstruction* LChunkBuilder::DoArithmeticT(Token::Value op, | 776 LInstruction* LChunkBuilder::DoArithmeticT(Token::Value op, |
777 HBinaryOperation* instr) { | 777 HBinaryOperation* instr) { |
778 HValue* left = instr->left(); | 778 HValue* left = instr->left(); |
779 HValue* right = instr->right(); | 779 HValue* right = instr->right(); |
780 ASSERT(left->representation().IsTagged()); | 780 ASSERT(left->representation().IsTagged()); |
781 ASSERT(right->representation().IsTagged()); | 781 ASSERT(right->representation().IsTagged()); |
782 LOperand* context = UseFixed(instr->context(), cp); | |
782 LOperand* left_operand = UseFixed(left, r1); | 783 LOperand* left_operand = UseFixed(left, r1); |
783 LOperand* right_operand = UseFixed(right, r0); | 784 LOperand* right_operand = UseFixed(right, r0); |
784 LArithmeticT* result = | 785 LArithmeticT* result = |
785 new(zone()) LArithmeticT(op, left_operand, right_operand); | 786 new(zone()) LArithmeticT(op, context, left_operand, right_operand); |
786 return MarkAsCall(DefineFixed(result, r0), instr); | 787 return MarkAsCall(DefineFixed(result, r0), instr); |
787 } | 788 } |
788 | 789 |
789 | 790 |
790 void LChunkBuilder::DoBasicBlock(HBasicBlock* block, HBasicBlock* next_block) { | 791 void LChunkBuilder::DoBasicBlock(HBasicBlock* block, HBasicBlock* next_block) { |
791 ASSERT(is_building()); | 792 ASSERT(is_building()); |
792 current_block_ = block; | 793 current_block_ = block; |
793 next_block_ = next_block; | 794 next_block_ = next_block; |
794 if (block->IsStartBlock()) { | 795 if (block->IsStartBlock()) { |
795 block->UpdateEnvironment(graph_->start_environment()); | 796 block->UpdateEnvironment(graph_->start_environment()); |
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1037 } | 1038 } |
1038 | 1039 |
1039 | 1040 |
1040 LInstruction* LChunkBuilder::DoArgumentsElements(HArgumentsElements* elems) { | 1041 LInstruction* LChunkBuilder::DoArgumentsElements(HArgumentsElements* elems) { |
1041 info()->MarkAsRequiresFrame(); | 1042 info()->MarkAsRequiresFrame(); |
1042 return DefineAsRegister(new(zone()) LArgumentsElements); | 1043 return DefineAsRegister(new(zone()) LArgumentsElements); |
1043 } | 1044 } |
1044 | 1045 |
1045 | 1046 |
1046 LInstruction* LChunkBuilder::DoInstanceOf(HInstanceOf* instr) { | 1047 LInstruction* LChunkBuilder::DoInstanceOf(HInstanceOf* instr) { |
1048 LOperand* context = UseFixed(instr->context(), cp); | |
1047 LInstanceOf* result = | 1049 LInstanceOf* result = |
1048 new(zone()) LInstanceOf(UseFixed(instr->left(), r0), | 1050 new(zone()) LInstanceOf(context, UseFixed(instr->left(), r0), |
1049 UseFixed(instr->right(), r1)); | 1051 UseFixed(instr->right(), r1)); |
1050 return MarkAsCall(DefineFixed(result, r0), instr); | 1052 return MarkAsCall(DefineFixed(result, r0), instr); |
1051 } | 1053 } |
1052 | 1054 |
1053 | 1055 |
1054 LInstruction* LChunkBuilder::DoInstanceOfKnownGlobal( | 1056 LInstruction* LChunkBuilder::DoInstanceOfKnownGlobal( |
1055 HInstanceOfKnownGlobal* instr) { | 1057 HInstanceOfKnownGlobal* instr) { |
1056 LInstanceOfKnownGlobal* result = | 1058 LInstanceOfKnownGlobal* result = |
1057 new(zone()) LInstanceOfKnownGlobal(UseFixed(instr->left(), r0), | 1059 new(zone()) LInstanceOfKnownGlobal( |
1058 FixedTemp(r4)); | 1060 UseFixed(instr->context(), cp), |
1061 UseFixed(instr->left(), r0), | |
1062 FixedTemp(r4)); | |
1059 return MarkAsCall(DefineFixed(result, r0), instr); | 1063 return MarkAsCall(DefineFixed(result, r0), instr); |
1060 } | 1064 } |
1061 | 1065 |
1062 | 1066 |
1063 LInstruction* LChunkBuilder::DoInstanceSize(HInstanceSize* instr) { | 1067 LInstruction* LChunkBuilder::DoInstanceSize(HInstanceSize* instr) { |
1064 LOperand* object = UseRegisterAtStart(instr->object()); | 1068 LOperand* object = UseRegisterAtStart(instr->object()); |
1065 return DefineAsRegister(new(zone()) LInstanceSize(object)); | 1069 return DefineAsRegister(new(zone()) LInstanceSize(object)); |
1066 } | 1070 } |
1067 | 1071 |
1068 | 1072 |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1112 | 1116 |
1113 | 1117 |
1114 LInstruction* LChunkBuilder::DoThisFunction(HThisFunction* instr) { | 1118 LInstruction* LChunkBuilder::DoThisFunction(HThisFunction* instr) { |
1115 return instr->HasNoUses() | 1119 return instr->HasNoUses() |
1116 ? NULL | 1120 ? NULL |
1117 : DefineAsRegister(new(zone()) LThisFunction); | 1121 : DefineAsRegister(new(zone()) LThisFunction); |
1118 } | 1122 } |
1119 | 1123 |
1120 | 1124 |
1121 LInstruction* LChunkBuilder::DoContext(HContext* instr) { | 1125 LInstruction* LChunkBuilder::DoContext(HContext* instr) { |
1122 // If there is a non-return use, the context must be allocated in a register. | 1126 if (instr->HasNoUses()) return NULL; |
1123 for (HUseIterator it(instr->uses()); !it.Done(); it.Advance()) { | 1127 |
1124 if (!it.value()->IsReturn()) { | 1128 if (info()->IsStub()) { |
1125 return DefineAsRegister(new(zone()) LContext); | 1129 return DefineFixed(new(zone()) LContext, cp); |
1126 } | |
1127 } | 1130 } |
1128 | 1131 |
1129 return NULL; | 1132 return DefineAsRegister(new(zone()) LContext); |
1130 } | 1133 } |
1131 | 1134 |
1132 | 1135 |
1133 LInstruction* LChunkBuilder::DoOuterContext(HOuterContext* instr) { | 1136 LInstruction* LChunkBuilder::DoOuterContext(HOuterContext* instr) { |
1134 LOperand* context = UseRegisterAtStart(instr->value()); | 1137 LOperand* context = UseRegisterAtStart(instr->value()); |
1135 return DefineAsRegister(new(zone()) LOuterContext(context)); | 1138 return DefineAsRegister(new(zone()) LOuterContext(context)); |
1136 } | 1139 } |
1137 | 1140 |
1138 | 1141 |
1139 LInstruction* LChunkBuilder::DoDeclareGlobals(HDeclareGlobals* instr) { | 1142 LInstruction* LChunkBuilder::DoDeclareGlobals(HDeclareGlobals* instr) { |
1140 return MarkAsCall(new(zone()) LDeclareGlobals, instr); | 1143 LOperand* context = UseFixed(instr->context(), cp); |
1144 return MarkAsCall(new(zone()) LDeclareGlobals(context), instr); | |
1141 } | 1145 } |
1142 | 1146 |
1143 | 1147 |
1144 LInstruction* LChunkBuilder::DoGlobalObject(HGlobalObject* instr) { | 1148 LInstruction* LChunkBuilder::DoGlobalObject(HGlobalObject* instr) { |
1145 LOperand* context = UseRegisterAtStart(instr->value()); | 1149 LOperand* context = UseRegisterAtStart(instr->value()); |
1146 return DefineAsRegister(new(zone()) LGlobalObject(context)); | 1150 return DefineAsRegister(new(zone()) LGlobalObject(context)); |
1147 } | 1151 } |
1148 | 1152 |
1149 | 1153 |
1150 LInstruction* LChunkBuilder::DoGlobalReceiver(HGlobalReceiver* instr) { | 1154 LInstruction* LChunkBuilder::DoGlobalReceiver(HGlobalReceiver* instr) { |
1151 LOperand* global_object = UseRegisterAtStart(instr->value()); | 1155 LOperand* global_object = UseRegisterAtStart(instr->value()); |
1152 return DefineAsRegister(new(zone()) LGlobalReceiver(global_object)); | 1156 return DefineAsRegister(new(zone()) LGlobalReceiver(global_object)); |
1153 } | 1157 } |
1154 | 1158 |
1155 | 1159 |
1156 LInstruction* LChunkBuilder::DoCallConstantFunction( | 1160 LInstruction* LChunkBuilder::DoCallConstantFunction( |
1157 HCallConstantFunction* instr) { | 1161 HCallConstantFunction* instr) { |
1158 argument_count_ -= instr->argument_count(); | 1162 argument_count_ -= instr->argument_count(); |
1159 return MarkAsCall(DefineFixed(new(zone()) LCallConstantFunction, r0), instr); | 1163 return MarkAsCall(DefineFixed(new(zone()) LCallConstantFunction, r0), instr); |
1160 } | 1164 } |
1161 | 1165 |
1162 | 1166 |
1163 LInstruction* LChunkBuilder::DoInvokeFunction(HInvokeFunction* instr) { | 1167 LInstruction* LChunkBuilder::DoInvokeFunction(HInvokeFunction* instr) { |
1168 LOperand* context = UseFixed(instr->context(), cp); | |
1164 LOperand* function = UseFixed(instr->function(), r1); | 1169 LOperand* function = UseFixed(instr->function(), r1); |
1165 argument_count_ -= instr->argument_count(); | 1170 argument_count_ -= instr->argument_count(); |
1166 LInvokeFunction* result = new(zone()) LInvokeFunction(function); | 1171 LInvokeFunction* result = new(zone()) LInvokeFunction(context, function); |
1167 return MarkAsCall(DefineFixed(result, r0), instr, CANNOT_DEOPTIMIZE_EAGERLY); | 1172 return MarkAsCall(DefineFixed(result, r0), instr, CANNOT_DEOPTIMIZE_EAGERLY); |
1168 } | 1173 } |
1169 | 1174 |
1170 | 1175 |
1171 LInstruction* LChunkBuilder::DoUnaryMathOperation(HUnaryMathOperation* instr) { | 1176 LInstruction* LChunkBuilder::DoUnaryMathOperation(HUnaryMathOperation* instr) { |
1172 switch (instr->op()) { | 1177 switch (instr->op()) { |
1173 case kMathFloor: return DoMathFloor(instr); | 1178 case kMathFloor: return DoMathFloor(instr); |
1174 case kMathRound: return DoMathRound(instr); | 1179 case kMathRound: return DoMathRound(instr); |
1175 case kMathAbs: return DoMathAbs(instr); | 1180 case kMathAbs: return DoMathAbs(instr); |
1176 case kMathLog: return DoMathLog(instr); | 1181 case kMathLog: return DoMathLog(instr); |
(...skipping 19 matching lines...) Expand all Loading... | |
1196 | 1201 |
1197 LInstruction* LChunkBuilder::DoMathRound(HUnaryMathOperation* instr) { | 1202 LInstruction* LChunkBuilder::DoMathRound(HUnaryMathOperation* instr) { |
1198 LOperand* input = UseRegister(instr->value()); | 1203 LOperand* input = UseRegister(instr->value()); |
1199 LOperand* temp = FixedTemp(d3); | 1204 LOperand* temp = FixedTemp(d3); |
1200 LMathRound* result = new(zone()) LMathRound(input, temp); | 1205 LMathRound* result = new(zone()) LMathRound(input, temp); |
1201 return AssignEnvironment(DefineAsRegister(result)); | 1206 return AssignEnvironment(DefineAsRegister(result)); |
1202 } | 1207 } |
1203 | 1208 |
1204 | 1209 |
1205 LInstruction* LChunkBuilder::DoMathAbs(HUnaryMathOperation* instr) { | 1210 LInstruction* LChunkBuilder::DoMathAbs(HUnaryMathOperation* instr) { |
1211 Representation r = instr->value()->representation(); | |
1212 LOperand* context = (r.IsDouble() || r.IsSmiOrInteger32()) | |
1213 ? NULL | |
1214 : UseFixed(instr->context(), cp); | |
ulan
2013/09/27 12:08:00
I think we can use UseAny here because the context
vincent.belliard.fr
2013/09/27 12:37:04
If we use UseAny, the context will we copied into
ulan
2013/09/27 12:44:13
OK, let's leave UseFixed.
| |
1206 LOperand* input = UseRegister(instr->value()); | 1215 LOperand* input = UseRegister(instr->value()); |
1207 LMathAbs* result = new(zone()) LMathAbs(input); | 1216 LMathAbs* result = new(zone()) LMathAbs(context, input); |
1208 return AssignEnvironment(AssignPointerMap(DefineAsRegister(result))); | 1217 return AssignEnvironment(AssignPointerMap(DefineAsRegister(result))); |
1209 } | 1218 } |
1210 | 1219 |
1211 | 1220 |
1212 LInstruction* LChunkBuilder::DoMathLog(HUnaryMathOperation* instr) { | 1221 LInstruction* LChunkBuilder::DoMathLog(HUnaryMathOperation* instr) { |
1213 LOperand* input = UseFixedDouble(instr->value(), d2); | 1222 LOperand* input = UseFixedDouble(instr->value(), d2); |
1214 LMathLog* result = new(zone()) LMathLog(input); | 1223 LMathLog* result = new(zone()) LMathLog(input); |
1215 return MarkAsCall(DefineFixedDouble(result, d2), instr); | 1224 return MarkAsCall(DefineFixedDouble(result, d2), instr); |
1216 } | 1225 } |
1217 | 1226 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1259 LInstruction* LChunkBuilder::DoMathPowHalf(HUnaryMathOperation* instr) { | 1268 LInstruction* LChunkBuilder::DoMathPowHalf(HUnaryMathOperation* instr) { |
1260 LOperand* input = UseFixedDouble(instr->value(), d2); | 1269 LOperand* input = UseFixedDouble(instr->value(), d2); |
1261 LOperand* temp = FixedTemp(d3); | 1270 LOperand* temp = FixedTemp(d3); |
1262 LMathPowHalf* result = new(zone()) LMathPowHalf(input, temp); | 1271 LMathPowHalf* result = new(zone()) LMathPowHalf(input, temp); |
1263 return DefineFixedDouble(result, d2); | 1272 return DefineFixedDouble(result, d2); |
1264 } | 1273 } |
1265 | 1274 |
1266 | 1275 |
1267 LInstruction* LChunkBuilder::DoCallKeyed(HCallKeyed* instr) { | 1276 LInstruction* LChunkBuilder::DoCallKeyed(HCallKeyed* instr) { |
1268 ASSERT(instr->key()->representation().IsTagged()); | 1277 ASSERT(instr->key()->representation().IsTagged()); |
1278 LOperand* context = UseFixed(instr->context(), cp); | |
1269 argument_count_ -= instr->argument_count(); | 1279 argument_count_ -= instr->argument_count(); |
1270 LOperand* key = UseFixed(instr->key(), r2); | 1280 LOperand* key = UseFixed(instr->key(), r2); |
1271 return MarkAsCall(DefineFixed(new(zone()) LCallKeyed(key), r0), instr); | 1281 return MarkAsCall( |
1282 DefineFixed(new(zone()) LCallKeyed(context, key), r0), instr); | |
1272 } | 1283 } |
1273 | 1284 |
1274 | 1285 |
1275 LInstruction* LChunkBuilder::DoCallNamed(HCallNamed* instr) { | 1286 LInstruction* LChunkBuilder::DoCallNamed(HCallNamed* instr) { |
1287 LOperand* context = UseFixed(instr->context(), cp); | |
1276 argument_count_ -= instr->argument_count(); | 1288 argument_count_ -= instr->argument_count(); |
1277 return MarkAsCall(DefineFixed(new(zone()) LCallNamed, r0), instr); | 1289 return MarkAsCall(DefineFixed(new(zone()) LCallNamed(context), r0), instr); |
1278 } | 1290 } |
1279 | 1291 |
1280 | 1292 |
1281 LInstruction* LChunkBuilder::DoCallGlobal(HCallGlobal* instr) { | 1293 LInstruction* LChunkBuilder::DoCallGlobal(HCallGlobal* instr) { |
1294 LOperand* context = UseFixed(instr->context(), cp); | |
1282 argument_count_ -= instr->argument_count(); | 1295 argument_count_ -= instr->argument_count(); |
1283 return MarkAsCall(DefineFixed(new(zone()) LCallGlobal, r0), instr); | 1296 return MarkAsCall(DefineFixed(new(zone()) LCallGlobal(context), r0), instr); |
1284 } | 1297 } |
1285 | 1298 |
1286 | 1299 |
1287 LInstruction* LChunkBuilder::DoCallKnownGlobal(HCallKnownGlobal* instr) { | 1300 LInstruction* LChunkBuilder::DoCallKnownGlobal(HCallKnownGlobal* instr) { |
1288 argument_count_ -= instr->argument_count(); | 1301 argument_count_ -= instr->argument_count(); |
1289 return MarkAsCall(DefineFixed(new(zone()) LCallKnownGlobal, r0), instr); | 1302 return MarkAsCall(DefineFixed(new(zone()) LCallKnownGlobal, r0), instr); |
1290 } | 1303 } |
1291 | 1304 |
1292 | 1305 |
1293 LInstruction* LChunkBuilder::DoCallNew(HCallNew* instr) { | 1306 LInstruction* LChunkBuilder::DoCallNew(HCallNew* instr) { |
1307 LOperand* context = UseFixed(instr->context(), cp); | |
1294 LOperand* constructor = UseFixed(instr->constructor(), r1); | 1308 LOperand* constructor = UseFixed(instr->constructor(), r1); |
1295 argument_count_ -= instr->argument_count(); | 1309 argument_count_ -= instr->argument_count(); |
1296 LCallNew* result = new(zone()) LCallNew(constructor); | 1310 LCallNew* result = new(zone()) LCallNew(context, constructor); |
1297 return MarkAsCall(DefineFixed(result, r0), instr); | 1311 return MarkAsCall(DefineFixed(result, r0), instr); |
1298 } | 1312 } |
1299 | 1313 |
1300 | 1314 |
1301 LInstruction* LChunkBuilder::DoCallNewArray(HCallNewArray* instr) { | 1315 LInstruction* LChunkBuilder::DoCallNewArray(HCallNewArray* instr) { |
1316 LOperand* context = UseFixed(instr->context(), cp); | |
1302 LOperand* constructor = UseFixed(instr->constructor(), r1); | 1317 LOperand* constructor = UseFixed(instr->constructor(), r1); |
1303 argument_count_ -= instr->argument_count(); | 1318 argument_count_ -= instr->argument_count(); |
1304 LCallNewArray* result = new(zone()) LCallNewArray(constructor); | 1319 LCallNewArray* result = new(zone()) LCallNewArray(context, constructor); |
1305 return MarkAsCall(DefineFixed(result, r0), instr); | 1320 return MarkAsCall(DefineFixed(result, r0), instr); |
1306 } | 1321 } |
1307 | 1322 |
1308 | 1323 |
1309 LInstruction* LChunkBuilder::DoCallFunction(HCallFunction* instr) { | 1324 LInstruction* LChunkBuilder::DoCallFunction(HCallFunction* instr) { |
1325 LOperand* context = UseFixed(instr->context(), cp); | |
1310 LOperand* function = UseFixed(instr->function(), r1); | 1326 LOperand* function = UseFixed(instr->function(), r1); |
1311 argument_count_ -= instr->argument_count(); | 1327 argument_count_ -= instr->argument_count(); |
1312 return MarkAsCall(DefineFixed(new(zone()) LCallFunction(function), r0), | 1328 return MarkAsCall( |
1313 instr); | 1329 DefineFixed(new(zone()) LCallFunction(context, function), r0), instr); |
1314 } | 1330 } |
1315 | 1331 |
1316 | 1332 |
1317 LInstruction* LChunkBuilder::DoCallRuntime(HCallRuntime* instr) { | 1333 LInstruction* LChunkBuilder::DoCallRuntime(HCallRuntime* instr) { |
1318 argument_count_ -= instr->argument_count(); | 1334 argument_count_ -= instr->argument_count(); |
1319 return MarkAsCall(DefineFixed(new(zone()) LCallRuntime, r0), instr); | 1335 LOperand* context = UseFixed(instr->context(), cp); |
1336 return MarkAsCall(DefineFixed(new(zone()) LCallRuntime(context), r0), instr); | |
1320 } | 1337 } |
1321 | 1338 |
1322 | 1339 |
1323 LInstruction* LChunkBuilder::DoRor(HRor* instr) { | 1340 LInstruction* LChunkBuilder::DoRor(HRor* instr) { |
1324 return DoShift(Token::ROR, instr); | 1341 return DoShift(Token::ROR, instr); |
1325 } | 1342 } |
1326 | 1343 |
1327 | 1344 |
1328 LInstruction* LChunkBuilder::DoShr(HShr* instr) { | 1345 LInstruction* LChunkBuilder::DoShr(HShr* instr) { |
1329 return DoShift(Token::SHR, instr); | 1346 return DoShift(Token::SHR, instr); |
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1712 LOperand* scratch3 = TempRegister(); | 1729 LOperand* scratch3 = TempRegister(); |
1713 LRandom* result = new(zone()) LRandom( | 1730 LRandom* result = new(zone()) LRandom( |
1714 global_object, scratch, scratch2, scratch3); | 1731 global_object, scratch, scratch2, scratch3); |
1715 return DefineFixedDouble(result, d7); | 1732 return DefineFixedDouble(result, d7); |
1716 } | 1733 } |
1717 | 1734 |
1718 | 1735 |
1719 LInstruction* LChunkBuilder::DoCompareGeneric(HCompareGeneric* instr) { | 1736 LInstruction* LChunkBuilder::DoCompareGeneric(HCompareGeneric* instr) { |
1720 ASSERT(instr->left()->representation().IsTagged()); | 1737 ASSERT(instr->left()->representation().IsTagged()); |
1721 ASSERT(instr->right()->representation().IsTagged()); | 1738 ASSERT(instr->right()->representation().IsTagged()); |
1739 LOperand* context = UseFixed(instr->context(), cp); | |
1722 LOperand* left = UseFixed(instr->left(), r1); | 1740 LOperand* left = UseFixed(instr->left(), r1); |
1723 LOperand* right = UseFixed(instr->right(), r0); | 1741 LOperand* right = UseFixed(instr->right(), r0); |
1724 LCmpT* result = new(zone()) LCmpT(left, right); | 1742 LCmpT* result = new(zone()) LCmpT(context, left, right); |
1725 return MarkAsCall(DefineFixed(result, r0), instr); | 1743 return MarkAsCall(DefineFixed(result, r0), instr); |
1726 } | 1744 } |
1727 | 1745 |
1728 | 1746 |
1729 LInstruction* LChunkBuilder::DoCompareNumericAndBranch( | 1747 LInstruction* LChunkBuilder::DoCompareNumericAndBranch( |
1730 HCompareNumericAndBranch* instr) { | 1748 HCompareNumericAndBranch* instr) { |
1731 Representation r = instr->representation(); | 1749 Representation r = instr->representation(); |
1732 if (r.IsSmiOrInteger32()) { | 1750 if (r.IsSmiOrInteger32()) { |
1733 ASSERT(instr->left()->representation().Equals(r)); | 1751 ASSERT(instr->left()->representation().Equals(r)); |
1734 ASSERT(instr->right()->representation().Equals(r)); | 1752 ASSERT(instr->right()->representation().Equals(r)); |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1788 ASSERT(instr->value()->representation().IsTagged()); | 1806 ASSERT(instr->value()->representation().IsTagged()); |
1789 LOperand* value = UseRegisterAtStart(instr->value()); | 1807 LOperand* value = UseRegisterAtStart(instr->value()); |
1790 return new(zone()) LIsUndetectableAndBranch(value, TempRegister()); | 1808 return new(zone()) LIsUndetectableAndBranch(value, TempRegister()); |
1791 } | 1809 } |
1792 | 1810 |
1793 | 1811 |
1794 LInstruction* LChunkBuilder::DoStringCompareAndBranch( | 1812 LInstruction* LChunkBuilder::DoStringCompareAndBranch( |
1795 HStringCompareAndBranch* instr) { | 1813 HStringCompareAndBranch* instr) { |
1796 ASSERT(instr->left()->representation().IsTagged()); | 1814 ASSERT(instr->left()->representation().IsTagged()); |
1797 ASSERT(instr->right()->representation().IsTagged()); | 1815 ASSERT(instr->right()->representation().IsTagged()); |
1816 LOperand* context = UseFixed(instr->context(), cp); | |
1798 LOperand* left = UseFixed(instr->left(), r1); | 1817 LOperand* left = UseFixed(instr->left(), r1); |
1799 LOperand* right = UseFixed(instr->right(), r0); | 1818 LOperand* right = UseFixed(instr->right(), r0); |
1800 LStringCompareAndBranch* result = | 1819 LStringCompareAndBranch* result = |
1801 new(zone()) LStringCompareAndBranch(left, right); | 1820 new(zone()) LStringCompareAndBranch(context, left, right); |
1802 return MarkAsCall(result, instr); | 1821 return MarkAsCall(result, instr); |
1803 } | 1822 } |
1804 | 1823 |
1805 | 1824 |
1806 LInstruction* LChunkBuilder::DoHasInstanceTypeAndBranch( | 1825 LInstruction* LChunkBuilder::DoHasInstanceTypeAndBranch( |
1807 HHasInstanceTypeAndBranch* instr) { | 1826 HHasInstanceTypeAndBranch* instr) { |
1808 ASSERT(instr->value()->representation().IsTagged()); | 1827 ASSERT(instr->value()->representation().IsTagged()); |
1809 LOperand* value = UseRegisterAtStart(instr->value()); | 1828 LOperand* value = UseRegisterAtStart(instr->value()); |
1810 return new(zone()) LHasInstanceTypeAndBranch(value); | 1829 return new(zone()) LHasInstanceTypeAndBranch(value); |
1811 } | 1830 } |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1879 | 1898 |
1880 | 1899 |
1881 LInstruction* LChunkBuilder::DoBoundsCheckBaseIndexInformation( | 1900 LInstruction* LChunkBuilder::DoBoundsCheckBaseIndexInformation( |
1882 HBoundsCheckBaseIndexInformation* instr) { | 1901 HBoundsCheckBaseIndexInformation* instr) { |
1883 UNREACHABLE(); | 1902 UNREACHABLE(); |
1884 return NULL; | 1903 return NULL; |
1885 } | 1904 } |
1886 | 1905 |
1887 | 1906 |
1888 LInstruction* LChunkBuilder::DoThrow(HThrow* instr) { | 1907 LInstruction* LChunkBuilder::DoThrow(HThrow* instr) { |
1908 LOperand* context = UseFixed(instr->context(), cp); | |
1889 LOperand* value = UseFixed(instr->value(), r0); | 1909 LOperand* value = UseFixed(instr->value(), r0); |
1890 return MarkAsCall(new(zone()) LThrow(value), instr); | 1910 return MarkAsCall(new(zone()) LThrow(context, value), instr); |
1891 } | 1911 } |
1892 | 1912 |
1893 | 1913 |
1894 LInstruction* LChunkBuilder::DoUseConst(HUseConst* instr) { | 1914 LInstruction* LChunkBuilder::DoUseConst(HUseConst* instr) { |
1895 return NULL; | 1915 return NULL; |
1896 } | 1916 } |
1897 | 1917 |
1898 | 1918 |
1899 LInstruction* LChunkBuilder::DoForceRepresentation(HForceRepresentation* bad) { | 1919 LInstruction* LChunkBuilder::DoForceRepresentation(HForceRepresentation* bad) { |
1900 // All HForceRepresentation instructions should be eliminated in the | 1920 // All HForceRepresentation instructions should be eliminated in the |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2060 ASSERT(input_rep.IsSmiOrTagged()); | 2080 ASSERT(input_rep.IsSmiOrTagged()); |
2061 // Register allocator doesn't (yet) support allocation of double | 2081 // Register allocator doesn't (yet) support allocation of double |
2062 // temps. Reserve d1 explicitly. | 2082 // temps. Reserve d1 explicitly. |
2063 LClampTToUint8* result = new(zone()) LClampTToUint8(reg, FixedTemp(d11)); | 2083 LClampTToUint8* result = new(zone()) LClampTToUint8(reg, FixedTemp(d11)); |
2064 return AssignEnvironment(DefineAsRegister(result)); | 2084 return AssignEnvironment(DefineAsRegister(result)); |
2065 } | 2085 } |
2066 } | 2086 } |
2067 | 2087 |
2068 | 2088 |
2069 LInstruction* LChunkBuilder::DoReturn(HReturn* instr) { | 2089 LInstruction* LChunkBuilder::DoReturn(HReturn* instr) { |
2090 LOperand* context = info()->IsStub() | |
2091 ? UseFixed(instr->context(), cp) | |
2092 : NULL; | |
2070 LOperand* parameter_count = UseRegisterOrConstant(instr->parameter_count()); | 2093 LOperand* parameter_count = UseRegisterOrConstant(instr->parameter_count()); |
2071 return new(zone()) LReturn(UseFixed(instr->value(), r0), | 2094 return new(zone()) LReturn(UseFixed(instr->value(), r0), context, |
2072 parameter_count); | 2095 parameter_count); |
2073 } | 2096 } |
2074 | 2097 |
2075 | 2098 |
2076 LInstruction* LChunkBuilder::DoConstant(HConstant* instr) { | 2099 LInstruction* LChunkBuilder::DoConstant(HConstant* instr) { |
2077 Representation r = instr->representation(); | 2100 Representation r = instr->representation(); |
2078 if (r.IsSmi()) { | 2101 if (r.IsSmi()) { |
2079 return DefineAsRegister(new(zone()) LConstantS); | 2102 return DefineAsRegister(new(zone()) LConstantS); |
2080 } else if (r.IsInteger32()) { | 2103 } else if (r.IsInteger32()) { |
2081 return DefineAsRegister(new(zone()) LConstantI); | 2104 return DefineAsRegister(new(zone()) LConstantI); |
(...skipping 12 matching lines...) Expand all Loading... | |
2094 | 2117 |
2095 LInstruction* LChunkBuilder::DoLoadGlobalCell(HLoadGlobalCell* instr) { | 2118 LInstruction* LChunkBuilder::DoLoadGlobalCell(HLoadGlobalCell* instr) { |
2096 LLoadGlobalCell* result = new(zone()) LLoadGlobalCell; | 2119 LLoadGlobalCell* result = new(zone()) LLoadGlobalCell; |
2097 return instr->RequiresHoleCheck() | 2120 return instr->RequiresHoleCheck() |
2098 ? AssignEnvironment(DefineAsRegister(result)) | 2121 ? AssignEnvironment(DefineAsRegister(result)) |
2099 : DefineAsRegister(result); | 2122 : DefineAsRegister(result); |
2100 } | 2123 } |
2101 | 2124 |
2102 | 2125 |
2103 LInstruction* LChunkBuilder::DoLoadGlobalGeneric(HLoadGlobalGeneric* instr) { | 2126 LInstruction* LChunkBuilder::DoLoadGlobalGeneric(HLoadGlobalGeneric* instr) { |
2127 LOperand* context = UseFixed(instr->context(), cp); | |
2104 LOperand* global_object = UseFixed(instr->global_object(), r0); | 2128 LOperand* global_object = UseFixed(instr->global_object(), r0); |
2105 LLoadGlobalGeneric* result = new(zone()) LLoadGlobalGeneric(global_object); | 2129 LLoadGlobalGeneric* result = |
2130 new(zone()) LLoadGlobalGeneric(context, global_object); | |
2106 return MarkAsCall(DefineFixed(result, r0), instr); | 2131 return MarkAsCall(DefineFixed(result, r0), instr); |
2107 } | 2132 } |
2108 | 2133 |
2109 | 2134 |
2110 LInstruction* LChunkBuilder::DoStoreGlobalCell(HStoreGlobalCell* instr) { | 2135 LInstruction* LChunkBuilder::DoStoreGlobalCell(HStoreGlobalCell* instr) { |
2111 LOperand* value = UseRegister(instr->value()); | 2136 LOperand* value = UseRegister(instr->value()); |
2112 // Use a temp to check the value in the cell in the case where we perform | 2137 // Use a temp to check the value in the cell in the case where we perform |
2113 // a hole check. | 2138 // a hole check. |
2114 return instr->RequiresHoleCheck() | 2139 return instr->RequiresHoleCheck() |
2115 ? AssignEnvironment(new(zone()) LStoreGlobalCell(value, TempRegister())) | 2140 ? AssignEnvironment(new(zone()) LStoreGlobalCell(value, TempRegister())) |
2116 : new(zone()) LStoreGlobalCell(value, NULL); | 2141 : new(zone()) LStoreGlobalCell(value, NULL); |
2117 } | 2142 } |
2118 | 2143 |
2119 | 2144 |
2120 LInstruction* LChunkBuilder::DoStoreGlobalGeneric(HStoreGlobalGeneric* instr) { | 2145 LInstruction* LChunkBuilder::DoStoreGlobalGeneric(HStoreGlobalGeneric* instr) { |
2146 LOperand* context = UseFixed(instr->context(), cp); | |
2121 LOperand* global_object = UseFixed(instr->global_object(), r1); | 2147 LOperand* global_object = UseFixed(instr->global_object(), r1); |
2122 LOperand* value = UseFixed(instr->value(), r0); | 2148 LOperand* value = UseFixed(instr->value(), r0); |
2123 LStoreGlobalGeneric* result = | 2149 LStoreGlobalGeneric* result = |
2124 new(zone()) LStoreGlobalGeneric(global_object, value); | 2150 new(zone()) LStoreGlobalGeneric(context, global_object, value); |
2125 return MarkAsCall(result, instr); | 2151 return MarkAsCall(result, instr); |
2126 } | 2152 } |
2127 | 2153 |
2128 | 2154 |
2129 LInstruction* LChunkBuilder::DoLoadContextSlot(HLoadContextSlot* instr) { | 2155 LInstruction* LChunkBuilder::DoLoadContextSlot(HLoadContextSlot* instr) { |
2130 LOperand* context = UseRegisterAtStart(instr->value()); | 2156 LOperand* context = UseRegisterAtStart(instr->value()); |
2131 LInstruction* result = | 2157 LInstruction* result = |
2132 DefineAsRegister(new(zone()) LLoadContextSlot(context)); | 2158 DefineAsRegister(new(zone()) LLoadContextSlot(context)); |
2133 return instr->RequiresHoleCheck() ? AssignEnvironment(result) : result; | 2159 return instr->RequiresHoleCheck() ? AssignEnvironment(result) : result; |
2134 } | 2160 } |
(...skipping 14 matching lines...) Expand all Loading... | |
2149 } | 2175 } |
2150 | 2176 |
2151 | 2177 |
2152 LInstruction* LChunkBuilder::DoLoadNamedField(HLoadNamedField* instr) { | 2178 LInstruction* LChunkBuilder::DoLoadNamedField(HLoadNamedField* instr) { |
2153 LOperand* obj = UseRegisterAtStart(instr->object()); | 2179 LOperand* obj = UseRegisterAtStart(instr->object()); |
2154 return DefineAsRegister(new(zone()) LLoadNamedField(obj)); | 2180 return DefineAsRegister(new(zone()) LLoadNamedField(obj)); |
2155 } | 2181 } |
2156 | 2182 |
2157 | 2183 |
2158 LInstruction* LChunkBuilder::DoLoadNamedGeneric(HLoadNamedGeneric* instr) { | 2184 LInstruction* LChunkBuilder::DoLoadNamedGeneric(HLoadNamedGeneric* instr) { |
2185 LOperand* context = UseFixed(instr->context(), cp); | |
2159 LOperand* object = UseFixed(instr->object(), r0); | 2186 LOperand* object = UseFixed(instr->object(), r0); |
2160 LInstruction* result = DefineFixed(new(zone()) LLoadNamedGeneric(object), r0); | 2187 LInstruction* result = |
2188 DefineFixed(new(zone()) LLoadNamedGeneric(context, object), r0); | |
2161 return MarkAsCall(result, instr); | 2189 return MarkAsCall(result, instr); |
2162 } | 2190 } |
2163 | 2191 |
2164 | 2192 |
2165 LInstruction* LChunkBuilder::DoLoadFunctionPrototype( | 2193 LInstruction* LChunkBuilder::DoLoadFunctionPrototype( |
2166 HLoadFunctionPrototype* instr) { | 2194 HLoadFunctionPrototype* instr) { |
2167 return AssignEnvironment(DefineAsRegister( | 2195 return AssignEnvironment(DefineAsRegister( |
2168 new(zone()) LLoadFunctionPrototype(UseRegister(instr->function())))); | 2196 new(zone()) LLoadFunctionPrototype(UseRegister(instr->function())))); |
2169 } | 2197 } |
2170 | 2198 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2211 DefineAsRegister(result); | 2239 DefineAsRegister(result); |
2212 // An unsigned int array load might overflow and cause a deopt, make sure it | 2240 // An unsigned int array load might overflow and cause a deopt, make sure it |
2213 // has an environment. | 2241 // has an environment. |
2214 bool can_deoptimize = instr->RequiresHoleCheck() || | 2242 bool can_deoptimize = instr->RequiresHoleCheck() || |
2215 (elements_kind == EXTERNAL_UNSIGNED_INT_ELEMENTS); | 2243 (elements_kind == EXTERNAL_UNSIGNED_INT_ELEMENTS); |
2216 return can_deoptimize ? AssignEnvironment(result) : result; | 2244 return can_deoptimize ? AssignEnvironment(result) : result; |
2217 } | 2245 } |
2218 | 2246 |
2219 | 2247 |
2220 LInstruction* LChunkBuilder::DoLoadKeyedGeneric(HLoadKeyedGeneric* instr) { | 2248 LInstruction* LChunkBuilder::DoLoadKeyedGeneric(HLoadKeyedGeneric* instr) { |
2249 LOperand* context = UseFixed(instr->context(), cp); | |
2221 LOperand* object = UseFixed(instr->object(), r1); | 2250 LOperand* object = UseFixed(instr->object(), r1); |
2222 LOperand* key = UseFixed(instr->key(), r0); | 2251 LOperand* key = UseFixed(instr->key(), r0); |
2223 | 2252 |
2224 LInstruction* result = | 2253 LInstruction* result = |
2225 DefineFixed(new(zone()) LLoadKeyedGeneric(object, key), r0); | 2254 DefineFixed(new(zone()) LLoadKeyedGeneric(context, object, key), r0); |
2226 return MarkAsCall(result, instr); | 2255 return MarkAsCall(result, instr); |
2227 } | 2256 } |
2228 | 2257 |
2229 | 2258 |
2230 LInstruction* LChunkBuilder::DoStoreKeyed(HStoreKeyed* instr) { | 2259 LInstruction* LChunkBuilder::DoStoreKeyed(HStoreKeyed* instr) { |
2231 if (!instr->is_external()) { | 2260 if (!instr->is_external()) { |
2232 ASSERT(instr->elements()->representation().IsTagged()); | 2261 ASSERT(instr->elements()->representation().IsTagged()); |
2233 bool needs_write_barrier = instr->NeedsWriteBarrier(); | 2262 bool needs_write_barrier = instr->NeedsWriteBarrier(); |
2234 LOperand* object = NULL; | 2263 LOperand* object = NULL; |
2235 LOperand* key = NULL; | 2264 LOperand* key = NULL; |
(...skipping 28 matching lines...) Expand all Loading... | |
2264 (instr->elements_kind() == EXTERNAL_DOUBLE_ELEMENTS)))); | 2293 (instr->elements_kind() == EXTERNAL_DOUBLE_ELEMENTS)))); |
2265 ASSERT(instr->elements()->representation().IsExternal()); | 2294 ASSERT(instr->elements()->representation().IsExternal()); |
2266 LOperand* val = UseRegister(instr->value()); | 2295 LOperand* val = UseRegister(instr->value()); |
2267 LOperand* key = UseRegisterOrConstantAtStart(instr->key()); | 2296 LOperand* key = UseRegisterOrConstantAtStart(instr->key()); |
2268 LOperand* external_pointer = UseRegister(instr->elements()); | 2297 LOperand* external_pointer = UseRegister(instr->elements()); |
2269 return new(zone()) LStoreKeyed(external_pointer, key, val); | 2298 return new(zone()) LStoreKeyed(external_pointer, key, val); |
2270 } | 2299 } |
2271 | 2300 |
2272 | 2301 |
2273 LInstruction* LChunkBuilder::DoStoreKeyedGeneric(HStoreKeyedGeneric* instr) { | 2302 LInstruction* LChunkBuilder::DoStoreKeyedGeneric(HStoreKeyedGeneric* instr) { |
2303 LOperand* context = UseFixed(instr->context(), cp); | |
2274 LOperand* obj = UseFixed(instr->object(), r2); | 2304 LOperand* obj = UseFixed(instr->object(), r2); |
2275 LOperand* key = UseFixed(instr->key(), r1); | 2305 LOperand* key = UseFixed(instr->key(), r1); |
2276 LOperand* val = UseFixed(instr->value(), r0); | 2306 LOperand* val = UseFixed(instr->value(), r0); |
2277 | 2307 |
2278 ASSERT(instr->object()->representation().IsTagged()); | 2308 ASSERT(instr->object()->representation().IsTagged()); |
2279 ASSERT(instr->key()->representation().IsTagged()); | 2309 ASSERT(instr->key()->representation().IsTagged()); |
2280 ASSERT(instr->value()->representation().IsTagged()); | 2310 ASSERT(instr->value()->representation().IsTagged()); |
2281 | 2311 |
2282 return MarkAsCall(new(zone()) LStoreKeyedGeneric(obj, key, val), instr); | 2312 return MarkAsCall( |
2313 new(zone()) LStoreKeyedGeneric(context, obj, key, val), instr); | |
2283 } | 2314 } |
2284 | 2315 |
2285 | 2316 |
2286 LInstruction* LChunkBuilder::DoTransitionElementsKind( | 2317 LInstruction* LChunkBuilder::DoTransitionElementsKind( |
2287 HTransitionElementsKind* instr) { | 2318 HTransitionElementsKind* instr) { |
2288 LOperand* object = UseRegister(instr->object()); | 2319 LOperand* object = UseRegister(instr->object()); |
2289 if (IsSimpleMapChangeTransition(instr->from_kind(), instr->to_kind())) { | 2320 if (IsSimpleMapChangeTransition(instr->from_kind(), instr->to_kind())) { |
2290 LOperand* new_map_reg = TempRegister(); | 2321 LOperand* new_map_reg = TempRegister(); |
2291 LTransitionElementsKind* result = | 2322 LTransitionElementsKind* result = |
2292 new(zone()) LTransitionElementsKind(object, new_map_reg); | 2323 new(zone()) LTransitionElementsKind(object, NULL, new_map_reg); |
2293 return result; | 2324 return result; |
2294 } else { | 2325 } else { |
2326 LOperand* context = UseFixed(instr->context(), cp); | |
2295 LTransitionElementsKind* result = | 2327 LTransitionElementsKind* result = |
2296 new(zone()) LTransitionElementsKind(object, NULL); | 2328 new(zone()) LTransitionElementsKind(object, context, NULL); |
2297 return AssignPointerMap(result); | 2329 return AssignPointerMap(result); |
2298 } | 2330 } |
2299 } | 2331 } |
2300 | 2332 |
2301 | 2333 |
2302 LInstruction* LChunkBuilder::DoTrapAllocationMemento( | 2334 LInstruction* LChunkBuilder::DoTrapAllocationMemento( |
2303 HTrapAllocationMemento* instr) { | 2335 HTrapAllocationMemento* instr) { |
2304 LOperand* object = UseRegister(instr->object()); | 2336 LOperand* object = UseRegister(instr->object()); |
2305 LOperand* temp = TempRegister(); | 2337 LOperand* temp = TempRegister(); |
2306 LTrapAllocationMemento* result = | 2338 LTrapAllocationMemento* result = |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2345 instr->field_representation().IsHeapObject()) { | 2377 instr->field_representation().IsHeapObject()) { |
2346 if (!instr->value()->type().IsHeapObject()) { | 2378 if (!instr->value()->type().IsHeapObject()) { |
2347 return AssignEnvironment(result); | 2379 return AssignEnvironment(result); |
2348 } | 2380 } |
2349 } | 2381 } |
2350 return result; | 2382 return result; |
2351 } | 2383 } |
2352 | 2384 |
2353 | 2385 |
2354 LInstruction* LChunkBuilder::DoStoreNamedGeneric(HStoreNamedGeneric* instr) { | 2386 LInstruction* LChunkBuilder::DoStoreNamedGeneric(HStoreNamedGeneric* instr) { |
2387 LOperand* context = UseFixed(instr->context(), cp); | |
2355 LOperand* obj = UseFixed(instr->object(), r1); | 2388 LOperand* obj = UseFixed(instr->object(), r1); |
2356 LOperand* val = UseFixed(instr->value(), r0); | 2389 LOperand* val = UseFixed(instr->value(), r0); |
2357 | 2390 |
2358 LInstruction* result = new(zone()) LStoreNamedGeneric(obj, val); | 2391 LInstruction* result = new(zone()) LStoreNamedGeneric(context, obj, val); |
2359 return MarkAsCall(result, instr); | 2392 return MarkAsCall(result, instr); |
2360 } | 2393 } |
2361 | 2394 |
2362 | 2395 |
2363 LInstruction* LChunkBuilder::DoStringAdd(HStringAdd* instr) { | 2396 LInstruction* LChunkBuilder::DoStringAdd(HStringAdd* instr) { |
2397 LOperand* context = UseFixed(instr->context(), cp); | |
2364 LOperand* left = UseRegisterAtStart(instr->left()); | 2398 LOperand* left = UseRegisterAtStart(instr->left()); |
2365 LOperand* right = UseRegisterAtStart(instr->right()); | 2399 LOperand* right = UseRegisterAtStart(instr->right()); |
2366 return MarkAsCall(DefineFixed(new(zone()) LStringAdd(left, right), r0), | 2400 return MarkAsCall( |
2367 instr); | 2401 DefineFixed(new(zone()) LStringAdd(context, left, right), r0), |
2402 instr); | |
2368 } | 2403 } |
2369 | 2404 |
2370 | 2405 |
2371 LInstruction* LChunkBuilder::DoStringCharCodeAt(HStringCharCodeAt* instr) { | 2406 LInstruction* LChunkBuilder::DoStringCharCodeAt(HStringCharCodeAt* instr) { |
2372 LOperand* string = UseTempRegister(instr->string()); | 2407 LOperand* string = UseTempRegister(instr->string()); |
2373 LOperand* index = UseTempRegister(instr->index()); | 2408 LOperand* index = UseTempRegister(instr->index()); |
2374 LStringCharCodeAt* result = new(zone()) LStringCharCodeAt(string, index); | 2409 LOperand* context = UseAny(instr->context()); |
2410 LStringCharCodeAt* result = | |
2411 new(zone()) LStringCharCodeAt(context, string, index); | |
2375 return AssignEnvironment(AssignPointerMap(DefineAsRegister(result))); | 2412 return AssignEnvironment(AssignPointerMap(DefineAsRegister(result))); |
2376 } | 2413 } |
2377 | 2414 |
2378 | 2415 |
2379 LInstruction* LChunkBuilder::DoStringCharFromCode(HStringCharFromCode* instr) { | 2416 LInstruction* LChunkBuilder::DoStringCharFromCode(HStringCharFromCode* instr) { |
2380 LOperand* char_code = UseRegister(instr->value()); | 2417 LOperand* char_code = UseRegister(instr->value()); |
2381 LStringCharFromCode* result = new(zone()) LStringCharFromCode(char_code); | 2418 LOperand* context = UseAny(instr->context()); |
2419 LStringCharFromCode* result = | |
2420 new(zone()) LStringCharFromCode(context, char_code); | |
2382 return AssignPointerMap(DefineAsRegister(result)); | 2421 return AssignPointerMap(DefineAsRegister(result)); |
2383 } | 2422 } |
2384 | 2423 |
2385 | 2424 |
2386 LInstruction* LChunkBuilder::DoAllocate(HAllocate* instr) { | 2425 LInstruction* LChunkBuilder::DoAllocate(HAllocate* instr) { |
2387 info()->MarkAsDeferredCalling(); | 2426 info()->MarkAsDeferredCalling(); |
2427 LOperand* context = UseAny(instr->context()); | |
2388 LOperand* size = instr->size()->IsConstant() | 2428 LOperand* size = instr->size()->IsConstant() |
2389 ? UseConstant(instr->size()) | 2429 ? UseConstant(instr->size()) |
2390 : UseTempRegister(instr->size()); | 2430 : UseTempRegister(instr->size()); |
2391 LOperand* temp1 = TempRegister(); | 2431 LOperand* temp1 = TempRegister(); |
2392 LOperand* temp2 = TempRegister(); | 2432 LOperand* temp2 = TempRegister(); |
2393 LAllocate* result = new(zone()) LAllocate(size, temp1, temp2); | 2433 LAllocate* result = new(zone()) LAllocate(context, size, temp1, temp2); |
2394 return AssignPointerMap(DefineAsRegister(result)); | 2434 return AssignPointerMap(DefineAsRegister(result)); |
2395 } | 2435 } |
2396 | 2436 |
2397 | 2437 |
2398 LInstruction* LChunkBuilder::DoRegExpLiteral(HRegExpLiteral* instr) { | 2438 LInstruction* LChunkBuilder::DoRegExpLiteral(HRegExpLiteral* instr) { |
2399 return MarkAsCall(DefineFixed(new(zone()) LRegExpLiteral, r0), instr); | 2439 LOperand* context = UseFixed(instr->context(), cp); |
2440 return MarkAsCall( | |
2441 DefineFixed(new(zone()) LRegExpLiteral(context), r0), instr); | |
2400 } | 2442 } |
2401 | 2443 |
2402 | 2444 |
2403 LInstruction* LChunkBuilder::DoFunctionLiteral(HFunctionLiteral* instr) { | 2445 LInstruction* LChunkBuilder::DoFunctionLiteral(HFunctionLiteral* instr) { |
2404 return MarkAsCall(DefineFixed(new(zone()) LFunctionLiteral, r0), instr); | 2446 LOperand* context = UseFixed(instr->context(), cp); |
2447 return MarkAsCall( | |
2448 DefineFixed(new(zone()) LFunctionLiteral(context), r0), instr); | |
2405 } | 2449 } |
2406 | 2450 |
2407 | 2451 |
2408 LInstruction* LChunkBuilder::DoOsrEntry(HOsrEntry* instr) { | 2452 LInstruction* LChunkBuilder::DoOsrEntry(HOsrEntry* instr) { |
2409 ASSERT(argument_count_ == 0); | 2453 ASSERT(argument_count_ == 0); |
2410 allocator_->MarkAsOsrEntry(); | 2454 allocator_->MarkAsOsrEntry(); |
2411 current_block_->last_environment()->set_ast_id(instr->ast_id()); | 2455 current_block_->last_environment()->set_ast_id(instr->ast_id()); |
2412 return AssignEnvironment(new(zone()) LOsrEntry); | 2456 return AssignEnvironment(new(zone()) LOsrEntry); |
2413 } | 2457 } |
2414 | 2458 |
(...skipping 26 matching lines...) Expand all Loading... | |
2441 if (spill_index > LUnallocated::kMaxFixedSlotIndex) { | 2485 if (spill_index > LUnallocated::kMaxFixedSlotIndex) { |
2442 Abort(kTooManySpillSlotsNeededForOSR); | 2486 Abort(kTooManySpillSlotsNeededForOSR); |
2443 spill_index = 0; | 2487 spill_index = 0; |
2444 } | 2488 } |
2445 } | 2489 } |
2446 return DefineAsSpilled(new(zone()) LUnknownOSRValue, spill_index); | 2490 return DefineAsSpilled(new(zone()) LUnknownOSRValue, spill_index); |
2447 } | 2491 } |
2448 | 2492 |
2449 | 2493 |
2450 LInstruction* LChunkBuilder::DoCallStub(HCallStub* instr) { | 2494 LInstruction* LChunkBuilder::DoCallStub(HCallStub* instr) { |
2495 LOperand* context = UseFixed(instr->context(), cp); | |
2451 argument_count_ -= instr->argument_count(); | 2496 argument_count_ -= instr->argument_count(); |
2452 return MarkAsCall(DefineFixed(new(zone()) LCallStub, r0), instr); | 2497 return MarkAsCall(DefineFixed(new(zone()) LCallStub(context), r0), instr); |
2453 } | 2498 } |
2454 | 2499 |
2455 | 2500 |
2456 LInstruction* LChunkBuilder::DoArgumentsObject(HArgumentsObject* instr) { | 2501 LInstruction* LChunkBuilder::DoArgumentsObject(HArgumentsObject* instr) { |
2457 // There are no real uses of the arguments object. | 2502 // There are no real uses of the arguments object. |
2458 // arguments.length and element access are supported directly on | 2503 // arguments.length and element access are supported directly on |
2459 // stack arguments, and any real arguments object use causes a bailout. | 2504 // stack arguments, and any real arguments object use causes a bailout. |
2460 // So this value is never used. | 2505 // So this value is never used. |
2461 return NULL; | 2506 return NULL; |
2462 } | 2507 } |
(...skipping 24 matching lines...) Expand all Loading... | |
2487 | 2532 |
2488 | 2533 |
2489 LInstruction* LChunkBuilder::DoToFastProperties(HToFastProperties* instr) { | 2534 LInstruction* LChunkBuilder::DoToFastProperties(HToFastProperties* instr) { |
2490 LOperand* object = UseFixed(instr->value(), r0); | 2535 LOperand* object = UseFixed(instr->value(), r0); |
2491 LToFastProperties* result = new(zone()) LToFastProperties(object); | 2536 LToFastProperties* result = new(zone()) LToFastProperties(object); |
2492 return MarkAsCall(DefineFixed(result, r0), instr); | 2537 return MarkAsCall(DefineFixed(result, r0), instr); |
2493 } | 2538 } |
2494 | 2539 |
2495 | 2540 |
2496 LInstruction* LChunkBuilder::DoTypeof(HTypeof* instr) { | 2541 LInstruction* LChunkBuilder::DoTypeof(HTypeof* instr) { |
2497 LTypeof* result = new(zone()) LTypeof(UseFixed(instr->value(), r0)); | 2542 LOperand* context = UseFixed(instr->context(), cp); |
2543 LTypeof* result = new(zone()) LTypeof(context, UseFixed(instr->value(), r0)); | |
2498 return MarkAsCall(DefineFixed(result, r0), instr); | 2544 return MarkAsCall(DefineFixed(result, r0), instr); |
2499 } | 2545 } |
2500 | 2546 |
2501 | 2547 |
2502 LInstruction* LChunkBuilder::DoTypeofIsAndBranch(HTypeofIsAndBranch* instr) { | 2548 LInstruction* LChunkBuilder::DoTypeofIsAndBranch(HTypeofIsAndBranch* instr) { |
2503 return new(zone()) LTypeofIsAndBranch(UseTempRegister(instr->value())); | 2549 return new(zone()) LTypeofIsAndBranch(UseTempRegister(instr->value())); |
2504 } | 2550 } |
2505 | 2551 |
2506 | 2552 |
2507 LInstruction* LChunkBuilder::DoIsConstructCallAndBranch( | 2553 LInstruction* LChunkBuilder::DoIsConstructCallAndBranch( |
(...skipping 18 matching lines...) Expand all Loading... | |
2526 pending_deoptimization_ast_id_ = BailoutId::None(); | 2572 pending_deoptimization_ast_id_ = BailoutId::None(); |
2527 return result; | 2573 return result; |
2528 } | 2574 } |
2529 | 2575 |
2530 return NULL; | 2576 return NULL; |
2531 } | 2577 } |
2532 | 2578 |
2533 | 2579 |
2534 LInstruction* LChunkBuilder::DoStackCheck(HStackCheck* instr) { | 2580 LInstruction* LChunkBuilder::DoStackCheck(HStackCheck* instr) { |
2535 if (instr->is_function_entry()) { | 2581 if (instr->is_function_entry()) { |
2536 return MarkAsCall(new(zone()) LStackCheck, instr); | 2582 LOperand* context = UseFixed(instr->context(), cp); |
2583 return MarkAsCall(new(zone()) LStackCheck(context), instr); | |
2537 } else { | 2584 } else { |
2538 ASSERT(instr->is_backwards_branch()); | 2585 ASSERT(instr->is_backwards_branch()); |
2539 return AssignEnvironment(AssignPointerMap(new(zone()) LStackCheck)); | 2586 LOperand* context = UseAny(instr->context()); |
2587 return AssignEnvironment( | |
2588 AssignPointerMap(new(zone()) LStackCheck(context))); | |
2540 } | 2589 } |
2541 } | 2590 } |
2542 | 2591 |
2543 | 2592 |
2544 LInstruction* LChunkBuilder::DoEnterInlined(HEnterInlined* instr) { | 2593 LInstruction* LChunkBuilder::DoEnterInlined(HEnterInlined* instr) { |
2545 HEnvironment* outer = current_block_->last_environment(); | 2594 HEnvironment* outer = current_block_->last_environment(); |
2546 HConstant* undefined = graph()->GetConstantUndefined(); | 2595 HConstant* undefined = graph()->GetConstantUndefined(); |
2547 HEnvironment* inner = outer->CopyForInlining(instr->closure(), | 2596 HEnvironment* inner = outer->CopyForInlining(instr->closure(), |
2548 instr->arguments_count(), | 2597 instr->arguments_count(), |
2549 instr->function(), | 2598 instr->function(), |
(...skipping 24 matching lines...) Expand all Loading... | |
2574 | 2623 |
2575 HEnvironment* outer = current_block_->last_environment()-> | 2624 HEnvironment* outer = current_block_->last_environment()-> |
2576 DiscardInlined(false); | 2625 DiscardInlined(false); |
2577 current_block_->UpdateEnvironment(outer); | 2626 current_block_->UpdateEnvironment(outer); |
2578 | 2627 |
2579 return pop; | 2628 return pop; |
2580 } | 2629 } |
2581 | 2630 |
2582 | 2631 |
2583 LInstruction* LChunkBuilder::DoForInPrepareMap(HForInPrepareMap* instr) { | 2632 LInstruction* LChunkBuilder::DoForInPrepareMap(HForInPrepareMap* instr) { |
2633 LOperand* context = UseFixed(instr->context(), cp); | |
2584 LOperand* object = UseFixed(instr->enumerable(), r0); | 2634 LOperand* object = UseFixed(instr->enumerable(), r0); |
2585 LForInPrepareMap* result = new(zone()) LForInPrepareMap(object); | 2635 LForInPrepareMap* result = new(zone()) LForInPrepareMap(context, object); |
2586 return MarkAsCall(DefineFixed(result, r0), instr, CAN_DEOPTIMIZE_EAGERLY); | 2636 return MarkAsCall(DefineFixed(result, r0), instr, CAN_DEOPTIMIZE_EAGERLY); |
2587 } | 2637 } |
2588 | 2638 |
2589 | 2639 |
2590 LInstruction* LChunkBuilder::DoForInCacheArray(HForInCacheArray* instr) { | 2640 LInstruction* LChunkBuilder::DoForInCacheArray(HForInCacheArray* instr) { |
2591 LOperand* map = UseRegister(instr->map()); | 2641 LOperand* map = UseRegister(instr->map()); |
2592 return AssignEnvironment(DefineAsRegister(new(zone()) LForInCacheArray(map))); | 2642 return AssignEnvironment(DefineAsRegister(new(zone()) LForInCacheArray(map))); |
2593 } | 2643 } |
2594 | 2644 |
2595 | 2645 |
2596 LInstruction* LChunkBuilder::DoCheckMapValue(HCheckMapValue* instr) { | 2646 LInstruction* LChunkBuilder::DoCheckMapValue(HCheckMapValue* instr) { |
2597 LOperand* value = UseRegisterAtStart(instr->value()); | 2647 LOperand* value = UseRegisterAtStart(instr->value()); |
2598 LOperand* map = UseRegisterAtStart(instr->map()); | 2648 LOperand* map = UseRegisterAtStart(instr->map()); |
2599 return AssignEnvironment(new(zone()) LCheckMapValue(value, map)); | 2649 return AssignEnvironment(new(zone()) LCheckMapValue(value, map)); |
2600 } | 2650 } |
2601 | 2651 |
2602 | 2652 |
2603 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { | 2653 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { |
2604 LOperand* object = UseRegister(instr->object()); | 2654 LOperand* object = UseRegister(instr->object()); |
2605 LOperand* index = UseRegister(instr->index()); | 2655 LOperand* index = UseRegister(instr->index()); |
2606 return DefineAsRegister(new(zone()) LLoadFieldByIndex(object, index)); | 2656 return DefineAsRegister(new(zone()) LLoadFieldByIndex(object, index)); |
2607 } | 2657 } |
2608 | 2658 |
2609 | 2659 |
2610 } } // namespace v8::internal | 2660 } } // namespace v8::internal |
OLD | NEW |