| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 index()->PrintTo(stream); | 82 index()->PrintTo(stream); |
| 83 } | 83 } |
| 84 | 84 |
| 85 | 85 |
| 86 void LBranch::PrintDataTo(StringStream* stream) { | 86 void LBranch::PrintDataTo(StringStream* stream) { |
| 87 stream->Add("B%d | B%d on ", true_block_id(), false_block_id()); | 87 stream->Add("B%d | B%d on ", true_block_id(), false_block_id()); |
| 88 value()->PrintTo(stream); | 88 value()->PrintTo(stream); |
| 89 } | 89 } |
| 90 | 90 |
| 91 | 91 |
| 92 void LCallConstantFunction::PrintDataTo(StringStream* stream) { | 92 void LCallJSFunction::PrintDataTo(StringStream* stream) { |
| 93 stream->Add("= "); |
| 94 function()->PrintTo(stream); |
| 93 stream->Add("#%d / ", arity()); | 95 stream->Add("#%d / ", arity()); |
| 94 } | 96 } |
| 95 | 97 |
| 96 | 98 |
| 97 void LCallNamed::PrintDataTo(StringStream* stream) { | 99 void LCallWithDescriptor::PrintDataTo(StringStream* stream) { |
| 98 SmartArrayPointer<char> name_string = name()->ToCString(); | 100 for (int i = 0; i < InputCount(); i++) { |
| 99 stream->Add("%s #%d / ", name_string.get(), arity()); | 101 InputAt(i)->PrintTo(stream); |
| 100 } | 102 stream->Add(" "); |
| 101 | 103 } |
| 102 | |
| 103 void LCallKeyed::PrintDataTo(StringStream* stream) { | |
| 104 stream->Add("[x2] #%d / ", arity()); | |
| 105 } | |
| 106 | |
| 107 | |
| 108 void LCallKnownGlobal::PrintDataTo(StringStream* stream) { | |
| 109 stream->Add("#%d / ", arity()); | 104 stream->Add("#%d / ", arity()); |
| 110 } | 105 } |
| 111 | 106 |
| 112 | 107 |
| 113 void LCallGlobal::PrintDataTo(StringStream* stream) { | |
| 114 SmartArrayPointer<char> name_string = name()->ToCString(); | |
| 115 stream->Add("%s #%d / ", name_string.get(), arity()); | |
| 116 } | |
| 117 | |
| 118 | |
| 119 void LCallNew::PrintDataTo(StringStream* stream) { | 108 void LCallNew::PrintDataTo(StringStream* stream) { |
| 120 stream->Add("= "); | 109 stream->Add("= "); |
| 121 constructor()->PrintTo(stream); | 110 constructor()->PrintTo(stream); |
| 122 stream->Add(" #%d / ", arity()); | 111 stream->Add(" #%d / ", arity()); |
| 123 } | 112 } |
| 124 | 113 |
| 125 | 114 |
| 126 void LCallNewArray::PrintDataTo(StringStream* stream) { | 115 void LCallNewArray::PrintDataTo(StringStream* stream) { |
| 127 stream->Add("= "); | 116 stream->Add("= "); |
| 128 constructor()->PrintTo(stream); | 117 constructor()->PrintTo(stream); |
| (...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 459 } | 448 } |
| 460 | 449 |
| 461 | 450 |
| 462 LOperand* LChunkBuilder::UseAny(HValue* value) { | 451 LOperand* LChunkBuilder::UseAny(HValue* value) { |
| 463 return value->IsConstant() | 452 return value->IsConstant() |
| 464 ? UseConstant(value) | 453 ? UseConstant(value) |
| 465 : Use(value, new(zone()) LUnallocated(LUnallocated::ANY)); | 454 : Use(value, new(zone()) LUnallocated(LUnallocated::ANY)); |
| 466 } | 455 } |
| 467 | 456 |
| 468 | 457 |
| 469 template<int I, int T> | 458 LInstruction* LChunkBuilder::Define(LTemplateResultInstruction<1>* instr, |
| 470 LInstruction* LChunkBuilder::Define(LTemplateInstruction<1, I, T>* instr, | |
| 471 LUnallocated* result) { | 459 LUnallocated* result) { |
| 472 result->set_virtual_register(current_instruction_->id()); | 460 result->set_virtual_register(current_instruction_->id()); |
| 473 instr->set_result(result); | 461 instr->set_result(result); |
| 474 return instr; | 462 return instr; |
| 475 } | 463 } |
| 476 | 464 |
| 477 | 465 |
| 478 template<int I, int T> | |
| 479 LInstruction* LChunkBuilder::DefineAsRegister( | 466 LInstruction* LChunkBuilder::DefineAsRegister( |
| 480 LTemplateInstruction<1, I, T>* instr) { | 467 LTemplateResultInstruction<1>* instr) { |
| 481 return Define(instr, | 468 return Define(instr, |
| 482 new(zone()) LUnallocated(LUnallocated::MUST_HAVE_REGISTER)); | 469 new(zone()) LUnallocated(LUnallocated::MUST_HAVE_REGISTER)); |
| 483 } | 470 } |
| 484 | 471 |
| 485 | 472 |
| 486 template<int I, int T> | |
| 487 LInstruction* LChunkBuilder::DefineAsSpilled( | 473 LInstruction* LChunkBuilder::DefineAsSpilled( |
| 488 LTemplateInstruction<1, I, T>* instr, int index) { | 474 LTemplateResultInstruction<1>* instr, int index) { |
| 489 return Define(instr, | 475 return Define(instr, |
| 490 new(zone()) LUnallocated(LUnallocated::FIXED_SLOT, index)); | 476 new(zone()) LUnallocated(LUnallocated::FIXED_SLOT, index)); |
| 491 } | 477 } |
| 492 | 478 |
| 493 | 479 |
| 494 template<int I, int T> | |
| 495 LInstruction* LChunkBuilder::DefineSameAsFirst( | 480 LInstruction* LChunkBuilder::DefineSameAsFirst( |
| 496 LTemplateInstruction<1, I, T>* instr) { | 481 LTemplateResultInstruction<1>* instr) { |
| 497 return Define(instr, | 482 return Define(instr, |
| 498 new(zone()) LUnallocated(LUnallocated::SAME_AS_FIRST_INPUT)); | 483 new(zone()) LUnallocated(LUnallocated::SAME_AS_FIRST_INPUT)); |
| 499 } | 484 } |
| 500 | 485 |
| 501 | 486 |
| 502 template<int I, int T> | |
| 503 LInstruction* LChunkBuilder::DefineFixed( | 487 LInstruction* LChunkBuilder::DefineFixed( |
| 504 LTemplateInstruction<1, I, T>* instr, Register reg) { | 488 LTemplateResultInstruction<1>* instr, Register reg) { |
| 505 return Define(instr, ToUnallocated(reg)); | 489 return Define(instr, ToUnallocated(reg)); |
| 506 } | 490 } |
| 507 | 491 |
| 508 | 492 |
| 509 template<int I, int T> | |
| 510 LInstruction* LChunkBuilder::DefineFixedDouble( | 493 LInstruction* LChunkBuilder::DefineFixedDouble( |
| 511 LTemplateInstruction<1, I, T>* instr, DoubleRegister reg) { | 494 LTemplateResultInstruction<1>* instr, DoubleRegister reg) { |
| 512 return Define(instr, ToUnallocated(reg)); | 495 return Define(instr, ToUnallocated(reg)); |
| 513 } | 496 } |
| 514 | 497 |
| 515 | 498 |
| 516 LInstruction* LChunkBuilder::MarkAsCall(LInstruction* instr, | 499 LInstruction* LChunkBuilder::MarkAsCall(LInstruction* instr, |
| 517 HInstruction* hinstr, | 500 HInstruction* hinstr, |
| 518 CanDeoptimize can_deoptimize) { | 501 CanDeoptimize can_deoptimize) { |
| 519 info()->MarkAsNonDeferredCalling(); | 502 info()->MarkAsNonDeferredCalling(); |
| 520 #ifdef DEBUG | 503 #ifdef DEBUG |
| 521 instr->VerifyCall(); | 504 instr->VerifyCall(); |
| (...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 994 ASSERT(needs_temps); | 977 ASSERT(needs_temps); |
| 995 return new(zone()) LBranch(UseRegister(value), temp1, temp2); | 978 return new(zone()) LBranch(UseRegister(value), temp1, temp2); |
| 996 } else { | 979 } else { |
| 997 return AssignEnvironment( | 980 return AssignEnvironment( |
| 998 new(zone()) LBranch(UseRegister(value), temp1, temp2)); | 981 new(zone()) LBranch(UseRegister(value), temp1, temp2)); |
| 999 } | 982 } |
| 1000 } | 983 } |
| 1001 } | 984 } |
| 1002 | 985 |
| 1003 | 986 |
| 1004 LInstruction* LChunkBuilder::DoCallConstantFunction( | 987 LInstruction* LChunkBuilder::DoCallJSFunction( |
| 1005 HCallConstantFunction* instr) { | 988 HCallJSFunction* instr) { |
| 1006 return MarkAsCall(DefineFixed(new(zone()) LCallConstantFunction, x0), instr); | 989 LOperand* function = UseFixed(instr->function(), x1); |
| 990 |
| 991 LCallJSFunction* result = new(zone()) LCallJSFunction(function); |
| 992 |
| 993 return MarkAsCall(DefineFixed(result, x0), instr); |
| 994 } |
| 995 |
| 996 |
| 997 LInstruction* LChunkBuilder::DoCallWithDescriptor( |
| 998 HCallWithDescriptor* instr) { |
| 999 const CallInterfaceDescriptor* descriptor = instr->descriptor(); |
| 1000 |
| 1001 LOperand* target = UseRegisterOrConstantAtStart(instr->target()); |
| 1002 ZoneList<LOperand*> ops(instr->OperandCount(), zone()); |
| 1003 ops.Add(target, zone()); |
| 1004 for (int i = 1; i < instr->OperandCount(); i++) { |
| 1005 LOperand* op = UseFixed(instr->OperandAt(i), |
| 1006 descriptor->GetParameterRegister(i - 1)); |
| 1007 ops.Add(op, zone()); |
| 1008 } |
| 1009 |
| 1010 LCallWithDescriptor* result = new(zone()) LCallWithDescriptor(descriptor, |
| 1011 ops, |
| 1012 zone()); |
| 1013 return MarkAsCall(DefineFixed(result, x0), instr); |
| 1007 } | 1014 } |
| 1008 | 1015 |
| 1009 | 1016 |
| 1010 LInstruction* LChunkBuilder::DoCallFunction(HCallFunction* instr) { | 1017 LInstruction* LChunkBuilder::DoCallFunction(HCallFunction* instr) { |
| 1011 LOperand* function = UseFixed(instr->function(), x1); | 1018 LOperand* function = UseFixed(instr->function(), x1); |
| 1012 LInstruction* result = DefineFixed(new(zone()) LCallFunction(function), x0); | 1019 LInstruction* result = DefineFixed(new(zone()) LCallFunction(function), x0); |
| 1013 if (instr->IsTailCall()) return result; | 1020 if (instr->IsTailCall()) return result; |
| 1014 return MarkAsCall(result, instr); | 1021 return MarkAsCall(result, instr); |
| 1015 } | 1022 } |
| 1016 | 1023 |
| 1017 | 1024 |
| 1018 LInstruction* LChunkBuilder::DoCallGlobal(HCallGlobal* instr) { | |
| 1019 return MarkAsCall(DefineFixed(new(zone()) LCallGlobal, x0), instr); | |
| 1020 } | |
| 1021 | |
| 1022 | |
| 1023 LInstruction* LChunkBuilder::DoCallKeyed(HCallKeyed* instr) { | |
| 1024 ASSERT(instr->key()->representation().IsTagged()); | |
| 1025 LOperand* key = UseFixed(instr->key(), x2); | |
| 1026 return MarkAsCall(DefineFixed(new(zone()) LCallKeyed(key), x0), instr); | |
| 1027 } | |
| 1028 | |
| 1029 | |
| 1030 LInstruction* LChunkBuilder::DoCallKnownGlobal(HCallKnownGlobal* instr) { | |
| 1031 return MarkAsCall(DefineFixed(new(zone()) LCallKnownGlobal, x0), instr); | |
| 1032 } | |
| 1033 | |
| 1034 | |
| 1035 LInstruction* LChunkBuilder::DoCallNamed(HCallNamed* instr) { | |
| 1036 return MarkAsCall(DefineFixed(new(zone()) LCallNamed, x0), instr); | |
| 1037 } | |
| 1038 | |
| 1039 | |
| 1040 LInstruction* LChunkBuilder::DoCallNew(HCallNew* instr) { | 1025 LInstruction* LChunkBuilder::DoCallNew(HCallNew* instr) { |
| 1041 // The call to CallConstructStub will expect the constructor to be in x1. | 1026 // The call to CallConstructStub will expect the constructor to be in x1. |
| 1042 LOperand* constructor = UseFixed(instr->constructor(), x1); | 1027 LOperand* constructor = UseFixed(instr->constructor(), x1); |
| 1043 LCallNew* result = new(zone()) LCallNew(constructor); | 1028 LCallNew* result = new(zone()) LCallNew(constructor); |
| 1044 return MarkAsCall(DefineFixed(result, x0), instr); | 1029 return MarkAsCall(DefineFixed(result, x0), instr); |
| 1045 } | 1030 } |
| 1046 | 1031 |
| 1047 | 1032 |
| 1048 LInstruction* LChunkBuilder::DoCallNewArray(HCallNewArray* instr) { | 1033 LInstruction* LChunkBuilder::DoCallNewArray(HCallNewArray* instr) { |
| 1049 // The call to ArrayConstructCode will expect the constructor to be in x1. | 1034 // The call to ArrayConstructCode will expect the constructor to be in x1. |
| (...skipping 1432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2482 | 2467 |
| 2483 LInstruction* LChunkBuilder::DoWrapReceiver(HWrapReceiver* instr) { | 2468 LInstruction* LChunkBuilder::DoWrapReceiver(HWrapReceiver* instr) { |
| 2484 LOperand* receiver = UseRegister(instr->receiver()); | 2469 LOperand* receiver = UseRegister(instr->receiver()); |
| 2485 LOperand* function = UseRegister(instr->function()); | 2470 LOperand* function = UseRegister(instr->function()); |
| 2486 LWrapReceiver* result = new(zone()) LWrapReceiver(receiver, function); | 2471 LWrapReceiver* result = new(zone()) LWrapReceiver(receiver, function); |
| 2487 return AssignEnvironment(DefineAsRegister(result)); | 2472 return AssignEnvironment(DefineAsRegister(result)); |
| 2488 } | 2473 } |
| 2489 | 2474 |
| 2490 | 2475 |
| 2491 } } // namespace v8::internal | 2476 } } // namespace v8::internal |
| OLD | NEW |