| 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 767 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 778 } | 778 } |
| 779 } | 779 } |
| 780 | 780 |
| 781 | 781 |
| 782 LInstruction* LChunkBuilder::DoArithmeticT(Token::Value op, | 782 LInstruction* LChunkBuilder::DoArithmeticT(Token::Value op, |
| 783 HBinaryOperation* instr) { | 783 HBinaryOperation* instr) { |
| 784 HValue* left = instr->left(); | 784 HValue* left = instr->left(); |
| 785 HValue* right = instr->right(); | 785 HValue* right = instr->right(); |
| 786 ASSERT(left->representation().IsTagged()); | 786 ASSERT(left->representation().IsTagged()); |
| 787 ASSERT(right->representation().IsTagged()); | 787 ASSERT(right->representation().IsTagged()); |
| 788 LOperand* context = UseFixed(instr->context(), cp); |
| 788 LOperand* left_operand = UseFixed(left, a1); | 789 LOperand* left_operand = UseFixed(left, a1); |
| 789 LOperand* right_operand = UseFixed(right, a0); | 790 LOperand* right_operand = UseFixed(right, a0); |
| 790 LArithmeticT* result = | 791 LArithmeticT* result = |
| 791 new(zone()) LArithmeticT(op, left_operand, right_operand); | 792 new(zone()) LArithmeticT(op, context, left_operand, right_operand); |
| 792 return MarkAsCall(DefineFixed(result, v0), instr); | 793 return MarkAsCall(DefineFixed(result, v0), instr); |
| 793 } | 794 } |
| 794 | 795 |
| 795 | 796 |
| 796 void LChunkBuilder::DoBasicBlock(HBasicBlock* block, HBasicBlock* next_block) { | 797 void LChunkBuilder::DoBasicBlock(HBasicBlock* block, HBasicBlock* next_block) { |
| 797 ASSERT(is_building()); | 798 ASSERT(is_building()); |
| 798 current_block_ = block; | 799 current_block_ = block; |
| 799 next_block_ = next_block; | 800 next_block_ = next_block; |
| 800 if (block->IsStartBlock()) { | 801 if (block->IsStartBlock()) { |
| 801 block->UpdateEnvironment(graph_->start_environment()); | 802 block->UpdateEnvironment(graph_->start_environment()); |
| (...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1038 } | 1039 } |
| 1039 | 1040 |
| 1040 | 1041 |
| 1041 LInstruction* LChunkBuilder::DoArgumentsElements(HArgumentsElements* elems) { | 1042 LInstruction* LChunkBuilder::DoArgumentsElements(HArgumentsElements* elems) { |
| 1042 info()->MarkAsRequiresFrame(); | 1043 info()->MarkAsRequiresFrame(); |
| 1043 return DefineAsRegister(new(zone()) LArgumentsElements); | 1044 return DefineAsRegister(new(zone()) LArgumentsElements); |
| 1044 } | 1045 } |
| 1045 | 1046 |
| 1046 | 1047 |
| 1047 LInstruction* LChunkBuilder::DoInstanceOf(HInstanceOf* instr) { | 1048 LInstruction* LChunkBuilder::DoInstanceOf(HInstanceOf* instr) { |
| 1049 LOperand* context = UseFixed(instr->context(), cp); |
| 1048 LInstanceOf* result = | 1050 LInstanceOf* result = |
| 1049 new(zone()) LInstanceOf(UseFixed(instr->left(), a0), | 1051 new(zone()) LInstanceOf(context, UseFixed(instr->left(), a0), |
| 1050 UseFixed(instr->right(), a1)); | 1052 UseFixed(instr->right(), a1)); |
| 1051 return MarkAsCall(DefineFixed(result, v0), instr); | 1053 return MarkAsCall(DefineFixed(result, v0), instr); |
| 1052 } | 1054 } |
| 1053 | 1055 |
| 1054 | 1056 |
| 1055 LInstruction* LChunkBuilder::DoInstanceOfKnownGlobal( | 1057 LInstruction* LChunkBuilder::DoInstanceOfKnownGlobal( |
| 1056 HInstanceOfKnownGlobal* instr) { | 1058 HInstanceOfKnownGlobal* instr) { |
| 1057 LInstanceOfKnownGlobal* result = | 1059 LInstanceOfKnownGlobal* result = |
| 1058 new(zone()) LInstanceOfKnownGlobal(UseFixed(instr->left(), a0), | 1060 new(zone()) LInstanceOfKnownGlobal( |
| 1059 FixedTemp(t0)); | 1061 UseFixed(instr->context(), cp), |
| 1062 UseFixed(instr->left(), a0), |
| 1063 FixedTemp(t0)); |
| 1060 return MarkAsCall(DefineFixed(result, v0), instr); | 1064 return MarkAsCall(DefineFixed(result, v0), instr); |
| 1061 } | 1065 } |
| 1062 | 1066 |
| 1063 | 1067 |
| 1064 LInstruction* LChunkBuilder::DoInstanceSize(HInstanceSize* instr) { | 1068 LInstruction* LChunkBuilder::DoInstanceSize(HInstanceSize* instr) { |
| 1065 LOperand* object = UseRegisterAtStart(instr->object()); | 1069 LOperand* object = UseRegisterAtStart(instr->object()); |
| 1066 return DefineAsRegister(new(zone()) LInstanceSize(object)); | 1070 return DefineAsRegister(new(zone()) LInstanceSize(object)); |
| 1067 } | 1071 } |
| 1068 | 1072 |
| 1069 | 1073 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1113 | 1117 |
| 1114 | 1118 |
| 1115 LInstruction* LChunkBuilder::DoThisFunction(HThisFunction* instr) { | 1119 LInstruction* LChunkBuilder::DoThisFunction(HThisFunction* instr) { |
| 1116 return instr->HasNoUses() | 1120 return instr->HasNoUses() |
| 1117 ? NULL | 1121 ? NULL |
| 1118 : DefineAsRegister(new(zone()) LThisFunction); | 1122 : DefineAsRegister(new(zone()) LThisFunction); |
| 1119 } | 1123 } |
| 1120 | 1124 |
| 1121 | 1125 |
| 1122 LInstruction* LChunkBuilder::DoContext(HContext* instr) { | 1126 LInstruction* LChunkBuilder::DoContext(HContext* instr) { |
| 1123 // If there is a non-return use, the context must be allocated in a register. | 1127 if (instr->HasNoUses()) return NULL; |
| 1124 for (HUseIterator it(instr->uses()); !it.Done(); it.Advance()) { | 1128 |
| 1125 if (!it.value()->IsReturn()) { | 1129 if (info()->IsStub()) { |
| 1126 return DefineAsRegister(new(zone()) LContext); | 1130 return DefineFixed(new(zone()) LContext, cp); |
| 1127 } | |
| 1128 } | 1131 } |
| 1129 | 1132 |
| 1130 return NULL; | 1133 return DefineAsRegister(new(zone()) LContext); |
| 1131 } | 1134 } |
| 1132 | 1135 |
| 1133 | 1136 |
| 1134 LInstruction* LChunkBuilder::DoOuterContext(HOuterContext* instr) { | 1137 LInstruction* LChunkBuilder::DoOuterContext(HOuterContext* instr) { |
| 1135 LOperand* context = UseRegisterAtStart(instr->value()); | 1138 LOperand* context = UseRegisterAtStart(instr->value()); |
| 1136 return DefineAsRegister(new(zone()) LOuterContext(context)); | 1139 return DefineAsRegister(new(zone()) LOuterContext(context)); |
| 1137 } | 1140 } |
| 1138 | 1141 |
| 1139 | 1142 |
| 1140 LInstruction* LChunkBuilder::DoDeclareGlobals(HDeclareGlobals* instr) { | 1143 LInstruction* LChunkBuilder::DoDeclareGlobals(HDeclareGlobals* instr) { |
| 1141 return MarkAsCall(new(zone()) LDeclareGlobals, instr); | 1144 LOperand* context = UseFixed(instr->context(), cp); |
| 1145 return MarkAsCall(new(zone()) LDeclareGlobals(context), instr); |
| 1142 } | 1146 } |
| 1143 | 1147 |
| 1144 | 1148 |
| 1145 LInstruction* LChunkBuilder::DoGlobalObject(HGlobalObject* instr) { | 1149 LInstruction* LChunkBuilder::DoGlobalObject(HGlobalObject* instr) { |
| 1146 LOperand* context = UseRegisterAtStart(instr->value()); | 1150 LOperand* context = UseRegisterAtStart(instr->value()); |
| 1147 return DefineAsRegister(new(zone()) LGlobalObject(context)); | 1151 return DefineAsRegister(new(zone()) LGlobalObject(context)); |
| 1148 } | 1152 } |
| 1149 | 1153 |
| 1150 | 1154 |
| 1151 LInstruction* LChunkBuilder::DoGlobalReceiver(HGlobalReceiver* instr) { | 1155 LInstruction* LChunkBuilder::DoGlobalReceiver(HGlobalReceiver* instr) { |
| 1152 LOperand* global_object = UseRegisterAtStart(instr->value()); | 1156 LOperand* global_object = UseRegisterAtStart(instr->value()); |
| 1153 return DefineAsRegister(new(zone()) LGlobalReceiver(global_object)); | 1157 return DefineAsRegister(new(zone()) LGlobalReceiver(global_object)); |
| 1154 } | 1158 } |
| 1155 | 1159 |
| 1156 | 1160 |
| 1157 LInstruction* LChunkBuilder::DoCallConstantFunction( | 1161 LInstruction* LChunkBuilder::DoCallConstantFunction( |
| 1158 HCallConstantFunction* instr) { | 1162 HCallConstantFunction* instr) { |
| 1159 argument_count_ -= instr->argument_count(); | 1163 argument_count_ -= instr->argument_count(); |
| 1160 return MarkAsCall(DefineFixed(new(zone()) LCallConstantFunction, v0), instr); | 1164 return MarkAsCall(DefineFixed(new(zone()) LCallConstantFunction, v0), instr); |
| 1161 } | 1165 } |
| 1162 | 1166 |
| 1163 | 1167 |
| 1164 LInstruction* LChunkBuilder::DoInvokeFunction(HInvokeFunction* instr) { | 1168 LInstruction* LChunkBuilder::DoInvokeFunction(HInvokeFunction* instr) { |
| 1169 LOperand* context = UseFixed(instr->context(), cp); |
| 1165 LOperand* function = UseFixed(instr->function(), a1); | 1170 LOperand* function = UseFixed(instr->function(), a1); |
| 1166 argument_count_ -= instr->argument_count(); | 1171 argument_count_ -= instr->argument_count(); |
| 1167 LInvokeFunction* result = new(zone()) LInvokeFunction(function); | 1172 LInvokeFunction* result = new(zone()) LInvokeFunction(context, function); |
| 1168 return MarkAsCall(DefineFixed(result, v0), instr, CANNOT_DEOPTIMIZE_EAGERLY); | 1173 return MarkAsCall(DefineFixed(result, v0), instr, CANNOT_DEOPTIMIZE_EAGERLY); |
| 1169 } | 1174 } |
| 1170 | 1175 |
| 1171 | 1176 |
| 1172 LInstruction* LChunkBuilder::DoUnaryMathOperation(HUnaryMathOperation* instr) { | 1177 LInstruction* LChunkBuilder::DoUnaryMathOperation(HUnaryMathOperation* instr) { |
| 1173 switch (instr->op()) { | 1178 switch (instr->op()) { |
| 1174 case kMathFloor: return DoMathFloor(instr); | 1179 case kMathFloor: return DoMathFloor(instr); |
| 1175 case kMathRound: return DoMathRound(instr); | 1180 case kMathRound: return DoMathRound(instr); |
| 1176 case kMathAbs: return DoMathAbs(instr); | 1181 case kMathAbs: return DoMathAbs(instr); |
| 1177 case kMathLog: return DoMathLog(instr); | 1182 case kMathLog: return DoMathLog(instr); |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1231 LInstruction* LChunkBuilder::DoMathPowHalf(HUnaryMathOperation* instr) { | 1236 LInstruction* LChunkBuilder::DoMathPowHalf(HUnaryMathOperation* instr) { |
| 1232 // Input cannot be the same as the result, see LCodeGen::DoMathPowHalf. | 1237 // Input cannot be the same as the result, see LCodeGen::DoMathPowHalf. |
| 1233 LOperand* input = UseFixedDouble(instr->value(), f8); | 1238 LOperand* input = UseFixedDouble(instr->value(), f8); |
| 1234 LOperand* temp = FixedTemp(f6); | 1239 LOperand* temp = FixedTemp(f6); |
| 1235 LMathPowHalf* result = new(zone()) LMathPowHalf(input, temp); | 1240 LMathPowHalf* result = new(zone()) LMathPowHalf(input, temp); |
| 1236 return DefineFixedDouble(result, f4); | 1241 return DefineFixedDouble(result, f4); |
| 1237 } | 1242 } |
| 1238 | 1243 |
| 1239 | 1244 |
| 1240 LInstruction* LChunkBuilder::DoMathAbs(HUnaryMathOperation* instr) { | 1245 LInstruction* LChunkBuilder::DoMathAbs(HUnaryMathOperation* instr) { |
| 1246 Representation r = instr->value()->representation(); |
| 1247 LOperand* context = (r.IsDouble() || r.IsSmiOrInteger32()) |
| 1248 ? NULL |
| 1249 : UseFixed(instr->context(), cp); |
| 1241 LOperand* input = UseRegister(instr->value()); | 1250 LOperand* input = UseRegister(instr->value()); |
| 1242 LMathAbs* result = new(zone()) LMathAbs(input); | 1251 LMathAbs* result = new(zone()) LMathAbs(context, input); |
| 1243 return AssignEnvironment(AssignPointerMap(DefineAsRegister(result))); | 1252 return AssignEnvironment(AssignPointerMap(DefineAsRegister(result))); |
| 1244 } | 1253 } |
| 1245 | 1254 |
| 1246 | 1255 |
| 1247 LInstruction* LChunkBuilder::DoMathFloor(HUnaryMathOperation* instr) { | 1256 LInstruction* LChunkBuilder::DoMathFloor(HUnaryMathOperation* instr) { |
| 1248 LOperand* input = UseRegister(instr->value()); | 1257 LOperand* input = UseRegister(instr->value()); |
| 1249 LOperand* temp = TempRegister(); | 1258 LOperand* temp = TempRegister(); |
| 1250 LMathFloor* result = new(zone()) LMathFloor(input, temp); | 1259 LMathFloor* result = new(zone()) LMathFloor(input, temp); |
| 1251 return AssignEnvironment(AssignPointerMap(DefineAsRegister(result))); | 1260 return AssignEnvironment(AssignPointerMap(DefineAsRegister(result))); |
| 1252 } | 1261 } |
| 1253 | 1262 |
| 1254 | 1263 |
| 1255 LInstruction* LChunkBuilder::DoMathSqrt(HUnaryMathOperation* instr) { | 1264 LInstruction* LChunkBuilder::DoMathSqrt(HUnaryMathOperation* instr) { |
| 1256 LOperand* input = UseRegister(instr->value()); | 1265 LOperand* input = UseRegister(instr->value()); |
| 1257 LMathSqrt* result = new(zone()) LMathSqrt(input); | 1266 LMathSqrt* result = new(zone()) LMathSqrt(input); |
| 1258 return DefineAsRegister(result); | 1267 return DefineAsRegister(result); |
| 1259 } | 1268 } |
| 1260 | 1269 |
| 1261 | 1270 |
| 1262 LInstruction* LChunkBuilder::DoMathRound(HUnaryMathOperation* instr) { | 1271 LInstruction* LChunkBuilder::DoMathRound(HUnaryMathOperation* instr) { |
| 1263 LOperand* input = UseRegister(instr->value()); | 1272 LOperand* input = UseRegister(instr->value()); |
| 1264 LOperand* temp = FixedTemp(f6); | 1273 LOperand* temp = FixedTemp(f6); |
| 1265 LMathRound* result = new(zone()) LMathRound(input, temp); | 1274 LMathRound* result = new(zone()) LMathRound(input, temp); |
| 1266 return AssignEnvironment(DefineAsRegister(result)); | 1275 return AssignEnvironment(DefineAsRegister(result)); |
| 1267 } | 1276 } |
| 1268 | 1277 |
| 1269 | 1278 |
| 1270 LInstruction* LChunkBuilder::DoCallKeyed(HCallKeyed* instr) { | 1279 LInstruction* LChunkBuilder::DoCallKeyed(HCallKeyed* instr) { |
| 1271 ASSERT(instr->key()->representation().IsTagged()); | 1280 ASSERT(instr->key()->representation().IsTagged()); |
| 1281 LOperand* context = UseFixed(instr->context(), cp); |
| 1272 argument_count_ -= instr->argument_count(); | 1282 argument_count_ -= instr->argument_count(); |
| 1273 LOperand* key = UseFixed(instr->key(), a2); | 1283 LOperand* key = UseFixed(instr->key(), a2); |
| 1274 return MarkAsCall(DefineFixed(new(zone()) LCallKeyed(key), v0), instr); | 1284 return MarkAsCall( |
| 1285 DefineFixed(new(zone()) LCallKeyed(context, key), v0), instr); |
| 1275 } | 1286 } |
| 1276 | 1287 |
| 1277 | 1288 |
| 1278 LInstruction* LChunkBuilder::DoCallNamed(HCallNamed* instr) { | 1289 LInstruction* LChunkBuilder::DoCallNamed(HCallNamed* instr) { |
| 1290 LOperand* context = UseFixed(instr->context(), cp); |
| 1279 argument_count_ -= instr->argument_count(); | 1291 argument_count_ -= instr->argument_count(); |
| 1280 return MarkAsCall(DefineFixed(new(zone()) LCallNamed, v0), instr); | 1292 return MarkAsCall(DefineFixed(new(zone()) LCallNamed(context), v0), instr); |
| 1281 } | 1293 } |
| 1282 | 1294 |
| 1283 | 1295 |
| 1284 LInstruction* LChunkBuilder::DoCallGlobal(HCallGlobal* instr) { | 1296 LInstruction* LChunkBuilder::DoCallGlobal(HCallGlobal* instr) { |
| 1297 LOperand* context = UseFixed(instr->context(), cp); |
| 1285 argument_count_ -= instr->argument_count(); | 1298 argument_count_ -= instr->argument_count(); |
| 1286 return MarkAsCall(DefineFixed(new(zone()) LCallGlobal, v0), instr); | 1299 return MarkAsCall(DefineFixed(new(zone()) LCallGlobal(context), v0), instr); |
| 1287 } | 1300 } |
| 1288 | 1301 |
| 1289 | 1302 |
| 1290 LInstruction* LChunkBuilder::DoCallKnownGlobal(HCallKnownGlobal* instr) { | 1303 LInstruction* LChunkBuilder::DoCallKnownGlobal(HCallKnownGlobal* instr) { |
| 1291 argument_count_ -= instr->argument_count(); | 1304 argument_count_ -= instr->argument_count(); |
| 1292 return MarkAsCall(DefineFixed(new(zone()) LCallKnownGlobal, v0), instr); | 1305 return MarkAsCall(DefineFixed(new(zone()) LCallKnownGlobal, v0), instr); |
| 1293 } | 1306 } |
| 1294 | 1307 |
| 1295 | 1308 |
| 1296 LInstruction* LChunkBuilder::DoCallNew(HCallNew* instr) { | 1309 LInstruction* LChunkBuilder::DoCallNew(HCallNew* instr) { |
| 1310 LOperand* context = UseFixed(instr->context(), cp); |
| 1297 LOperand* constructor = UseFixed(instr->constructor(), a1); | 1311 LOperand* constructor = UseFixed(instr->constructor(), a1); |
| 1298 argument_count_ -= instr->argument_count(); | 1312 argument_count_ -= instr->argument_count(); |
| 1299 LCallNew* result = new(zone()) LCallNew(constructor); | 1313 LCallNew* result = new(zone()) LCallNew(context, constructor); |
| 1300 return MarkAsCall(DefineFixed(result, v0), instr); | 1314 return MarkAsCall(DefineFixed(result, v0), instr); |
| 1301 } | 1315 } |
| 1302 | 1316 |
| 1303 | 1317 |
| 1304 LInstruction* LChunkBuilder::DoCallNewArray(HCallNewArray* instr) { | 1318 LInstruction* LChunkBuilder::DoCallNewArray(HCallNewArray* instr) { |
| 1319 LOperand* context = UseFixed(instr->context(), cp); |
| 1305 LOperand* constructor = UseFixed(instr->constructor(), a1); | 1320 LOperand* constructor = UseFixed(instr->constructor(), a1); |
| 1306 argument_count_ -= instr->argument_count(); | 1321 argument_count_ -= instr->argument_count(); |
| 1307 LCallNewArray* result = new(zone()) LCallNewArray(constructor); | 1322 LCallNewArray* result = new(zone()) LCallNewArray(context, constructor); |
| 1308 return MarkAsCall(DefineFixed(result, v0), instr); | 1323 return MarkAsCall(DefineFixed(result, v0), instr); |
| 1309 } | 1324 } |
| 1310 | 1325 |
| 1311 | 1326 |
| 1312 LInstruction* LChunkBuilder::DoCallFunction(HCallFunction* instr) { | 1327 LInstruction* LChunkBuilder::DoCallFunction(HCallFunction* instr) { |
| 1328 LOperand* context = UseFixed(instr->context(), cp); |
| 1313 LOperand* function = UseFixed(instr->function(), a1); | 1329 LOperand* function = UseFixed(instr->function(), a1); |
| 1314 argument_count_ -= instr->argument_count(); | 1330 argument_count_ -= instr->argument_count(); |
| 1315 return MarkAsCall(DefineFixed(new(zone()) LCallFunction(function), v0), | 1331 return MarkAsCall( |
| 1316 instr); | 1332 DefineFixed(new(zone()) LCallFunction(context, function), v0), instr); |
| 1317 } | 1333 } |
| 1318 | 1334 |
| 1319 | 1335 |
| 1320 LInstruction* LChunkBuilder::DoCallRuntime(HCallRuntime* instr) { | 1336 LInstruction* LChunkBuilder::DoCallRuntime(HCallRuntime* instr) { |
| 1321 argument_count_ -= instr->argument_count(); | 1337 argument_count_ -= instr->argument_count(); |
| 1322 return MarkAsCall(DefineFixed(new(zone()) LCallRuntime, v0), instr); | 1338 LOperand* context = UseFixed(instr->context(), cp); |
| 1339 return MarkAsCall(DefineFixed(new(zone()) LCallRuntime(context), v0), instr); |
| 1323 } | 1340 } |
| 1324 | 1341 |
| 1325 | 1342 |
| 1326 LInstruction* LChunkBuilder::DoRor(HRor* instr) { | 1343 LInstruction* LChunkBuilder::DoRor(HRor* instr) { |
| 1327 return DoShift(Token::ROR, instr); | 1344 return DoShift(Token::ROR, instr); |
| 1328 } | 1345 } |
| 1329 | 1346 |
| 1330 | 1347 |
| 1331 LInstruction* LChunkBuilder::DoShr(HShr* instr) { | 1348 LInstruction* LChunkBuilder::DoShr(HShr* instr) { |
| 1332 return DoShift(Token::SHR, instr); | 1349 return DoShift(Token::SHR, instr); |
| (...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1633 LOperand* scratch3 = TempRegister(); | 1650 LOperand* scratch3 = TempRegister(); |
| 1634 LRandom* result = new(zone()) LRandom( | 1651 LRandom* result = new(zone()) LRandom( |
| 1635 global_object, scratch, scratch2, scratch3); | 1652 global_object, scratch, scratch2, scratch3); |
| 1636 return DefineFixedDouble(result, f0); | 1653 return DefineFixedDouble(result, f0); |
| 1637 } | 1654 } |
| 1638 | 1655 |
| 1639 | 1656 |
| 1640 LInstruction* LChunkBuilder::DoCompareGeneric(HCompareGeneric* instr) { | 1657 LInstruction* LChunkBuilder::DoCompareGeneric(HCompareGeneric* instr) { |
| 1641 ASSERT(instr->left()->representation().IsTagged()); | 1658 ASSERT(instr->left()->representation().IsTagged()); |
| 1642 ASSERT(instr->right()->representation().IsTagged()); | 1659 ASSERT(instr->right()->representation().IsTagged()); |
| 1660 LOperand* context = UseFixed(instr->context(), cp); |
| 1643 LOperand* left = UseFixed(instr->left(), a1); | 1661 LOperand* left = UseFixed(instr->left(), a1); |
| 1644 LOperand* right = UseFixed(instr->right(), a0); | 1662 LOperand* right = UseFixed(instr->right(), a0); |
| 1645 LCmpT* result = new(zone()) LCmpT(left, right); | 1663 LCmpT* result = new(zone()) LCmpT(context, left, right); |
| 1646 return MarkAsCall(DefineFixed(result, v0), instr); | 1664 return MarkAsCall(DefineFixed(result, v0), instr); |
| 1647 } | 1665 } |
| 1648 | 1666 |
| 1649 | 1667 |
| 1650 LInstruction* LChunkBuilder::DoCompareNumericAndBranch( | 1668 LInstruction* LChunkBuilder::DoCompareNumericAndBranch( |
| 1651 HCompareNumericAndBranch* instr) { | 1669 HCompareNumericAndBranch* instr) { |
| 1652 Representation r = instr->representation(); | 1670 Representation r = instr->representation(); |
| 1653 if (r.IsSmiOrInteger32()) { | 1671 if (r.IsSmiOrInteger32()) { |
| 1654 ASSERT(instr->left()->representation().Equals(r)); | 1672 ASSERT(instr->left()->representation().Equals(r)); |
| 1655 ASSERT(instr->right()->representation().Equals(r)); | 1673 ASSERT(instr->right()->representation().Equals(r)); |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1709 ASSERT(instr->value()->representation().IsTagged()); | 1727 ASSERT(instr->value()->representation().IsTagged()); |
| 1710 return new(zone()) LIsUndetectableAndBranch( | 1728 return new(zone()) LIsUndetectableAndBranch( |
| 1711 UseRegisterAtStart(instr->value()), TempRegister()); | 1729 UseRegisterAtStart(instr->value()), TempRegister()); |
| 1712 } | 1730 } |
| 1713 | 1731 |
| 1714 | 1732 |
| 1715 LInstruction* LChunkBuilder::DoStringCompareAndBranch( | 1733 LInstruction* LChunkBuilder::DoStringCompareAndBranch( |
| 1716 HStringCompareAndBranch* instr) { | 1734 HStringCompareAndBranch* instr) { |
| 1717 ASSERT(instr->left()->representation().IsTagged()); | 1735 ASSERT(instr->left()->representation().IsTagged()); |
| 1718 ASSERT(instr->right()->representation().IsTagged()); | 1736 ASSERT(instr->right()->representation().IsTagged()); |
| 1737 LOperand* context = UseFixed(instr->context(), cp); |
| 1719 LOperand* left = UseFixed(instr->left(), a1); | 1738 LOperand* left = UseFixed(instr->left(), a1); |
| 1720 LOperand* right = UseFixed(instr->right(), a0); | 1739 LOperand* right = UseFixed(instr->right(), a0); |
| 1721 LStringCompareAndBranch* result = | 1740 LStringCompareAndBranch* result = |
| 1722 new(zone()) LStringCompareAndBranch(left, right); | 1741 new(zone()) LStringCompareAndBranch(context, left, right); |
| 1723 return MarkAsCall(result, instr); | 1742 return MarkAsCall(result, instr); |
| 1724 } | 1743 } |
| 1725 | 1744 |
| 1726 | 1745 |
| 1727 LInstruction* LChunkBuilder::DoHasInstanceTypeAndBranch( | 1746 LInstruction* LChunkBuilder::DoHasInstanceTypeAndBranch( |
| 1728 HHasInstanceTypeAndBranch* instr) { | 1747 HHasInstanceTypeAndBranch* instr) { |
| 1729 ASSERT(instr->value()->representation().IsTagged()); | 1748 ASSERT(instr->value()->representation().IsTagged()); |
| 1730 LOperand* value = UseRegisterAtStart(instr->value()); | 1749 LOperand* value = UseRegisterAtStart(instr->value()); |
| 1731 return new(zone()) LHasInstanceTypeAndBranch(value); | 1750 return new(zone()) LHasInstanceTypeAndBranch(value); |
| 1732 } | 1751 } |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1807 | 1826 |
| 1808 | 1827 |
| 1809 LInstruction* LChunkBuilder::DoAbnormalExit(HAbnormalExit* instr) { | 1828 LInstruction* LChunkBuilder::DoAbnormalExit(HAbnormalExit* instr) { |
| 1810 // The control instruction marking the end of a block that completed | 1829 // The control instruction marking the end of a block that completed |
| 1811 // abruptly (e.g., threw an exception). There is nothing specific to do. | 1830 // abruptly (e.g., threw an exception). There is nothing specific to do. |
| 1812 return NULL; | 1831 return NULL; |
| 1813 } | 1832 } |
| 1814 | 1833 |
| 1815 | 1834 |
| 1816 LInstruction* LChunkBuilder::DoThrow(HThrow* instr) { | 1835 LInstruction* LChunkBuilder::DoThrow(HThrow* instr) { |
| 1836 LOperand* context = UseFixed(instr->context(), cp); |
| 1817 LOperand* value = UseFixed(instr->value(), a0); | 1837 LOperand* value = UseFixed(instr->value(), a0); |
| 1818 return MarkAsCall(new(zone()) LThrow(value), instr); | 1838 return MarkAsCall(new(zone()) LThrow(context, value), instr); |
| 1819 } | 1839 } |
| 1820 | 1840 |
| 1821 | 1841 |
| 1822 LInstruction* LChunkBuilder::DoUseConst(HUseConst* instr) { | 1842 LInstruction* LChunkBuilder::DoUseConst(HUseConst* instr) { |
| 1823 return NULL; | 1843 return NULL; |
| 1824 } | 1844 } |
| 1825 | 1845 |
| 1826 | 1846 |
| 1827 LInstruction* LChunkBuilder::DoForceRepresentation(HForceRepresentation* bad) { | 1847 LInstruction* LChunkBuilder::DoForceRepresentation(HForceRepresentation* bad) { |
| 1828 // All HForceRepresentation instructions should be eliminated in the | 1848 // All HForceRepresentation instructions should be eliminated in the |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1989 ASSERT(input_rep.IsSmiOrTagged()); | 2009 ASSERT(input_rep.IsSmiOrTagged()); |
| 1990 // Register allocator doesn't (yet) support allocation of double | 2010 // Register allocator doesn't (yet) support allocation of double |
| 1991 // temps. Reserve f22 explicitly. | 2011 // temps. Reserve f22 explicitly. |
| 1992 LClampTToUint8* result = new(zone()) LClampTToUint8(reg, FixedTemp(f22)); | 2012 LClampTToUint8* result = new(zone()) LClampTToUint8(reg, FixedTemp(f22)); |
| 1993 return AssignEnvironment(DefineAsRegister(result)); | 2013 return AssignEnvironment(DefineAsRegister(result)); |
| 1994 } | 2014 } |
| 1995 } | 2015 } |
| 1996 | 2016 |
| 1997 | 2017 |
| 1998 LInstruction* LChunkBuilder::DoReturn(HReturn* instr) { | 2018 LInstruction* LChunkBuilder::DoReturn(HReturn* instr) { |
| 2019 LOperand* context = info()->IsStub() |
| 2020 ? UseFixed(instr->context(), cp) |
| 2021 : NULL; |
| 1999 LOperand* parameter_count = UseRegisterOrConstant(instr->parameter_count()); | 2022 LOperand* parameter_count = UseRegisterOrConstant(instr->parameter_count()); |
| 2000 return new(zone()) LReturn(UseFixed(instr->value(), v0), | 2023 return new(zone()) LReturn(UseFixed(instr->value(), v0), context, |
| 2001 parameter_count); | 2024 parameter_count); |
| 2002 } | 2025 } |
| 2003 | 2026 |
| 2004 | 2027 |
| 2005 LInstruction* LChunkBuilder::DoConstant(HConstant* instr) { | 2028 LInstruction* LChunkBuilder::DoConstant(HConstant* instr) { |
| 2006 Representation r = instr->representation(); | 2029 Representation r = instr->representation(); |
| 2007 if (r.IsSmi()) { | 2030 if (r.IsSmi()) { |
| 2008 return DefineAsRegister(new(zone()) LConstantS); | 2031 return DefineAsRegister(new(zone()) LConstantS); |
| 2009 } else if (r.IsInteger32()) { | 2032 } else if (r.IsInteger32()) { |
| 2010 return DefineAsRegister(new(zone()) LConstantI); | 2033 return DefineAsRegister(new(zone()) LConstantI); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 2023 | 2046 |
| 2024 LInstruction* LChunkBuilder::DoLoadGlobalCell(HLoadGlobalCell* instr) { | 2047 LInstruction* LChunkBuilder::DoLoadGlobalCell(HLoadGlobalCell* instr) { |
| 2025 LLoadGlobalCell* result = new(zone()) LLoadGlobalCell; | 2048 LLoadGlobalCell* result = new(zone()) LLoadGlobalCell; |
| 2026 return instr->RequiresHoleCheck() | 2049 return instr->RequiresHoleCheck() |
| 2027 ? AssignEnvironment(DefineAsRegister(result)) | 2050 ? AssignEnvironment(DefineAsRegister(result)) |
| 2028 : DefineAsRegister(result); | 2051 : DefineAsRegister(result); |
| 2029 } | 2052 } |
| 2030 | 2053 |
| 2031 | 2054 |
| 2032 LInstruction* LChunkBuilder::DoLoadGlobalGeneric(HLoadGlobalGeneric* instr) { | 2055 LInstruction* LChunkBuilder::DoLoadGlobalGeneric(HLoadGlobalGeneric* instr) { |
| 2056 LOperand* context = UseFixed(instr->context(), cp); |
| 2033 LOperand* global_object = UseFixed(instr->global_object(), a0); | 2057 LOperand* global_object = UseFixed(instr->global_object(), a0); |
| 2034 LLoadGlobalGeneric* result = new(zone()) LLoadGlobalGeneric(global_object); | 2058 LLoadGlobalGeneric* result = |
| 2059 new(zone()) LLoadGlobalGeneric(context, global_object); |
| 2035 return MarkAsCall(DefineFixed(result, v0), instr); | 2060 return MarkAsCall(DefineFixed(result, v0), instr); |
| 2036 } | 2061 } |
| 2037 | 2062 |
| 2038 | 2063 |
| 2039 LInstruction* LChunkBuilder::DoStoreGlobalCell(HStoreGlobalCell* instr) { | 2064 LInstruction* LChunkBuilder::DoStoreGlobalCell(HStoreGlobalCell* instr) { |
| 2040 LOperand* value = UseRegister(instr->value()); | 2065 LOperand* value = UseRegister(instr->value()); |
| 2041 // Use a temp to check the value in the cell in the case where we perform | 2066 // Use a temp to check the value in the cell in the case where we perform |
| 2042 // a hole check. | 2067 // a hole check. |
| 2043 return instr->RequiresHoleCheck() | 2068 return instr->RequiresHoleCheck() |
| 2044 ? AssignEnvironment(new(zone()) LStoreGlobalCell(value, TempRegister())) | 2069 ? AssignEnvironment(new(zone()) LStoreGlobalCell(value, TempRegister())) |
| 2045 : new(zone()) LStoreGlobalCell(value, NULL); | 2070 : new(zone()) LStoreGlobalCell(value, NULL); |
| 2046 } | 2071 } |
| 2047 | 2072 |
| 2048 | 2073 |
| 2049 LInstruction* LChunkBuilder::DoStoreGlobalGeneric(HStoreGlobalGeneric* instr) { | 2074 LInstruction* LChunkBuilder::DoStoreGlobalGeneric(HStoreGlobalGeneric* instr) { |
| 2075 LOperand* context = UseFixed(instr->context(), cp); |
| 2050 LOperand* global_object = UseFixed(instr->global_object(), a1); | 2076 LOperand* global_object = UseFixed(instr->global_object(), a1); |
| 2051 LOperand* value = UseFixed(instr->value(), a0); | 2077 LOperand* value = UseFixed(instr->value(), a0); |
| 2052 LStoreGlobalGeneric* result = | 2078 LStoreGlobalGeneric* result = |
| 2053 new(zone()) LStoreGlobalGeneric(global_object, value); | 2079 new(zone()) LStoreGlobalGeneric(context, global_object, value); |
| 2054 return MarkAsCall(result, instr); | 2080 return MarkAsCall(result, instr); |
| 2055 } | 2081 } |
| 2056 | 2082 |
| 2057 | 2083 |
| 2058 LInstruction* LChunkBuilder::DoLoadContextSlot(HLoadContextSlot* instr) { | 2084 LInstruction* LChunkBuilder::DoLoadContextSlot(HLoadContextSlot* instr) { |
| 2059 LOperand* context = UseRegisterAtStart(instr->value()); | 2085 LOperand* context = UseRegisterAtStart(instr->value()); |
| 2060 LInstruction* result = | 2086 LInstruction* result = |
| 2061 DefineAsRegister(new(zone()) LLoadContextSlot(context)); | 2087 DefineAsRegister(new(zone()) LLoadContextSlot(context)); |
| 2062 return instr->RequiresHoleCheck() ? AssignEnvironment(result) : result; | 2088 return instr->RequiresHoleCheck() ? AssignEnvironment(result) : result; |
| 2063 } | 2089 } |
| (...skipping 14 matching lines...) Expand all Loading... |
| 2078 } | 2104 } |
| 2079 | 2105 |
| 2080 | 2106 |
| 2081 LInstruction* LChunkBuilder::DoLoadNamedField(HLoadNamedField* instr) { | 2107 LInstruction* LChunkBuilder::DoLoadNamedField(HLoadNamedField* instr) { |
| 2082 LOperand* obj = UseRegisterAtStart(instr->object()); | 2108 LOperand* obj = UseRegisterAtStart(instr->object()); |
| 2083 return DefineAsRegister(new(zone()) LLoadNamedField(obj)); | 2109 return DefineAsRegister(new(zone()) LLoadNamedField(obj)); |
| 2084 } | 2110 } |
| 2085 | 2111 |
| 2086 | 2112 |
| 2087 LInstruction* LChunkBuilder::DoLoadNamedGeneric(HLoadNamedGeneric* instr) { | 2113 LInstruction* LChunkBuilder::DoLoadNamedGeneric(HLoadNamedGeneric* instr) { |
| 2114 LOperand* context = UseFixed(instr->context(), cp); |
| 2088 LOperand* object = UseFixed(instr->object(), a0); | 2115 LOperand* object = UseFixed(instr->object(), a0); |
| 2089 LInstruction* result = DefineFixed(new(zone()) LLoadNamedGeneric(object), v0); | 2116 LInstruction* result = |
| 2117 DefineFixed(new(zone()) LLoadNamedGeneric(context, object), v0); |
| 2090 return MarkAsCall(result, instr); | 2118 return MarkAsCall(result, instr); |
| 2091 } | 2119 } |
| 2092 | 2120 |
| 2093 | 2121 |
| 2094 LInstruction* LChunkBuilder::DoLoadFunctionPrototype( | 2122 LInstruction* LChunkBuilder::DoLoadFunctionPrototype( |
| 2095 HLoadFunctionPrototype* instr) { | 2123 HLoadFunctionPrototype* instr) { |
| 2096 return AssignEnvironment(DefineAsRegister( | 2124 return AssignEnvironment(DefineAsRegister( |
| 2097 new(zone()) LLoadFunctionPrototype(UseRegister(instr->function())))); | 2125 new(zone()) LLoadFunctionPrototype(UseRegister(instr->function())))); |
| 2098 } | 2126 } |
| 2099 | 2127 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2140 DefineAsRegister(result); | 2168 DefineAsRegister(result); |
| 2141 // An unsigned int array load might overflow and cause a deopt, make sure it | 2169 // An unsigned int array load might overflow and cause a deopt, make sure it |
| 2142 // has an environment. | 2170 // has an environment. |
| 2143 bool can_deoptimize = instr->RequiresHoleCheck() || | 2171 bool can_deoptimize = instr->RequiresHoleCheck() || |
| 2144 (elements_kind == EXTERNAL_UNSIGNED_INT_ELEMENTS); | 2172 (elements_kind == EXTERNAL_UNSIGNED_INT_ELEMENTS); |
| 2145 return can_deoptimize ? AssignEnvironment(result) : result; | 2173 return can_deoptimize ? AssignEnvironment(result) : result; |
| 2146 } | 2174 } |
| 2147 | 2175 |
| 2148 | 2176 |
| 2149 LInstruction* LChunkBuilder::DoLoadKeyedGeneric(HLoadKeyedGeneric* instr) { | 2177 LInstruction* LChunkBuilder::DoLoadKeyedGeneric(HLoadKeyedGeneric* instr) { |
| 2178 LOperand* context = UseFixed(instr->context(), cp); |
| 2150 LOperand* object = UseFixed(instr->object(), a1); | 2179 LOperand* object = UseFixed(instr->object(), a1); |
| 2151 LOperand* key = UseFixed(instr->key(), a0); | 2180 LOperand* key = UseFixed(instr->key(), a0); |
| 2152 | 2181 |
| 2153 LInstruction* result = | 2182 LInstruction* result = |
| 2154 DefineFixed(new(zone()) LLoadKeyedGeneric(object, key), v0); | 2183 DefineFixed(new(zone()) LLoadKeyedGeneric(context, object, key), v0); |
| 2155 return MarkAsCall(result, instr); | 2184 return MarkAsCall(result, instr); |
| 2156 } | 2185 } |
| 2157 | 2186 |
| 2158 | 2187 |
| 2159 LInstruction* LChunkBuilder::DoStoreKeyed(HStoreKeyed* instr) { | 2188 LInstruction* LChunkBuilder::DoStoreKeyed(HStoreKeyed* instr) { |
| 2160 if (!instr->is_external()) { | 2189 if (!instr->is_external()) { |
| 2161 ASSERT(instr->elements()->representation().IsTagged()); | 2190 ASSERT(instr->elements()->representation().IsTagged()); |
| 2162 bool needs_write_barrier = instr->NeedsWriteBarrier(); | 2191 bool needs_write_barrier = instr->NeedsWriteBarrier(); |
| 2163 LOperand* object = NULL; | 2192 LOperand* object = NULL; |
| 2164 LOperand* val = NULL; | 2193 LOperand* val = NULL; |
| (...skipping 29 matching lines...) Expand all Loading... |
| 2194 ASSERT(instr->elements()->representation().IsExternal()); | 2223 ASSERT(instr->elements()->representation().IsExternal()); |
| 2195 LOperand* val = UseRegister(instr->value()); | 2224 LOperand* val = UseRegister(instr->value()); |
| 2196 LOperand* key = UseRegisterOrConstantAtStart(instr->key()); | 2225 LOperand* key = UseRegisterOrConstantAtStart(instr->key()); |
| 2197 LOperand* external_pointer = UseRegister(instr->elements()); | 2226 LOperand* external_pointer = UseRegister(instr->elements()); |
| 2198 | 2227 |
| 2199 return new(zone()) LStoreKeyed(external_pointer, key, val); | 2228 return new(zone()) LStoreKeyed(external_pointer, key, val); |
| 2200 } | 2229 } |
| 2201 | 2230 |
| 2202 | 2231 |
| 2203 LInstruction* LChunkBuilder::DoStoreKeyedGeneric(HStoreKeyedGeneric* instr) { | 2232 LInstruction* LChunkBuilder::DoStoreKeyedGeneric(HStoreKeyedGeneric* instr) { |
| 2233 LOperand* context = UseFixed(instr->context(), cp); |
| 2204 LOperand* obj = UseFixed(instr->object(), a2); | 2234 LOperand* obj = UseFixed(instr->object(), a2); |
| 2205 LOperand* key = UseFixed(instr->key(), a1); | 2235 LOperand* key = UseFixed(instr->key(), a1); |
| 2206 LOperand* val = UseFixed(instr->value(), a0); | 2236 LOperand* val = UseFixed(instr->value(), a0); |
| 2207 | 2237 |
| 2208 ASSERT(instr->object()->representation().IsTagged()); | 2238 ASSERT(instr->object()->representation().IsTagged()); |
| 2209 ASSERT(instr->key()->representation().IsTagged()); | 2239 ASSERT(instr->key()->representation().IsTagged()); |
| 2210 ASSERT(instr->value()->representation().IsTagged()); | 2240 ASSERT(instr->value()->representation().IsTagged()); |
| 2211 | 2241 |
| 2212 return MarkAsCall(new(zone()) LStoreKeyedGeneric(obj, key, val), instr); | 2242 return MarkAsCall( |
| 2243 new(zone()) LStoreKeyedGeneric(context, obj, key, val), instr); |
| 2213 } | 2244 } |
| 2214 | 2245 |
| 2215 | 2246 |
| 2216 LInstruction* LChunkBuilder::DoTransitionElementsKind( | 2247 LInstruction* LChunkBuilder::DoTransitionElementsKind( |
| 2217 HTransitionElementsKind* instr) { | 2248 HTransitionElementsKind* instr) { |
| 2218 LOperand* object = UseRegister(instr->object()); | 2249 LOperand* object = UseRegister(instr->object()); |
| 2219 if (IsSimpleMapChangeTransition(instr->from_kind(), instr->to_kind())) { | 2250 if (IsSimpleMapChangeTransition(instr->from_kind(), instr->to_kind())) { |
| 2220 LOperand* new_map_reg = TempRegister(); | 2251 LOperand* new_map_reg = TempRegister(); |
| 2221 LTransitionElementsKind* result = | 2252 LTransitionElementsKind* result = |
| 2222 new(zone()) LTransitionElementsKind(object, new_map_reg); | 2253 new(zone()) LTransitionElementsKind(object, NULL, new_map_reg); |
| 2223 return result; | 2254 return result; |
| 2224 } else { | 2255 } else { |
| 2256 LOperand* context = UseFixed(instr->context(), cp); |
| 2225 LTransitionElementsKind* result = | 2257 LTransitionElementsKind* result = |
| 2226 new(zone()) LTransitionElementsKind(object, NULL); | 2258 new(zone()) LTransitionElementsKind(object, context, NULL); |
| 2227 return AssignPointerMap(result); | 2259 return AssignPointerMap(result); |
| 2228 } | 2260 } |
| 2229 } | 2261 } |
| 2230 | 2262 |
| 2231 | 2263 |
| 2232 LInstruction* LChunkBuilder::DoTrapAllocationMemento( | 2264 LInstruction* LChunkBuilder::DoTrapAllocationMemento( |
| 2233 HTrapAllocationMemento* instr) { | 2265 HTrapAllocationMemento* instr) { |
| 2234 LOperand* object = UseRegister(instr->object()); | 2266 LOperand* object = UseRegister(instr->object()); |
| 2235 LOperand* temp = TempRegister(); | 2267 LOperand* temp = TempRegister(); |
| 2236 LTrapAllocationMemento* result = | 2268 LTrapAllocationMemento* result = |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2275 instr->field_representation().IsHeapObject()) { | 2307 instr->field_representation().IsHeapObject()) { |
| 2276 if (!instr->value()->type().IsHeapObject()) { | 2308 if (!instr->value()->type().IsHeapObject()) { |
| 2277 return AssignEnvironment(result); | 2309 return AssignEnvironment(result); |
| 2278 } | 2310 } |
| 2279 } | 2311 } |
| 2280 return result; | 2312 return result; |
| 2281 } | 2313 } |
| 2282 | 2314 |
| 2283 | 2315 |
| 2284 LInstruction* LChunkBuilder::DoStoreNamedGeneric(HStoreNamedGeneric* instr) { | 2316 LInstruction* LChunkBuilder::DoStoreNamedGeneric(HStoreNamedGeneric* instr) { |
| 2317 LOperand* context = UseFixed(instr->context(), cp); |
| 2285 LOperand* obj = UseFixed(instr->object(), a1); | 2318 LOperand* obj = UseFixed(instr->object(), a1); |
| 2286 LOperand* val = UseFixed(instr->value(), a0); | 2319 LOperand* val = UseFixed(instr->value(), a0); |
| 2287 | 2320 |
| 2288 LInstruction* result = new(zone()) LStoreNamedGeneric(obj, val); | 2321 LInstruction* result = new(zone()) LStoreNamedGeneric(context, obj, val); |
| 2289 return MarkAsCall(result, instr); | 2322 return MarkAsCall(result, instr); |
| 2290 } | 2323 } |
| 2291 | 2324 |
| 2292 | 2325 |
| 2293 LInstruction* LChunkBuilder::DoStringAdd(HStringAdd* instr) { | 2326 LInstruction* LChunkBuilder::DoStringAdd(HStringAdd* instr) { |
| 2327 LOperand* context = UseFixed(instr->context(), cp); |
| 2294 LOperand* left = UseRegisterAtStart(instr->left()); | 2328 LOperand* left = UseRegisterAtStart(instr->left()); |
| 2295 LOperand* right = UseRegisterAtStart(instr->right()); | 2329 LOperand* right = UseRegisterAtStart(instr->right()); |
| 2296 return MarkAsCall(DefineFixed(new(zone()) LStringAdd(left, right), v0), | 2330 return MarkAsCall( |
| 2297 instr); | 2331 DefineFixed(new(zone()) LStringAdd(context, left, right), v0), |
| 2332 instr); |
| 2298 } | 2333 } |
| 2299 | 2334 |
| 2300 | 2335 |
| 2301 LInstruction* LChunkBuilder::DoStringCharCodeAt(HStringCharCodeAt* instr) { | 2336 LInstruction* LChunkBuilder::DoStringCharCodeAt(HStringCharCodeAt* instr) { |
| 2302 LOperand* string = UseTempRegister(instr->string()); | 2337 LOperand* string = UseTempRegister(instr->string()); |
| 2303 LOperand* index = UseTempRegister(instr->index()); | 2338 LOperand* index = UseTempRegister(instr->index()); |
| 2304 LStringCharCodeAt* result = new(zone()) LStringCharCodeAt(string, index); | 2339 LOperand* context = UseAny(instr->context()); |
| 2340 LStringCharCodeAt* result = |
| 2341 new(zone()) LStringCharCodeAt(context, string, index); |
| 2305 return AssignEnvironment(AssignPointerMap(DefineAsRegister(result))); | 2342 return AssignEnvironment(AssignPointerMap(DefineAsRegister(result))); |
| 2306 } | 2343 } |
| 2307 | 2344 |
| 2308 | 2345 |
| 2309 LInstruction* LChunkBuilder::DoStringCharFromCode(HStringCharFromCode* instr) { | 2346 LInstruction* LChunkBuilder::DoStringCharFromCode(HStringCharFromCode* instr) { |
| 2310 LOperand* char_code = UseRegister(instr->value()); | 2347 LOperand* char_code = UseRegister(instr->value()); |
| 2311 LStringCharFromCode* result = new(zone()) LStringCharFromCode(char_code); | 2348 LOperand* context = UseAny(instr->context()); |
| 2349 LStringCharFromCode* result = |
| 2350 new(zone()) LStringCharFromCode(context, char_code); |
| 2312 return AssignPointerMap(DefineAsRegister(result)); | 2351 return AssignPointerMap(DefineAsRegister(result)); |
| 2313 } | 2352 } |
| 2314 | 2353 |
| 2315 | 2354 |
| 2316 LInstruction* LChunkBuilder::DoAllocate(HAllocate* instr) { | 2355 LInstruction* LChunkBuilder::DoAllocate(HAllocate* instr) { |
| 2317 info()->MarkAsDeferredCalling(); | 2356 info()->MarkAsDeferredCalling(); |
| 2357 LOperand* context = UseAny(instr->context()); |
| 2318 LOperand* size = instr->size()->IsConstant() | 2358 LOperand* size = instr->size()->IsConstant() |
| 2319 ? UseConstant(instr->size()) | 2359 ? UseConstant(instr->size()) |
| 2320 : UseTempRegister(instr->size()); | 2360 : UseTempRegister(instr->size()); |
| 2321 LOperand* temp1 = TempRegister(); | 2361 LOperand* temp1 = TempRegister(); |
| 2322 LOperand* temp2 = TempRegister(); | 2362 LOperand* temp2 = TempRegister(); |
| 2323 LAllocate* result = new(zone()) LAllocate(size, temp1, temp2); | 2363 LAllocate* result = new(zone()) LAllocate(context, size, temp1, temp2); |
| 2324 return AssignPointerMap(DefineAsRegister(result)); | 2364 return AssignPointerMap(DefineAsRegister(result)); |
| 2325 } | 2365 } |
| 2326 | 2366 |
| 2327 | 2367 |
| 2328 LInstruction* LChunkBuilder::DoRegExpLiteral(HRegExpLiteral* instr) { | 2368 LInstruction* LChunkBuilder::DoRegExpLiteral(HRegExpLiteral* instr) { |
| 2329 return MarkAsCall(DefineFixed(new(zone()) LRegExpLiteral, v0), instr); | 2369 LOperand* context = UseFixed(instr->context(), cp); |
| 2370 return MarkAsCall( |
| 2371 DefineFixed(new(zone()) LRegExpLiteral(context), v0), instr); |
| 2330 } | 2372 } |
| 2331 | 2373 |
| 2332 | 2374 |
| 2333 LInstruction* LChunkBuilder::DoFunctionLiteral(HFunctionLiteral* instr) { | 2375 LInstruction* LChunkBuilder::DoFunctionLiteral(HFunctionLiteral* instr) { |
| 2334 return MarkAsCall(DefineFixed(new(zone()) LFunctionLiteral, v0), instr); | 2376 LOperand* context = UseFixed(instr->context(), cp); |
| 2377 return MarkAsCall( |
| 2378 DefineFixed(new(zone()) LFunctionLiteral(context), v0), instr); |
| 2335 } | 2379 } |
| 2336 | 2380 |
| 2337 | 2381 |
| 2338 LInstruction* LChunkBuilder::DoOsrEntry(HOsrEntry* instr) { | 2382 LInstruction* LChunkBuilder::DoOsrEntry(HOsrEntry* instr) { |
| 2339 ASSERT(argument_count_ == 0); | 2383 ASSERT(argument_count_ == 0); |
| 2340 allocator_->MarkAsOsrEntry(); | 2384 allocator_->MarkAsOsrEntry(); |
| 2341 current_block_->last_environment()->set_ast_id(instr->ast_id()); | 2385 current_block_->last_environment()->set_ast_id(instr->ast_id()); |
| 2342 return AssignEnvironment(new(zone()) LOsrEntry); | 2386 return AssignEnvironment(new(zone()) LOsrEntry); |
| 2343 } | 2387 } |
| 2344 | 2388 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 2371 if (spill_index > LUnallocated::kMaxFixedSlotIndex) { | 2415 if (spill_index > LUnallocated::kMaxFixedSlotIndex) { |
| 2372 Abort(kTooManySpillSlotsNeededForOSR); | 2416 Abort(kTooManySpillSlotsNeededForOSR); |
| 2373 spill_index = 0; | 2417 spill_index = 0; |
| 2374 } | 2418 } |
| 2375 } | 2419 } |
| 2376 return DefineAsSpilled(new(zone()) LUnknownOSRValue, spill_index); | 2420 return DefineAsSpilled(new(zone()) LUnknownOSRValue, spill_index); |
| 2377 } | 2421 } |
| 2378 | 2422 |
| 2379 | 2423 |
| 2380 LInstruction* LChunkBuilder::DoCallStub(HCallStub* instr) { | 2424 LInstruction* LChunkBuilder::DoCallStub(HCallStub* instr) { |
| 2425 LOperand* context = UseFixed(instr->context(), cp); |
| 2381 argument_count_ -= instr->argument_count(); | 2426 argument_count_ -= instr->argument_count(); |
| 2382 return MarkAsCall(DefineFixed(new(zone()) LCallStub, v0), instr); | 2427 return MarkAsCall(DefineFixed(new(zone()) LCallStub(context), v0), instr); |
| 2383 } | 2428 } |
| 2384 | 2429 |
| 2385 | 2430 |
| 2386 LInstruction* LChunkBuilder::DoArgumentsObject(HArgumentsObject* instr) { | 2431 LInstruction* LChunkBuilder::DoArgumentsObject(HArgumentsObject* instr) { |
| 2387 // There are no real uses of the arguments object. | 2432 // There are no real uses of the arguments object. |
| 2388 // arguments.length and element access are supported directly on | 2433 // arguments.length and element access are supported directly on |
| 2389 // stack arguments, and any real arguments object use causes a bailout. | 2434 // stack arguments, and any real arguments object use causes a bailout. |
| 2390 // So this value is never used. | 2435 // So this value is never used. |
| 2391 return NULL; | 2436 return NULL; |
| 2392 } | 2437 } |
| (...skipping 24 matching lines...) Expand all Loading... |
| 2417 | 2462 |
| 2418 | 2463 |
| 2419 LInstruction* LChunkBuilder::DoToFastProperties(HToFastProperties* instr) { | 2464 LInstruction* LChunkBuilder::DoToFastProperties(HToFastProperties* instr) { |
| 2420 LOperand* object = UseFixed(instr->value(), a0); | 2465 LOperand* object = UseFixed(instr->value(), a0); |
| 2421 LToFastProperties* result = new(zone()) LToFastProperties(object); | 2466 LToFastProperties* result = new(zone()) LToFastProperties(object); |
| 2422 return MarkAsCall(DefineFixed(result, v0), instr); | 2467 return MarkAsCall(DefineFixed(result, v0), instr); |
| 2423 } | 2468 } |
| 2424 | 2469 |
| 2425 | 2470 |
| 2426 LInstruction* LChunkBuilder::DoTypeof(HTypeof* instr) { | 2471 LInstruction* LChunkBuilder::DoTypeof(HTypeof* instr) { |
| 2427 LTypeof* result = new(zone()) LTypeof(UseFixed(instr->value(), a0)); | 2472 LOperand* context = UseFixed(instr->context(), cp); |
| 2473 LTypeof* result = new(zone()) LTypeof(context, UseFixed(instr->value(), a0)); |
| 2428 return MarkAsCall(DefineFixed(result, v0), instr); | 2474 return MarkAsCall(DefineFixed(result, v0), instr); |
| 2429 } | 2475 } |
| 2430 | 2476 |
| 2431 | 2477 |
| 2432 LInstruction* LChunkBuilder::DoTypeofIsAndBranch(HTypeofIsAndBranch* instr) { | 2478 LInstruction* LChunkBuilder::DoTypeofIsAndBranch(HTypeofIsAndBranch* instr) { |
| 2433 return new(zone()) LTypeofIsAndBranch(UseTempRegister(instr->value())); | 2479 return new(zone()) LTypeofIsAndBranch(UseTempRegister(instr->value())); |
| 2434 } | 2480 } |
| 2435 | 2481 |
| 2436 | 2482 |
| 2437 LInstruction* LChunkBuilder::DoIsConstructCallAndBranch( | 2483 LInstruction* LChunkBuilder::DoIsConstructCallAndBranch( |
| (...skipping 18 matching lines...) Expand all Loading... |
| 2456 pending_deoptimization_ast_id_ = BailoutId::None(); | 2502 pending_deoptimization_ast_id_ = BailoutId::None(); |
| 2457 return result; | 2503 return result; |
| 2458 } | 2504 } |
| 2459 | 2505 |
| 2460 return NULL; | 2506 return NULL; |
| 2461 } | 2507 } |
| 2462 | 2508 |
| 2463 | 2509 |
| 2464 LInstruction* LChunkBuilder::DoStackCheck(HStackCheck* instr) { | 2510 LInstruction* LChunkBuilder::DoStackCheck(HStackCheck* instr) { |
| 2465 if (instr->is_function_entry()) { | 2511 if (instr->is_function_entry()) { |
| 2466 return MarkAsCall(new(zone()) LStackCheck, instr); | 2512 LOperand* context = UseFixed(instr->context(), cp); |
| 2513 return MarkAsCall(new(zone()) LStackCheck(context), instr); |
| 2467 } else { | 2514 } else { |
| 2468 ASSERT(instr->is_backwards_branch()); | 2515 ASSERT(instr->is_backwards_branch()); |
| 2469 return AssignEnvironment(AssignPointerMap(new(zone()) LStackCheck)); | 2516 LOperand* context = UseAny(instr->context()); |
| 2517 return AssignEnvironment( |
| 2518 AssignPointerMap(new(zone()) LStackCheck(context))); |
| 2470 } | 2519 } |
| 2471 } | 2520 } |
| 2472 | 2521 |
| 2473 | 2522 |
| 2474 LInstruction* LChunkBuilder::DoEnterInlined(HEnterInlined* instr) { | 2523 LInstruction* LChunkBuilder::DoEnterInlined(HEnterInlined* instr) { |
| 2475 HEnvironment* outer = current_block_->last_environment(); | 2524 HEnvironment* outer = current_block_->last_environment(); |
| 2476 HConstant* undefined = graph()->GetConstantUndefined(); | 2525 HConstant* undefined = graph()->GetConstantUndefined(); |
| 2477 HEnvironment* inner = outer->CopyForInlining(instr->closure(), | 2526 HEnvironment* inner = outer->CopyForInlining(instr->closure(), |
| 2478 instr->arguments_count(), | 2527 instr->arguments_count(), |
| 2479 instr->function(), | 2528 instr->function(), |
| (...skipping 24 matching lines...) Expand all Loading... |
| 2504 | 2553 |
| 2505 HEnvironment* outer = current_block_->last_environment()-> | 2554 HEnvironment* outer = current_block_->last_environment()-> |
| 2506 DiscardInlined(false); | 2555 DiscardInlined(false); |
| 2507 current_block_->UpdateEnvironment(outer); | 2556 current_block_->UpdateEnvironment(outer); |
| 2508 | 2557 |
| 2509 return pop; | 2558 return pop; |
| 2510 } | 2559 } |
| 2511 | 2560 |
| 2512 | 2561 |
| 2513 LInstruction* LChunkBuilder::DoForInPrepareMap(HForInPrepareMap* instr) { | 2562 LInstruction* LChunkBuilder::DoForInPrepareMap(HForInPrepareMap* instr) { |
| 2563 LOperand* context = UseFixed(instr->context(), cp); |
| 2514 LOperand* object = UseFixed(instr->enumerable(), a0); | 2564 LOperand* object = UseFixed(instr->enumerable(), a0); |
| 2515 LForInPrepareMap* result = new(zone()) LForInPrepareMap(object); | 2565 LForInPrepareMap* result = new(zone()) LForInPrepareMap(context, object); |
| 2516 return MarkAsCall(DefineFixed(result, v0), instr, CAN_DEOPTIMIZE_EAGERLY); | 2566 return MarkAsCall(DefineFixed(result, v0), instr, CAN_DEOPTIMIZE_EAGERLY); |
| 2517 } | 2567 } |
| 2518 | 2568 |
| 2519 | 2569 |
| 2520 LInstruction* LChunkBuilder::DoForInCacheArray(HForInCacheArray* instr) { | 2570 LInstruction* LChunkBuilder::DoForInCacheArray(HForInCacheArray* instr) { |
| 2521 LOperand* map = UseRegister(instr->map()); | 2571 LOperand* map = UseRegister(instr->map()); |
| 2522 return AssignEnvironment(DefineAsRegister(new(zone()) LForInCacheArray(map))); | 2572 return AssignEnvironment(DefineAsRegister(new(zone()) LForInCacheArray(map))); |
| 2523 } | 2573 } |
| 2524 | 2574 |
| 2525 | 2575 |
| 2526 LInstruction* LChunkBuilder::DoCheckMapValue(HCheckMapValue* instr) { | 2576 LInstruction* LChunkBuilder::DoCheckMapValue(HCheckMapValue* instr) { |
| 2527 LOperand* value = UseRegisterAtStart(instr->value()); | 2577 LOperand* value = UseRegisterAtStart(instr->value()); |
| 2528 LOperand* map = UseRegisterAtStart(instr->map()); | 2578 LOperand* map = UseRegisterAtStart(instr->map()); |
| 2529 return AssignEnvironment(new(zone()) LCheckMapValue(value, map)); | 2579 return AssignEnvironment(new(zone()) LCheckMapValue(value, map)); |
| 2530 } | 2580 } |
| 2531 | 2581 |
| 2532 | 2582 |
| 2533 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { | 2583 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { |
| 2534 LOperand* object = UseRegister(instr->object()); | 2584 LOperand* object = UseRegister(instr->object()); |
| 2535 LOperand* index = UseRegister(instr->index()); | 2585 LOperand* index = UseRegister(instr->index()); |
| 2536 return DefineAsRegister(new(zone()) LLoadFieldByIndex(object, index)); | 2586 return DefineAsRegister(new(zone()) LLoadFieldByIndex(object, index)); |
| 2537 } | 2587 } |
| 2538 | 2588 |
| 2539 | 2589 |
| 2540 } } // namespace v8::internal | 2590 } } // namespace v8::internal |
| OLD | NEW |