| 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 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 275 | 275 |
| 276 | 276 |
| 277 void LInnerAllocatedObject::PrintDataTo(StringStream* stream) { | 277 void LInnerAllocatedObject::PrintDataTo(StringStream* stream) { |
| 278 stream->Add(" = "); | 278 stream->Add(" = "); |
| 279 base_object()->PrintTo(stream); | 279 base_object()->PrintTo(stream); |
| 280 stream->Add(" + "); | 280 stream->Add(" + "); |
| 281 offset()->PrintTo(stream); | 281 offset()->PrintTo(stream); |
| 282 } | 282 } |
| 283 | 283 |
| 284 | 284 |
| 285 void LCallConstantFunction::PrintDataTo(StringStream* stream) { | 285 void LCallJSFunction::PrintDataTo(StringStream* stream) { |
| 286 stream->Add("= "); |
| 287 function()->PrintTo(stream); |
| 286 stream->Add("#%d / ", arity()); | 288 stream->Add("#%d / ", arity()); |
| 287 } | 289 } |
| 288 | 290 |
| 291 |
| 292 void LCallWithDescriptor::PrintDataTo(StringStream* stream) { |
| 293 for (int i = 0; i < InputCount(); i++) { |
| 294 InputAt(i)->PrintTo(stream); |
| 295 stream->Add(" "); |
| 296 } |
| 297 stream->Add("#%d / ", arity()); |
| 298 } |
| 299 |
| 289 | 300 |
| 290 void LLoadContextSlot::PrintDataTo(StringStream* stream) { | 301 void LLoadContextSlot::PrintDataTo(StringStream* stream) { |
| 291 context()->PrintTo(stream); | 302 context()->PrintTo(stream); |
| 292 stream->Add("[%d]", slot_index()); | 303 stream->Add("[%d]", slot_index()); |
| 293 } | 304 } |
| 294 | 305 |
| 295 | 306 |
| 296 void LStoreContextSlot::PrintDataTo(StringStream* stream) { | 307 void LStoreContextSlot::PrintDataTo(StringStream* stream) { |
| 297 context()->PrintTo(stream); | 308 context()->PrintTo(stream); |
| 298 stream->Add("[%d] <- ", slot_index()); | 309 stream->Add("[%d] <- ", slot_index()); |
| 299 value()->PrintTo(stream); | 310 value()->PrintTo(stream); |
| 300 } | 311 } |
| 301 | 312 |
| 302 | 313 |
| 303 void LInvokeFunction::PrintDataTo(StringStream* stream) { | 314 void LInvokeFunction::PrintDataTo(StringStream* stream) { |
| 304 stream->Add("= "); | 315 stream->Add("= "); |
| 305 function()->PrintTo(stream); | 316 function()->PrintTo(stream); |
| 306 stream->Add(" #%d / ", arity()); | 317 stream->Add(" #%d / ", arity()); |
| 307 } | 318 } |
| 308 | 319 |
| 309 | 320 |
| 310 void LCallKeyed::PrintDataTo(StringStream* stream) { | |
| 311 stream->Add("[a2] #%d / ", arity()); | |
| 312 } | |
| 313 | |
| 314 | |
| 315 void LCallNamed::PrintDataTo(StringStream* stream) { | |
| 316 SmartArrayPointer<char> name_string = name()->ToCString(); | |
| 317 stream->Add("%s #%d / ", name_string.get(), arity()); | |
| 318 } | |
| 319 | |
| 320 | |
| 321 void LCallGlobal::PrintDataTo(StringStream* stream) { | |
| 322 SmartArrayPointer<char> name_string = name()->ToCString(); | |
| 323 stream->Add("%s #%d / ", name_string.get(), arity()); | |
| 324 } | |
| 325 | |
| 326 | |
| 327 void LCallKnownGlobal::PrintDataTo(StringStream* stream) { | |
| 328 stream->Add("#%d / ", arity()); | |
| 329 } | |
| 330 | |
| 331 | |
| 332 void LCallNew::PrintDataTo(StringStream* stream) { | 321 void LCallNew::PrintDataTo(StringStream* stream) { |
| 333 stream->Add("= "); | 322 stream->Add("= "); |
| 334 constructor()->PrintTo(stream); | 323 constructor()->PrintTo(stream); |
| 335 stream->Add(" #%d / ", arity()); | 324 stream->Add(" #%d / ", arity()); |
| 336 } | 325 } |
| 337 | 326 |
| 338 | 327 |
| 339 void LCallNewArray::PrintDataTo(StringStream* stream) { | 328 void LCallNewArray::PrintDataTo(StringStream* stream) { |
| 340 stream->Add("= "); | 329 stream->Add("= "); |
| 341 constructor()->PrintTo(stream); | 330 constructor()->PrintTo(stream); |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 561 LOperand* LChunkBuilder::Use(HValue* value, LUnallocated* operand) { | 550 LOperand* LChunkBuilder::Use(HValue* value, LUnallocated* operand) { |
| 562 if (value->EmitAtUses()) { | 551 if (value->EmitAtUses()) { |
| 563 HInstruction* instr = HInstruction::cast(value); | 552 HInstruction* instr = HInstruction::cast(value); |
| 564 VisitInstruction(instr); | 553 VisitInstruction(instr); |
| 565 } | 554 } |
| 566 operand->set_virtual_register(value->id()); | 555 operand->set_virtual_register(value->id()); |
| 567 return operand; | 556 return operand; |
| 568 } | 557 } |
| 569 | 558 |
| 570 | 559 |
| 571 template<int I, int T> | 560 LInstruction* LChunkBuilder::Define(LTemplateResultInstruction<1>* instr, |
| 572 LInstruction* LChunkBuilder::Define(LTemplateInstruction<1, I, T>* instr, | |
| 573 LUnallocated* result) { | 561 LUnallocated* result) { |
| 574 result->set_virtual_register(current_instruction_->id()); | 562 result->set_virtual_register(current_instruction_->id()); |
| 575 instr->set_result(result); | 563 instr->set_result(result); |
| 576 return instr; | 564 return instr; |
| 577 } | 565 } |
| 578 | 566 |
| 579 | 567 |
| 580 template<int I, int T> | |
| 581 LInstruction* LChunkBuilder::DefineAsRegister( | 568 LInstruction* LChunkBuilder::DefineAsRegister( |
| 582 LTemplateInstruction<1, I, T>* instr) { | 569 LTemplateResultInstruction<1>* instr) { |
| 583 return Define(instr, | 570 return Define(instr, |
| 584 new(zone()) LUnallocated(LUnallocated::MUST_HAVE_REGISTER)); | 571 new(zone()) LUnallocated(LUnallocated::MUST_HAVE_REGISTER)); |
| 585 } | 572 } |
| 586 | 573 |
| 587 | 574 |
| 588 template<int I, int T> | |
| 589 LInstruction* LChunkBuilder::DefineAsSpilled( | 575 LInstruction* LChunkBuilder::DefineAsSpilled( |
| 590 LTemplateInstruction<1, I, T>* instr, int index) { | 576 LTemplateResultInstruction<1>* instr, int index) { |
| 591 return Define(instr, | 577 return Define(instr, |
| 592 new(zone()) LUnallocated(LUnallocated::FIXED_SLOT, index)); | 578 new(zone()) LUnallocated(LUnallocated::FIXED_SLOT, index)); |
| 593 } | 579 } |
| 594 | 580 |
| 595 | 581 |
| 596 template<int I, int T> | |
| 597 LInstruction* LChunkBuilder::DefineSameAsFirst( | 582 LInstruction* LChunkBuilder::DefineSameAsFirst( |
| 598 LTemplateInstruction<1, I, T>* instr) { | 583 LTemplateResultInstruction<1>* instr) { |
| 599 return Define(instr, | 584 return Define(instr, |
| 600 new(zone()) LUnallocated(LUnallocated::SAME_AS_FIRST_INPUT)); | 585 new(zone()) LUnallocated(LUnallocated::SAME_AS_FIRST_INPUT)); |
| 601 } | 586 } |
| 602 | 587 |
| 603 | 588 |
| 604 template<int I, int T> | |
| 605 LInstruction* LChunkBuilder::DefineFixed( | 589 LInstruction* LChunkBuilder::DefineFixed( |
| 606 LTemplateInstruction<1, I, T>* instr, Register reg) { | 590 LTemplateResultInstruction<1>* instr, Register reg) { |
| 607 return Define(instr, ToUnallocated(reg)); | 591 return Define(instr, ToUnallocated(reg)); |
| 608 } | 592 } |
| 609 | 593 |
| 610 | 594 |
| 611 template<int I, int T> | |
| 612 LInstruction* LChunkBuilder::DefineFixedDouble( | 595 LInstruction* LChunkBuilder::DefineFixedDouble( |
| 613 LTemplateInstruction<1, I, T>* instr, DoubleRegister reg) { | 596 LTemplateResultInstruction<1>* instr, DoubleRegister reg) { |
| 614 return Define(instr, ToUnallocated(reg)); | 597 return Define(instr, ToUnallocated(reg)); |
| 615 } | 598 } |
| 616 | 599 |
| 617 | 600 |
| 618 LInstruction* LChunkBuilder::AssignEnvironment(LInstruction* instr) { | 601 LInstruction* LChunkBuilder::AssignEnvironment(LInstruction* instr) { |
| 619 HEnvironment* hydrogen_env = current_block_->last_environment(); | 602 HEnvironment* hydrogen_env = current_block_->last_environment(); |
| 620 int argument_index_accumulator = 0; | 603 int argument_index_accumulator = 0; |
| 621 ZoneList<HValue*> objects_to_materialize(0, zone()); | 604 ZoneList<HValue*> objects_to_materialize(0, zone()); |
| 622 instr->set_environment(CreateEnvironment(hydrogen_env, | 605 instr->set_environment(CreateEnvironment(hydrogen_env, |
| 623 &argument_index_accumulator, | 606 &argument_index_accumulator, |
| (...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1079 return DefineAsRegister(new(zone()) LGlobalObject(context)); | 1062 return DefineAsRegister(new(zone()) LGlobalObject(context)); |
| 1080 } | 1063 } |
| 1081 | 1064 |
| 1082 | 1065 |
| 1083 LInstruction* LChunkBuilder::DoGlobalReceiver(HGlobalReceiver* instr) { | 1066 LInstruction* LChunkBuilder::DoGlobalReceiver(HGlobalReceiver* instr) { |
| 1084 LOperand* global_object = UseRegisterAtStart(instr->value()); | 1067 LOperand* global_object = UseRegisterAtStart(instr->value()); |
| 1085 return DefineAsRegister(new(zone()) LGlobalReceiver(global_object)); | 1068 return DefineAsRegister(new(zone()) LGlobalReceiver(global_object)); |
| 1086 } | 1069 } |
| 1087 | 1070 |
| 1088 | 1071 |
| 1089 LInstruction* LChunkBuilder::DoCallConstantFunction( | 1072 LInstruction* LChunkBuilder::DoCallJSFunction( |
| 1090 HCallConstantFunction* instr) { | 1073 HCallJSFunction* instr) { |
| 1091 return MarkAsCall(DefineFixed(new(zone()) LCallConstantFunction, v0), instr); | 1074 LOperand* function = UseFixed(instr->function(), a1); |
| 1075 |
| 1076 LCallJSFunction* result = new(zone()) LCallJSFunction(function); |
| 1077 |
| 1078 return MarkAsCall(DefineFixed(result, v0), instr); |
| 1092 } | 1079 } |
| 1093 | 1080 |
| 1094 | 1081 |
| 1082 LInstruction* LChunkBuilder::DoCallWithDescriptor( |
| 1083 HCallWithDescriptor* instr) { |
| 1084 const CallInterfaceDescriptor* descriptor = instr->descriptor(); |
| 1085 |
| 1086 LOperand* target = UseRegisterOrConstantAtStart(instr->target()); |
| 1087 ZoneList<LOperand*> ops(instr->OperandCount(), zone()); |
| 1088 ops.Add(target, zone()); |
| 1089 for (int i = 1; i < instr->OperandCount(); i++) { |
| 1090 LOperand* op = UseFixed(instr->OperandAt(i), |
| 1091 descriptor->GetParameterRegister(i - 1)); |
| 1092 ops.Add(op, zone()); |
| 1093 } |
| 1094 |
| 1095 LCallWithDescriptor* result = new(zone()) LCallWithDescriptor( |
| 1096 descriptor, ops, zone()); |
| 1097 return MarkAsCall(DefineFixed(result, v0), instr); |
| 1098 } |
| 1099 |
| 1100 |
| 1095 LInstruction* LChunkBuilder::DoInvokeFunction(HInvokeFunction* instr) { | 1101 LInstruction* LChunkBuilder::DoInvokeFunction(HInvokeFunction* instr) { |
| 1096 LOperand* context = UseFixed(instr->context(), cp); | 1102 LOperand* context = UseFixed(instr->context(), cp); |
| 1097 LOperand* function = UseFixed(instr->function(), a1); | 1103 LOperand* function = UseFixed(instr->function(), a1); |
| 1098 LInvokeFunction* result = new(zone()) LInvokeFunction(context, function); | 1104 LInvokeFunction* result = new(zone()) LInvokeFunction(context, function); |
| 1099 return MarkAsCall(DefineFixed(result, v0), instr, CANNOT_DEOPTIMIZE_EAGERLY); | 1105 return MarkAsCall(DefineFixed(result, v0), instr, CANNOT_DEOPTIMIZE_EAGERLY); |
| 1100 } | 1106 } |
| 1101 | 1107 |
| 1102 | 1108 |
| 1103 LInstruction* LChunkBuilder::DoUnaryMathOperation(HUnaryMathOperation* instr) { | 1109 LInstruction* LChunkBuilder::DoUnaryMathOperation(HUnaryMathOperation* instr) { |
| 1104 switch (instr->op()) { | 1110 switch (instr->op()) { |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1172 | 1178 |
| 1173 | 1179 |
| 1174 LInstruction* LChunkBuilder::DoMathRound(HUnaryMathOperation* instr) { | 1180 LInstruction* LChunkBuilder::DoMathRound(HUnaryMathOperation* instr) { |
| 1175 LOperand* input = UseRegister(instr->value()); | 1181 LOperand* input = UseRegister(instr->value()); |
| 1176 LOperand* temp = FixedTemp(f6); | 1182 LOperand* temp = FixedTemp(f6); |
| 1177 LMathRound* result = new(zone()) LMathRound(input, temp); | 1183 LMathRound* result = new(zone()) LMathRound(input, temp); |
| 1178 return AssignEnvironment(DefineAsRegister(result)); | 1184 return AssignEnvironment(DefineAsRegister(result)); |
| 1179 } | 1185 } |
| 1180 | 1186 |
| 1181 | 1187 |
| 1182 LInstruction* LChunkBuilder::DoCallKeyed(HCallKeyed* instr) { | |
| 1183 ASSERT(instr->key()->representation().IsTagged()); | |
| 1184 LOperand* context = UseFixed(instr->context(), cp); | |
| 1185 LOperand* key = UseFixed(instr->key(), a2); | |
| 1186 return MarkAsCall( | |
| 1187 DefineFixed(new(zone()) LCallKeyed(context, key), v0), instr); | |
| 1188 } | |
| 1189 | |
| 1190 | |
| 1191 LInstruction* LChunkBuilder::DoCallNamed(HCallNamed* instr) { | |
| 1192 LOperand* context = UseFixed(instr->context(), cp); | |
| 1193 return MarkAsCall(DefineFixed(new(zone()) LCallNamed(context), v0), instr); | |
| 1194 } | |
| 1195 | |
| 1196 | |
| 1197 LInstruction* LChunkBuilder::DoCallGlobal(HCallGlobal* instr) { | |
| 1198 LOperand* context = UseFixed(instr->context(), cp); | |
| 1199 return MarkAsCall(DefineFixed(new(zone()) LCallGlobal(context), v0), instr); | |
| 1200 } | |
| 1201 | |
| 1202 | |
| 1203 LInstruction* LChunkBuilder::DoCallKnownGlobal(HCallKnownGlobal* instr) { | |
| 1204 return MarkAsCall(DefineFixed(new(zone()) LCallKnownGlobal, v0), instr); | |
| 1205 } | |
| 1206 | |
| 1207 | |
| 1208 LInstruction* LChunkBuilder::DoCallNew(HCallNew* instr) { | 1188 LInstruction* LChunkBuilder::DoCallNew(HCallNew* instr) { |
| 1209 LOperand* context = UseFixed(instr->context(), cp); | 1189 LOperand* context = UseFixed(instr->context(), cp); |
| 1210 LOperand* constructor = UseFixed(instr->constructor(), a1); | 1190 LOperand* constructor = UseFixed(instr->constructor(), a1); |
| 1211 LCallNew* result = new(zone()) LCallNew(context, constructor); | 1191 LCallNew* result = new(zone()) LCallNew(context, constructor); |
| 1212 return MarkAsCall(DefineFixed(result, v0), instr); | 1192 return MarkAsCall(DefineFixed(result, v0), instr); |
| 1213 } | 1193 } |
| 1214 | 1194 |
| 1215 | 1195 |
| 1216 LInstruction* LChunkBuilder::DoCallNewArray(HCallNewArray* instr) { | 1196 LInstruction* LChunkBuilder::DoCallNewArray(HCallNewArray* instr) { |
| 1217 LOperand* context = UseFixed(instr->context(), cp); | 1197 LOperand* context = UseFixed(instr->context(), cp); |
| (...skipping 1212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2430 } | 2410 } |
| 2431 | 2411 |
| 2432 | 2412 |
| 2433 LInstruction* LChunkBuilder::DoEnterInlined(HEnterInlined* instr) { | 2413 LInstruction* LChunkBuilder::DoEnterInlined(HEnterInlined* instr) { |
| 2434 HEnvironment* outer = current_block_->last_environment(); | 2414 HEnvironment* outer = current_block_->last_environment(); |
| 2435 HConstant* undefined = graph()->GetConstantUndefined(); | 2415 HConstant* undefined = graph()->GetConstantUndefined(); |
| 2436 HEnvironment* inner = outer->CopyForInlining(instr->closure(), | 2416 HEnvironment* inner = outer->CopyForInlining(instr->closure(), |
| 2437 instr->arguments_count(), | 2417 instr->arguments_count(), |
| 2438 instr->function(), | 2418 instr->function(), |
| 2439 undefined, | 2419 undefined, |
| 2440 instr->inlining_kind(), | 2420 instr->inlining_kind()); |
| 2441 instr->undefined_receiver()); | |
| 2442 // Only replay binding of arguments object if it wasn't removed from graph. | 2421 // Only replay binding of arguments object if it wasn't removed from graph. |
| 2443 if (instr->arguments_var() != NULL && instr->arguments_object()->IsLinked()) { | 2422 if (instr->arguments_var() != NULL && instr->arguments_object()->IsLinked()) { |
| 2444 inner->Bind(instr->arguments_var(), instr->arguments_object()); | 2423 inner->Bind(instr->arguments_var(), instr->arguments_object()); |
| 2445 } | 2424 } |
| 2446 inner->set_entry(instr); | 2425 inner->set_entry(instr); |
| 2447 current_block_->UpdateEnvironment(inner); | 2426 current_block_->UpdateEnvironment(inner); |
| 2448 chunk_->AddInlinedClosure(instr->closure()); | 2427 chunk_->AddInlinedClosure(instr->closure()); |
| 2449 return NULL; | 2428 return NULL; |
| 2450 } | 2429 } |
| 2451 | 2430 |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2491 | 2470 |
| 2492 | 2471 |
| 2493 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { | 2472 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { |
| 2494 LOperand* object = UseRegister(instr->object()); | 2473 LOperand* object = UseRegister(instr->object()); |
| 2495 LOperand* index = UseRegister(instr->index()); | 2474 LOperand* index = UseRegister(instr->index()); |
| 2496 return DefineAsRegister(new(zone()) LLoadFieldByIndex(object, index)); | 2475 return DefineAsRegister(new(zone()) LLoadFieldByIndex(object, index)); |
| 2497 } | 2476 } |
| 2498 | 2477 |
| 2499 | 2478 |
| 2500 } } // namespace v8::internal | 2479 } } // namespace v8::internal |
| OLD | NEW |