| 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 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 273 | 273 |
| 274 | 274 |
| 275 void LInnerAllocatedObject::PrintDataTo(StringStream* stream) { | 275 void LInnerAllocatedObject::PrintDataTo(StringStream* stream) { |
| 276 stream->Add(" = "); | 276 stream->Add(" = "); |
| 277 base_object()->PrintTo(stream); | 277 base_object()->PrintTo(stream); |
| 278 stream->Add(" + "); | 278 stream->Add(" + "); |
| 279 offset()->PrintTo(stream); | 279 offset()->PrintTo(stream); |
| 280 } | 280 } |
| 281 | 281 |
| 282 | 282 |
| 283 void LCallConstantFunction::PrintDataTo(StringStream* stream) { | 283 void LCallJSFunction::PrintDataTo(StringStream* stream) { |
| 284 stream->Add("= "); |
| 285 function()->PrintTo(stream); |
| 284 stream->Add("#%d / ", arity()); | 286 stream->Add("#%d / ", arity()); |
| 285 } | 287 } |
| 286 | 288 |
| 289 |
| 290 void LCallWithDescriptor::PrintDataTo(StringStream* stream) { |
| 291 for (int i = 0; i < InputCount(); i++) { |
| 292 InputAt(i)->PrintTo(stream); |
| 293 stream->Add(" "); |
| 294 } |
| 295 stream->Add("#%d / ", arity()); |
| 296 } |
| 297 |
| 287 | 298 |
| 288 void LLoadContextSlot::PrintDataTo(StringStream* stream) { | 299 void LLoadContextSlot::PrintDataTo(StringStream* stream) { |
| 289 context()->PrintTo(stream); | 300 context()->PrintTo(stream); |
| 290 stream->Add("[%d]", slot_index()); | 301 stream->Add("[%d]", slot_index()); |
| 291 } | 302 } |
| 292 | 303 |
| 293 | 304 |
| 294 void LStoreContextSlot::PrintDataTo(StringStream* stream) { | 305 void LStoreContextSlot::PrintDataTo(StringStream* stream) { |
| 295 context()->PrintTo(stream); | 306 context()->PrintTo(stream); |
| 296 stream->Add("[%d] <- ", slot_index()); | 307 stream->Add("[%d] <- ", slot_index()); |
| 297 value()->PrintTo(stream); | 308 value()->PrintTo(stream); |
| 298 } | 309 } |
| 299 | 310 |
| 300 | 311 |
| 301 void LInvokeFunction::PrintDataTo(StringStream* stream) { | 312 void LInvokeFunction::PrintDataTo(StringStream* stream) { |
| 302 stream->Add("= "); | 313 stream->Add("= "); |
| 303 function()->PrintTo(stream); | 314 function()->PrintTo(stream); |
| 304 stream->Add(" #%d / ", arity()); | 315 stream->Add(" #%d / ", arity()); |
| 305 } | 316 } |
| 306 | 317 |
| 307 | 318 |
| 308 void LCallKeyed::PrintDataTo(StringStream* stream) { | |
| 309 stream->Add("[rcx] #%d / ", arity()); | |
| 310 } | |
| 311 | |
| 312 | |
| 313 void LCallNamed::PrintDataTo(StringStream* stream) { | |
| 314 SmartArrayPointer<char> name_string = name()->ToCString(); | |
| 315 stream->Add("%s #%d / ", name_string.get(), arity()); | |
| 316 } | |
| 317 | |
| 318 | |
| 319 void LCallKnownGlobal::PrintDataTo(StringStream* stream) { | |
| 320 stream->Add("#%d / ", arity()); | |
| 321 } | |
| 322 | |
| 323 | |
| 324 void LCallNew::PrintDataTo(StringStream* stream) { | 319 void LCallNew::PrintDataTo(StringStream* stream) { |
| 325 stream->Add("= "); | 320 stream->Add("= "); |
| 326 constructor()->PrintTo(stream); | 321 constructor()->PrintTo(stream); |
| 327 stream->Add(" #%d / ", arity()); | 322 stream->Add(" #%d / ", arity()); |
| 328 } | 323 } |
| 329 | 324 |
| 330 | 325 |
| 331 void LCallNewArray::PrintDataTo(StringStream* stream) { | 326 void LCallNewArray::PrintDataTo(StringStream* stream) { |
| 332 stream->Add("= "); | 327 stream->Add("= "); |
| 333 constructor()->PrintTo(stream); | 328 constructor()->PrintTo(stream); |
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 563 LOperand* LChunkBuilder::Use(HValue* value, LUnallocated* operand) { | 558 LOperand* LChunkBuilder::Use(HValue* value, LUnallocated* operand) { |
| 564 if (value->EmitAtUses()) { | 559 if (value->EmitAtUses()) { |
| 565 HInstruction* instr = HInstruction::cast(value); | 560 HInstruction* instr = HInstruction::cast(value); |
| 566 VisitInstruction(instr); | 561 VisitInstruction(instr); |
| 567 } | 562 } |
| 568 operand->set_virtual_register(value->id()); | 563 operand->set_virtual_register(value->id()); |
| 569 return operand; | 564 return operand; |
| 570 } | 565 } |
| 571 | 566 |
| 572 | 567 |
| 573 template<int I, int T> | 568 LInstruction* LChunkBuilder::Define(LTemplateResultInstruction<1>* instr, |
| 574 LInstruction* LChunkBuilder::Define(LTemplateInstruction<1, I, T>* instr, | |
| 575 LUnallocated* result) { | 569 LUnallocated* result) { |
| 576 result->set_virtual_register(current_instruction_->id()); | 570 result->set_virtual_register(current_instruction_->id()); |
| 577 instr->set_result(result); | 571 instr->set_result(result); |
| 578 return instr; | 572 return instr; |
| 579 } | 573 } |
| 580 | 574 |
| 581 | 575 |
| 582 template<int I, int T> | |
| 583 LInstruction* LChunkBuilder::DefineAsRegister( | 576 LInstruction* LChunkBuilder::DefineAsRegister( |
| 584 LTemplateInstruction<1, I, T>* instr) { | 577 LTemplateResultInstruction<1>* instr) { |
| 585 return Define(instr, | 578 return Define(instr, |
| 586 new(zone()) LUnallocated(LUnallocated::MUST_HAVE_REGISTER)); | 579 new(zone()) LUnallocated(LUnallocated::MUST_HAVE_REGISTER)); |
| 587 } | 580 } |
| 588 | 581 |
| 589 | 582 |
| 590 template<int I, int T> | |
| 591 LInstruction* LChunkBuilder::DefineAsSpilled( | 583 LInstruction* LChunkBuilder::DefineAsSpilled( |
| 592 LTemplateInstruction<1, I, T>* instr, | 584 LTemplateResultInstruction<1>* instr, |
| 593 int index) { | 585 int index) { |
| 594 return Define(instr, | 586 return Define(instr, |
| 595 new(zone()) LUnallocated(LUnallocated::FIXED_SLOT, index)); | 587 new(zone()) LUnallocated(LUnallocated::FIXED_SLOT, index)); |
| 596 } | 588 } |
| 597 | 589 |
| 598 | 590 |
| 599 template<int I, int T> | |
| 600 LInstruction* LChunkBuilder::DefineSameAsFirst( | 591 LInstruction* LChunkBuilder::DefineSameAsFirst( |
| 601 LTemplateInstruction<1, I, T>* instr) { | 592 LTemplateResultInstruction<1>* instr) { |
| 602 return Define(instr, | 593 return Define(instr, |
| 603 new(zone()) LUnallocated(LUnallocated::SAME_AS_FIRST_INPUT)); | 594 new(zone()) LUnallocated(LUnallocated::SAME_AS_FIRST_INPUT)); |
| 604 } | 595 } |
| 605 | 596 |
| 606 | 597 |
| 607 template<int I, int T> | 598 LInstruction* LChunkBuilder::DefineFixed(LTemplateResultInstruction<1>* instr, |
| 608 LInstruction* LChunkBuilder::DefineFixed(LTemplateInstruction<1, I, T>* instr, | |
| 609 Register reg) { | 599 Register reg) { |
| 610 return Define(instr, ToUnallocated(reg)); | 600 return Define(instr, ToUnallocated(reg)); |
| 611 } | 601 } |
| 612 | 602 |
| 613 | 603 |
| 614 template<int I, int T> | |
| 615 LInstruction* LChunkBuilder::DefineFixedDouble( | 604 LInstruction* LChunkBuilder::DefineFixedDouble( |
| 616 LTemplateInstruction<1, I, T>* instr, | 605 LTemplateResultInstruction<1>* instr, |
| 617 XMMRegister reg) { | 606 XMMRegister reg) { |
| 618 return Define(instr, ToUnallocated(reg)); | 607 return Define(instr, ToUnallocated(reg)); |
| 619 } | 608 } |
| 620 | 609 |
| 621 | 610 |
| 622 LInstruction* LChunkBuilder::AssignEnvironment(LInstruction* instr) { | 611 LInstruction* LChunkBuilder::AssignEnvironment(LInstruction* instr) { |
| 623 HEnvironment* hydrogen_env = current_block_->last_environment(); | 612 HEnvironment* hydrogen_env = current_block_->last_environment(); |
| 624 int argument_index_accumulator = 0; | 613 int argument_index_accumulator = 0; |
| 625 ZoneList<HValue*> objects_to_materialize(0, zone()); | 614 ZoneList<HValue*> objects_to_materialize(0, zone()); |
| 626 instr->set_environment(CreateEnvironment(hydrogen_env, | 615 instr->set_environment(CreateEnvironment(hydrogen_env, |
| (...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1077 return DefineAsRegister(new(zone()) LGlobalObject(context)); | 1066 return DefineAsRegister(new(zone()) LGlobalObject(context)); |
| 1078 } | 1067 } |
| 1079 | 1068 |
| 1080 | 1069 |
| 1081 LInstruction* LChunkBuilder::DoGlobalReceiver(HGlobalReceiver* instr) { | 1070 LInstruction* LChunkBuilder::DoGlobalReceiver(HGlobalReceiver* instr) { |
| 1082 LOperand* global_object = UseRegisterAtStart(instr->value()); | 1071 LOperand* global_object = UseRegisterAtStart(instr->value()); |
| 1083 return DefineAsRegister(new(zone()) LGlobalReceiver(global_object)); | 1072 return DefineAsRegister(new(zone()) LGlobalReceiver(global_object)); |
| 1084 } | 1073 } |
| 1085 | 1074 |
| 1086 | 1075 |
| 1087 LInstruction* LChunkBuilder::DoCallConstantFunction( | 1076 LInstruction* LChunkBuilder::DoCallJSFunction( |
| 1088 HCallConstantFunction* instr) { | 1077 HCallJSFunction* instr) { |
| 1089 return MarkAsCall(DefineFixed(new(zone()) LCallConstantFunction, rax), instr); | 1078 LOperand* function = UseFixed(instr->function(), rdi); |
| 1079 |
| 1080 LCallJSFunction* result = new(zone()) LCallJSFunction(function); |
| 1081 |
| 1082 return MarkAsCall(DefineFixed(result, rax), instr); |
| 1090 } | 1083 } |
| 1091 | 1084 |
| 1092 | 1085 |
| 1086 LInstruction* LChunkBuilder::DoCallWithDescriptor( |
| 1087 HCallWithDescriptor* instr) { |
| 1088 const CallInterfaceDescriptor* descriptor = instr->descriptor(); |
| 1089 |
| 1090 LOperand* target = UseRegisterOrConstantAtStart(instr->target()); |
| 1091 ZoneList<LOperand*> ops(instr->OperandCount(), zone()); |
| 1092 ops.Add(target, zone()); |
| 1093 for (int i = 1; i < instr->OperandCount(); i++) { |
| 1094 LOperand* op = UseFixed(instr->OperandAt(i), |
| 1095 descriptor->GetParameterRegister(i - 1)); |
| 1096 ops.Add(op, zone()); |
| 1097 } |
| 1098 |
| 1099 LCallWithDescriptor* result = new(zone()) LCallWithDescriptor( |
| 1100 descriptor, ops, zone()); |
| 1101 return MarkAsCall(DefineFixed(result, rax), instr); |
| 1102 } |
| 1103 |
| 1104 |
| 1093 LInstruction* LChunkBuilder::DoInvokeFunction(HInvokeFunction* instr) { | 1105 LInstruction* LChunkBuilder::DoInvokeFunction(HInvokeFunction* instr) { |
| 1094 LOperand* context = UseFixed(instr->context(), rsi); | 1106 LOperand* context = UseFixed(instr->context(), rsi); |
| 1095 LOperand* function = UseFixed(instr->function(), rdi); | 1107 LOperand* function = UseFixed(instr->function(), rdi); |
| 1096 LInvokeFunction* result = new(zone()) LInvokeFunction(context, function); | 1108 LInvokeFunction* result = new(zone()) LInvokeFunction(context, function); |
| 1097 return MarkAsCall(DefineFixed(result, rax), instr, CANNOT_DEOPTIMIZE_EAGERLY); | 1109 return MarkAsCall(DefineFixed(result, rax), instr, CANNOT_DEOPTIMIZE_EAGERLY); |
| 1098 } | 1110 } |
| 1099 | 1111 |
| 1100 | 1112 |
| 1101 LInstruction* LChunkBuilder::DoUnaryMathOperation(HUnaryMathOperation* instr) { | 1113 LInstruction* LChunkBuilder::DoUnaryMathOperation(HUnaryMathOperation* instr) { |
| 1102 switch (instr->op()) { | 1114 switch (instr->op()) { |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1162 } | 1174 } |
| 1163 | 1175 |
| 1164 | 1176 |
| 1165 LInstruction* LChunkBuilder::DoMathPowHalf(HUnaryMathOperation* instr) { | 1177 LInstruction* LChunkBuilder::DoMathPowHalf(HUnaryMathOperation* instr) { |
| 1166 LOperand* input = UseRegisterAtStart(instr->value()); | 1178 LOperand* input = UseRegisterAtStart(instr->value()); |
| 1167 LMathPowHalf* result = new(zone()) LMathPowHalf(input); | 1179 LMathPowHalf* result = new(zone()) LMathPowHalf(input); |
| 1168 return DefineSameAsFirst(result); | 1180 return DefineSameAsFirst(result); |
| 1169 } | 1181 } |
| 1170 | 1182 |
| 1171 | 1183 |
| 1172 LInstruction* LChunkBuilder::DoCallKeyed(HCallKeyed* instr) { | |
| 1173 ASSERT(instr->key()->representation().IsTagged()); | |
| 1174 LOperand* context = UseFixed(instr->context(), rsi); | |
| 1175 LOperand* key = UseFixed(instr->key(), rcx); | |
| 1176 LCallKeyed* result = new(zone()) LCallKeyed(context, key); | |
| 1177 return MarkAsCall(DefineFixed(result, rax), instr); | |
| 1178 } | |
| 1179 | |
| 1180 | |
| 1181 LInstruction* LChunkBuilder::DoCallNamed(HCallNamed* instr) { | |
| 1182 LOperand* context = UseFixed(instr->context(), rsi); | |
| 1183 LCallNamed* result = new(zone()) LCallNamed(context); | |
| 1184 return MarkAsCall(DefineFixed(result, rax), instr); | |
| 1185 } | |
| 1186 | |
| 1187 | |
| 1188 LInstruction* LChunkBuilder::DoCallKnownGlobal(HCallKnownGlobal* instr) { | |
| 1189 return MarkAsCall(DefineFixed(new(zone()) LCallKnownGlobal, rax), instr); | |
| 1190 } | |
| 1191 | |
| 1192 | |
| 1193 LInstruction* LChunkBuilder::DoCallNew(HCallNew* instr) { | 1184 LInstruction* LChunkBuilder::DoCallNew(HCallNew* instr) { |
| 1194 LOperand* context = UseFixed(instr->context(), rsi); | 1185 LOperand* context = UseFixed(instr->context(), rsi); |
| 1195 LOperand* constructor = UseFixed(instr->constructor(), rdi); | 1186 LOperand* constructor = UseFixed(instr->constructor(), rdi); |
| 1196 LCallNew* result = new(zone()) LCallNew(context, constructor); | 1187 LCallNew* result = new(zone()) LCallNew(context, constructor); |
| 1197 return MarkAsCall(DefineFixed(result, rax), instr); | 1188 return MarkAsCall(DefineFixed(result, rax), instr); |
| 1198 } | 1189 } |
| 1199 | 1190 |
| 1200 | 1191 |
| 1201 LInstruction* LChunkBuilder::DoCallNewArray(HCallNewArray* instr) { | 1192 LInstruction* LChunkBuilder::DoCallNewArray(HCallNewArray* instr) { |
| 1202 LOperand* context = UseFixed(instr->context(), rsi); | 1193 LOperand* context = UseFixed(instr->context(), rsi); |
| (...skipping 1308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2511 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { | 2502 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { |
| 2512 LOperand* object = UseRegister(instr->object()); | 2503 LOperand* object = UseRegister(instr->object()); |
| 2513 LOperand* index = UseTempRegister(instr->index()); | 2504 LOperand* index = UseTempRegister(instr->index()); |
| 2514 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); | 2505 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); |
| 2515 } | 2506 } |
| 2516 | 2507 |
| 2517 | 2508 |
| 2518 } } // namespace v8::internal | 2509 } } // namespace v8::internal |
| 2519 | 2510 |
| 2520 #endif // V8_TARGET_ARCH_X64 | 2511 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |