| 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 864 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 875 for (int i = 1; i < current->OperandCount(); ++i) { | 875 for (int i = 1; i < current->OperandCount(); ++i) { |
| 876 LInstruction* dummy = | 876 LInstruction* dummy = |
| 877 new(zone()) LDummyUse(UseAny(current->OperandAt(i))); | 877 new(zone()) LDummyUse(UseAny(current->OperandAt(i))); |
| 878 dummy->set_hydrogen_value(current); | 878 dummy->set_hydrogen_value(current); |
| 879 chunk_->AddInstruction(dummy, current_block_); | 879 chunk_->AddInstruction(dummy, current_block_); |
| 880 } | 880 } |
| 881 } else { | 881 } else { |
| 882 instr = current->CompileToLithium(this); | 882 instr = current->CompileToLithium(this); |
| 883 } | 883 } |
| 884 | 884 |
| 885 argument_count_ += current->argument_delta(); |
| 886 ASSERT(argument_count_ >= 0); |
| 887 |
| 885 if (instr != NULL) { | 888 if (instr != NULL) { |
| 886 // Associate the hydrogen instruction first, since we may need it for | 889 // Associate the hydrogen instruction first, since we may need it for |
| 887 // the ClobbersRegisters() or ClobbersDoubleRegisters() calls below. | 890 // the ClobbersRegisters() or ClobbersDoubleRegisters() calls below. |
| 888 instr->set_hydrogen_value(current); | 891 instr->set_hydrogen_value(current); |
| 889 | 892 |
| 890 #if DEBUG | 893 #if DEBUG |
| 891 // Make sure that the lithium instruction has either no fixed register | 894 // Make sure that the lithium instruction has either no fixed register |
| 892 // constraints in temps or the result OR no uses that are only used at | 895 // constraints in temps or the result OR no uses that are only used at |
| 893 // start. If this invariant doesn't hold, the register allocator can decide | 896 // start. If this invariant doesn't hold, the register allocator can decide |
| 894 // to insert a split of a range immediately before the instruction due to an | 897 // to insert a split of a range immediately before the instruction due to an |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1100 LOperand* elements = UseFixed(instr->elements(), a3); | 1103 LOperand* elements = UseFixed(instr->elements(), a3); |
| 1101 LApplyArguments* result = new(zone()) LApplyArguments(function, | 1104 LApplyArguments* result = new(zone()) LApplyArguments(function, |
| 1102 receiver, | 1105 receiver, |
| 1103 length, | 1106 length, |
| 1104 elements); | 1107 elements); |
| 1105 return MarkAsCall(DefineFixed(result, v0), instr, CAN_DEOPTIMIZE_EAGERLY); | 1108 return MarkAsCall(DefineFixed(result, v0), instr, CAN_DEOPTIMIZE_EAGERLY); |
| 1106 } | 1109 } |
| 1107 | 1110 |
| 1108 | 1111 |
| 1109 LInstruction* LChunkBuilder::DoPushArgument(HPushArgument* instr) { | 1112 LInstruction* LChunkBuilder::DoPushArgument(HPushArgument* instr) { |
| 1110 ++argument_count_; | |
| 1111 LOperand* argument = Use(instr->argument()); | 1113 LOperand* argument = Use(instr->argument()); |
| 1112 return new(zone()) LPushArgument(argument); | 1114 return new(zone()) LPushArgument(argument); |
| 1113 } | 1115 } |
| 1114 | 1116 |
| 1115 | 1117 |
| 1116 LInstruction* LChunkBuilder::DoStoreCodeEntry( | 1118 LInstruction* LChunkBuilder::DoStoreCodeEntry( |
| 1117 HStoreCodeEntry* store_code_entry) { | 1119 HStoreCodeEntry* store_code_entry) { |
| 1118 LOperand* function = UseRegister(store_code_entry->function()); | 1120 LOperand* function = UseRegister(store_code_entry->function()); |
| 1119 LOperand* code_object = UseTempRegister(store_code_entry->code_object()); | 1121 LOperand* code_object = UseTempRegister(store_code_entry->code_object()); |
| 1120 return new(zone()) LStoreCodeEntry(function, code_object); | 1122 return new(zone()) LStoreCodeEntry(function, code_object); |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1167 | 1169 |
| 1168 | 1170 |
| 1169 LInstruction* LChunkBuilder::DoGlobalReceiver(HGlobalReceiver* instr) { | 1171 LInstruction* LChunkBuilder::DoGlobalReceiver(HGlobalReceiver* instr) { |
| 1170 LOperand* global_object = UseRegisterAtStart(instr->value()); | 1172 LOperand* global_object = UseRegisterAtStart(instr->value()); |
| 1171 return DefineAsRegister(new(zone()) LGlobalReceiver(global_object)); | 1173 return DefineAsRegister(new(zone()) LGlobalReceiver(global_object)); |
| 1172 } | 1174 } |
| 1173 | 1175 |
| 1174 | 1176 |
| 1175 LInstruction* LChunkBuilder::DoCallConstantFunction( | 1177 LInstruction* LChunkBuilder::DoCallConstantFunction( |
| 1176 HCallConstantFunction* instr) { | 1178 HCallConstantFunction* instr) { |
| 1177 argument_count_ -= instr->argument_count(); | |
| 1178 return MarkAsCall(DefineFixed(new(zone()) LCallConstantFunction, v0), instr); | 1179 return MarkAsCall(DefineFixed(new(zone()) LCallConstantFunction, v0), instr); |
| 1179 } | 1180 } |
| 1180 | 1181 |
| 1181 | 1182 |
| 1182 LInstruction* LChunkBuilder::DoInvokeFunction(HInvokeFunction* instr) { | 1183 LInstruction* LChunkBuilder::DoInvokeFunction(HInvokeFunction* instr) { |
| 1183 LOperand* context = UseFixed(instr->context(), cp); | 1184 LOperand* context = UseFixed(instr->context(), cp); |
| 1184 LOperand* function = UseFixed(instr->function(), a1); | 1185 LOperand* function = UseFixed(instr->function(), a1); |
| 1185 argument_count_ -= instr->argument_count(); | |
| 1186 LInvokeFunction* result = new(zone()) LInvokeFunction(context, function); | 1186 LInvokeFunction* result = new(zone()) LInvokeFunction(context, function); |
| 1187 return MarkAsCall(DefineFixed(result, v0), instr, CANNOT_DEOPTIMIZE_EAGERLY); | 1187 return MarkAsCall(DefineFixed(result, v0), instr, CANNOT_DEOPTIMIZE_EAGERLY); |
| 1188 } | 1188 } |
| 1189 | 1189 |
| 1190 | 1190 |
| 1191 LInstruction* LChunkBuilder::DoUnaryMathOperation(HUnaryMathOperation* instr) { | 1191 LInstruction* LChunkBuilder::DoUnaryMathOperation(HUnaryMathOperation* instr) { |
| 1192 switch (instr->op()) { | 1192 switch (instr->op()) { |
| 1193 case kMathFloor: return DoMathFloor(instr); | 1193 case kMathFloor: return DoMathFloor(instr); |
| 1194 case kMathRound: return DoMathRound(instr); | 1194 case kMathRound: return DoMathRound(instr); |
| 1195 case kMathAbs: return DoMathAbs(instr); | 1195 case kMathAbs: return DoMathAbs(instr); |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1286 LOperand* input = UseRegister(instr->value()); | 1286 LOperand* input = UseRegister(instr->value()); |
| 1287 LOperand* temp = FixedTemp(f6); | 1287 LOperand* temp = FixedTemp(f6); |
| 1288 LMathRound* result = new(zone()) LMathRound(input, temp); | 1288 LMathRound* result = new(zone()) LMathRound(input, temp); |
| 1289 return AssignEnvironment(DefineAsRegister(result)); | 1289 return AssignEnvironment(DefineAsRegister(result)); |
| 1290 } | 1290 } |
| 1291 | 1291 |
| 1292 | 1292 |
| 1293 LInstruction* LChunkBuilder::DoCallKeyed(HCallKeyed* instr) { | 1293 LInstruction* LChunkBuilder::DoCallKeyed(HCallKeyed* instr) { |
| 1294 ASSERT(instr->key()->representation().IsTagged()); | 1294 ASSERT(instr->key()->representation().IsTagged()); |
| 1295 LOperand* context = UseFixed(instr->context(), cp); | 1295 LOperand* context = UseFixed(instr->context(), cp); |
| 1296 argument_count_ -= instr->argument_count(); | |
| 1297 LOperand* key = UseFixed(instr->key(), a2); | 1296 LOperand* key = UseFixed(instr->key(), a2); |
| 1298 return MarkAsCall( | 1297 return MarkAsCall( |
| 1299 DefineFixed(new(zone()) LCallKeyed(context, key), v0), instr); | 1298 DefineFixed(new(zone()) LCallKeyed(context, key), v0), instr); |
| 1300 } | 1299 } |
| 1301 | 1300 |
| 1302 | 1301 |
| 1303 LInstruction* LChunkBuilder::DoCallNamed(HCallNamed* instr) { | 1302 LInstruction* LChunkBuilder::DoCallNamed(HCallNamed* instr) { |
| 1304 LOperand* context = UseFixed(instr->context(), cp); | 1303 LOperand* context = UseFixed(instr->context(), cp); |
| 1305 argument_count_ -= instr->argument_count(); | |
| 1306 return MarkAsCall(DefineFixed(new(zone()) LCallNamed(context), v0), instr); | 1304 return MarkAsCall(DefineFixed(new(zone()) LCallNamed(context), v0), instr); |
| 1307 } | 1305 } |
| 1308 | 1306 |
| 1309 | 1307 |
| 1310 LInstruction* LChunkBuilder::DoCallGlobal(HCallGlobal* instr) { | 1308 LInstruction* LChunkBuilder::DoCallGlobal(HCallGlobal* instr) { |
| 1311 LOperand* context = UseFixed(instr->context(), cp); | 1309 LOperand* context = UseFixed(instr->context(), cp); |
| 1312 argument_count_ -= instr->argument_count(); | |
| 1313 return MarkAsCall(DefineFixed(new(zone()) LCallGlobal(context), v0), instr); | 1310 return MarkAsCall(DefineFixed(new(zone()) LCallGlobal(context), v0), instr); |
| 1314 } | 1311 } |
| 1315 | 1312 |
| 1316 | 1313 |
| 1317 LInstruction* LChunkBuilder::DoCallKnownGlobal(HCallKnownGlobal* instr) { | 1314 LInstruction* LChunkBuilder::DoCallKnownGlobal(HCallKnownGlobal* instr) { |
| 1318 argument_count_ -= instr->argument_count(); | |
| 1319 return MarkAsCall(DefineFixed(new(zone()) LCallKnownGlobal, v0), instr); | 1315 return MarkAsCall(DefineFixed(new(zone()) LCallKnownGlobal, v0), instr); |
| 1320 } | 1316 } |
| 1321 | 1317 |
| 1322 | 1318 |
| 1323 LInstruction* LChunkBuilder::DoCallNew(HCallNew* instr) { | 1319 LInstruction* LChunkBuilder::DoCallNew(HCallNew* instr) { |
| 1324 LOperand* context = UseFixed(instr->context(), cp); | 1320 LOperand* context = UseFixed(instr->context(), cp); |
| 1325 LOperand* constructor = UseFixed(instr->constructor(), a1); | 1321 LOperand* constructor = UseFixed(instr->constructor(), a1); |
| 1326 argument_count_ -= instr->argument_count(); | |
| 1327 LCallNew* result = new(zone()) LCallNew(context, constructor); | 1322 LCallNew* result = new(zone()) LCallNew(context, constructor); |
| 1328 return MarkAsCall(DefineFixed(result, v0), instr); | 1323 return MarkAsCall(DefineFixed(result, v0), instr); |
| 1329 } | 1324 } |
| 1330 | 1325 |
| 1331 | 1326 |
| 1332 LInstruction* LChunkBuilder::DoCallNewArray(HCallNewArray* instr) { | 1327 LInstruction* LChunkBuilder::DoCallNewArray(HCallNewArray* instr) { |
| 1333 LOperand* context = UseFixed(instr->context(), cp); | 1328 LOperand* context = UseFixed(instr->context(), cp); |
| 1334 LOperand* constructor = UseFixed(instr->constructor(), a1); | 1329 LOperand* constructor = UseFixed(instr->constructor(), a1); |
| 1335 argument_count_ -= instr->argument_count(); | |
| 1336 LCallNewArray* result = new(zone()) LCallNewArray(context, constructor); | 1330 LCallNewArray* result = new(zone()) LCallNewArray(context, constructor); |
| 1337 return MarkAsCall(DefineFixed(result, v0), instr); | 1331 return MarkAsCall(DefineFixed(result, v0), instr); |
| 1338 } | 1332 } |
| 1339 | 1333 |
| 1340 | 1334 |
| 1341 LInstruction* LChunkBuilder::DoCallFunction(HCallFunction* instr) { | 1335 LInstruction* LChunkBuilder::DoCallFunction(HCallFunction* instr) { |
| 1342 LOperand* context = UseFixed(instr->context(), cp); | 1336 LOperand* context = UseFixed(instr->context(), cp); |
| 1343 LOperand* function = UseFixed(instr->function(), a1); | 1337 LOperand* function = UseFixed(instr->function(), a1); |
| 1344 argument_count_ -= instr->argument_count(); | |
| 1345 return MarkAsCall( | 1338 return MarkAsCall( |
| 1346 DefineFixed(new(zone()) LCallFunction(context, function), v0), instr); | 1339 DefineFixed(new(zone()) LCallFunction(context, function), v0), instr); |
| 1347 } | 1340 } |
| 1348 | 1341 |
| 1349 | 1342 |
| 1350 LInstruction* LChunkBuilder::DoCallRuntime(HCallRuntime* instr) { | 1343 LInstruction* LChunkBuilder::DoCallRuntime(HCallRuntime* instr) { |
| 1351 argument_count_ -= instr->argument_count(); | |
| 1352 LOperand* context = UseFixed(instr->context(), cp); | 1344 LOperand* context = UseFixed(instr->context(), cp); |
| 1353 return MarkAsCall(DefineFixed(new(zone()) LCallRuntime(context), v0), instr); | 1345 return MarkAsCall(DefineFixed(new(zone()) LCallRuntime(context), v0), instr); |
| 1354 } | 1346 } |
| 1355 | 1347 |
| 1356 | 1348 |
| 1357 LInstruction* LChunkBuilder::DoRor(HRor* instr) { | 1349 LInstruction* LChunkBuilder::DoRor(HRor* instr) { |
| 1358 return DoShift(Token::ROR, instr); | 1350 return DoShift(Token::ROR, instr); |
| 1359 } | 1351 } |
| 1360 | 1352 |
| 1361 | 1353 |
| (...skipping 1070 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2432 Abort(kTooManySpillSlotsNeededForOSR); | 2424 Abort(kTooManySpillSlotsNeededForOSR); |
| 2433 spill_index = 0; | 2425 spill_index = 0; |
| 2434 } | 2426 } |
| 2435 } | 2427 } |
| 2436 return DefineAsSpilled(new(zone()) LUnknownOSRValue, spill_index); | 2428 return DefineAsSpilled(new(zone()) LUnknownOSRValue, spill_index); |
| 2437 } | 2429 } |
| 2438 | 2430 |
| 2439 | 2431 |
| 2440 LInstruction* LChunkBuilder::DoCallStub(HCallStub* instr) { | 2432 LInstruction* LChunkBuilder::DoCallStub(HCallStub* instr) { |
| 2441 LOperand* context = UseFixed(instr->context(), cp); | 2433 LOperand* context = UseFixed(instr->context(), cp); |
| 2442 argument_count_ -= instr->argument_count(); | |
| 2443 return MarkAsCall(DefineFixed(new(zone()) LCallStub(context), v0), instr); | 2434 return MarkAsCall(DefineFixed(new(zone()) LCallStub(context), v0), instr); |
| 2444 } | 2435 } |
| 2445 | 2436 |
| 2446 | 2437 |
| 2447 LInstruction* LChunkBuilder::DoArgumentsObject(HArgumentsObject* instr) { | 2438 LInstruction* LChunkBuilder::DoArgumentsObject(HArgumentsObject* instr) { |
| 2448 // There are no real uses of the arguments object. | 2439 // There are no real uses of the arguments object. |
| 2449 // arguments.length and element access are supported directly on | 2440 // arguments.length and element access are supported directly on |
| 2450 // stack arguments, and any real arguments object use causes a bailout. | 2441 // stack arguments, and any real arguments object use causes a bailout. |
| 2451 // So this value is never used. | 2442 // So this value is never used. |
| 2452 return NULL; | 2443 return NULL; |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2557 | 2548 |
| 2558 | 2549 |
| 2559 LInstruction* LChunkBuilder::DoLeaveInlined(HLeaveInlined* instr) { | 2550 LInstruction* LChunkBuilder::DoLeaveInlined(HLeaveInlined* instr) { |
| 2560 LInstruction* pop = NULL; | 2551 LInstruction* pop = NULL; |
| 2561 | 2552 |
| 2562 HEnvironment* env = current_block_->last_environment(); | 2553 HEnvironment* env = current_block_->last_environment(); |
| 2563 | 2554 |
| 2564 if (env->entry()->arguments_pushed()) { | 2555 if (env->entry()->arguments_pushed()) { |
| 2565 int argument_count = env->arguments_environment()->parameter_count(); | 2556 int argument_count = env->arguments_environment()->parameter_count(); |
| 2566 pop = new(zone()) LDrop(argument_count); | 2557 pop = new(zone()) LDrop(argument_count); |
| 2567 argument_count_ -= argument_count; | 2558 ASSERT(instr->argument_delta() == -argument_count); |
| 2568 } | 2559 } |
| 2569 | 2560 |
| 2570 HEnvironment* outer = current_block_->last_environment()-> | 2561 HEnvironment* outer = current_block_->last_environment()-> |
| 2571 DiscardInlined(false); | 2562 DiscardInlined(false); |
| 2572 current_block_->UpdateEnvironment(outer); | 2563 current_block_->UpdateEnvironment(outer); |
| 2573 | 2564 |
| 2574 return pop; | 2565 return pop; |
| 2575 } | 2566 } |
| 2576 | 2567 |
| 2577 | 2568 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 2597 | 2588 |
| 2598 | 2589 |
| 2599 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { | 2590 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { |
| 2600 LOperand* object = UseRegister(instr->object()); | 2591 LOperand* object = UseRegister(instr->object()); |
| 2601 LOperand* index = UseRegister(instr->index()); | 2592 LOperand* index = UseRegister(instr->index()); |
| 2602 return DefineAsRegister(new(zone()) LLoadFieldByIndex(object, index)); | 2593 return DefineAsRegister(new(zone()) LLoadFieldByIndex(object, index)); |
| 2603 } | 2594 } |
| 2604 | 2595 |
| 2605 | 2596 |
| 2606 } } // namespace v8::internal | 2597 } } // namespace v8::internal |
| OLD | NEW |