Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7)

Side by Side Diff: src/mips/lithium-mips.cc

Issue 137663005: MIPS: This is a preview of a first step towards unification of the hydrogen call machinery. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/mips/lithium-mips.h ('k') | src/mips/macro-assembler-mips.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 LCallKnownGlobal::PrintDataTo(StringStream* stream) {
322 stream->Add("#%d / ", arity());
323 }
324
325
326 void LCallNew::PrintDataTo(StringStream* stream) { 321 void LCallNew::PrintDataTo(StringStream* stream) {
327 stream->Add("= "); 322 stream->Add("= ");
328 constructor()->PrintTo(stream); 323 constructor()->PrintTo(stream);
329 stream->Add(" #%d / ", arity()); 324 stream->Add(" #%d / ", arity());
330 } 325 }
331 326
332 327
333 void LCallNewArray::PrintDataTo(StringStream* stream) { 328 void LCallNewArray::PrintDataTo(StringStream* stream) {
334 stream->Add("= "); 329 stream->Add("= ");
335 constructor()->PrintTo(stream); 330 constructor()->PrintTo(stream);
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
555 LOperand* LChunkBuilder::Use(HValue* value, LUnallocated* operand) { 550 LOperand* LChunkBuilder::Use(HValue* value, LUnallocated* operand) {
556 if (value->EmitAtUses()) { 551 if (value->EmitAtUses()) {
557 HInstruction* instr = HInstruction::cast(value); 552 HInstruction* instr = HInstruction::cast(value);
558 VisitInstruction(instr); 553 VisitInstruction(instr);
559 } 554 }
560 operand->set_virtual_register(value->id()); 555 operand->set_virtual_register(value->id());
561 return operand; 556 return operand;
562 } 557 }
563 558
564 559
565 template<int I, int T> 560 LInstruction* LChunkBuilder::Define(LTemplateResultInstruction<1>* instr,
566 LInstruction* LChunkBuilder::Define(LTemplateInstruction<1, I, T>* instr,
567 LUnallocated* result) { 561 LUnallocated* result) {
568 result->set_virtual_register(current_instruction_->id()); 562 result->set_virtual_register(current_instruction_->id());
569 instr->set_result(result); 563 instr->set_result(result);
570 return instr; 564 return instr;
571 } 565 }
572 566
573 567
574 template<int I, int T>
575 LInstruction* LChunkBuilder::DefineAsRegister( 568 LInstruction* LChunkBuilder::DefineAsRegister(
576 LTemplateInstruction<1, I, T>* instr) { 569 LTemplateResultInstruction<1>* instr) {
577 return Define(instr, 570 return Define(instr,
578 new(zone()) LUnallocated(LUnallocated::MUST_HAVE_REGISTER)); 571 new(zone()) LUnallocated(LUnallocated::MUST_HAVE_REGISTER));
579 } 572 }
580 573
581 574
582 template<int I, int T>
583 LInstruction* LChunkBuilder::DefineAsSpilled( 575 LInstruction* LChunkBuilder::DefineAsSpilled(
584 LTemplateInstruction<1, I, T>* instr, int index) { 576 LTemplateResultInstruction<1>* instr, int index) {
585 return Define(instr, 577 return Define(instr,
586 new(zone()) LUnallocated(LUnallocated::FIXED_SLOT, index)); 578 new(zone()) LUnallocated(LUnallocated::FIXED_SLOT, index));
587 } 579 }
588 580
589 581
590 template<int I, int T>
591 LInstruction* LChunkBuilder::DefineSameAsFirst( 582 LInstruction* LChunkBuilder::DefineSameAsFirst(
592 LTemplateInstruction<1, I, T>* instr) { 583 LTemplateResultInstruction<1>* instr) {
593 return Define(instr, 584 return Define(instr,
594 new(zone()) LUnallocated(LUnallocated::SAME_AS_FIRST_INPUT)); 585 new(zone()) LUnallocated(LUnallocated::SAME_AS_FIRST_INPUT));
595 } 586 }
596 587
597 588
598 template<int I, int T>
599 LInstruction* LChunkBuilder::DefineFixed( 589 LInstruction* LChunkBuilder::DefineFixed(
600 LTemplateInstruction<1, I, T>* instr, Register reg) { 590 LTemplateResultInstruction<1>* instr, Register reg) {
601 return Define(instr, ToUnallocated(reg)); 591 return Define(instr, ToUnallocated(reg));
602 } 592 }
603 593
604 594
605 template<int I, int T>
606 LInstruction* LChunkBuilder::DefineFixedDouble( 595 LInstruction* LChunkBuilder::DefineFixedDouble(
607 LTemplateInstruction<1, I, T>* instr, DoubleRegister reg) { 596 LTemplateResultInstruction<1>* instr, DoubleRegister reg) {
608 return Define(instr, ToUnallocated(reg)); 597 return Define(instr, ToUnallocated(reg));
609 } 598 }
610 599
611 600
612 LInstruction* LChunkBuilder::AssignEnvironment(LInstruction* instr) { 601 LInstruction* LChunkBuilder::AssignEnvironment(LInstruction* instr) {
613 HEnvironment* hydrogen_env = current_block_->last_environment(); 602 HEnvironment* hydrogen_env = current_block_->last_environment();
614 int argument_index_accumulator = 0; 603 int argument_index_accumulator = 0;
615 ZoneList<HValue*> objects_to_materialize(0, zone()); 604 ZoneList<HValue*> objects_to_materialize(0, zone());
616 instr->set_environment(CreateEnvironment(hydrogen_env, 605 instr->set_environment(CreateEnvironment(hydrogen_env,
617 &argument_index_accumulator, 606 &argument_index_accumulator,
(...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after
1073 return DefineAsRegister(new(zone()) LGlobalObject(context)); 1062 return DefineAsRegister(new(zone()) LGlobalObject(context));
1074 } 1063 }
1075 1064
1076 1065
1077 LInstruction* LChunkBuilder::DoGlobalReceiver(HGlobalReceiver* instr) { 1066 LInstruction* LChunkBuilder::DoGlobalReceiver(HGlobalReceiver* instr) {
1078 LOperand* global_object = UseRegisterAtStart(instr->value()); 1067 LOperand* global_object = UseRegisterAtStart(instr->value());
1079 return DefineAsRegister(new(zone()) LGlobalReceiver(global_object)); 1068 return DefineAsRegister(new(zone()) LGlobalReceiver(global_object));
1080 } 1069 }
1081 1070
1082 1071
1083 LInstruction* LChunkBuilder::DoCallConstantFunction( 1072 LInstruction* LChunkBuilder::DoCallJSFunction(
1084 HCallConstantFunction* instr) { 1073 HCallJSFunction* instr) {
1085 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);
1086 } 1079 }
1087 1080
1088 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
1089 LInstruction* LChunkBuilder::DoInvokeFunction(HInvokeFunction* instr) { 1101 LInstruction* LChunkBuilder::DoInvokeFunction(HInvokeFunction* instr) {
1090 LOperand* context = UseFixed(instr->context(), cp); 1102 LOperand* context = UseFixed(instr->context(), cp);
1091 LOperand* function = UseFixed(instr->function(), a1); 1103 LOperand* function = UseFixed(instr->function(), a1);
1092 LInvokeFunction* result = new(zone()) LInvokeFunction(context, function); 1104 LInvokeFunction* result = new(zone()) LInvokeFunction(context, function);
1093 return MarkAsCall(DefineFixed(result, v0), instr, CANNOT_DEOPTIMIZE_EAGERLY); 1105 return MarkAsCall(DefineFixed(result, v0), instr, CANNOT_DEOPTIMIZE_EAGERLY);
1094 } 1106 }
1095 1107
1096 1108
1097 LInstruction* LChunkBuilder::DoUnaryMathOperation(HUnaryMathOperation* instr) { 1109 LInstruction* LChunkBuilder::DoUnaryMathOperation(HUnaryMathOperation* instr) {
1098 switch (instr->op()) { 1110 switch (instr->op()) {
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
1166 1178
1167 1179
1168 LInstruction* LChunkBuilder::DoMathRound(HUnaryMathOperation* instr) { 1180 LInstruction* LChunkBuilder::DoMathRound(HUnaryMathOperation* instr) {
1169 LOperand* input = UseRegister(instr->value()); 1181 LOperand* input = UseRegister(instr->value());
1170 LOperand* temp = FixedTemp(f6); 1182 LOperand* temp = FixedTemp(f6);
1171 LMathRound* result = new(zone()) LMathRound(input, temp); 1183 LMathRound* result = new(zone()) LMathRound(input, temp);
1172 return AssignEnvironment(DefineAsRegister(result)); 1184 return AssignEnvironment(DefineAsRegister(result));
1173 } 1185 }
1174 1186
1175 1187
1176 LInstruction* LChunkBuilder::DoCallKeyed(HCallKeyed* instr) {
1177 ASSERT(instr->key()->representation().IsTagged());
1178 LOperand* context = UseFixed(instr->context(), cp);
1179 LOperand* key = UseFixed(instr->key(), a2);
1180 return MarkAsCall(
1181 DefineFixed(new(zone()) LCallKeyed(context, key), v0), instr);
1182 }
1183
1184
1185 LInstruction* LChunkBuilder::DoCallNamed(HCallNamed* instr) {
1186 LOperand* context = UseFixed(instr->context(), cp);
1187 return MarkAsCall(DefineFixed(new(zone()) LCallNamed(context), v0), instr);
1188 }
1189
1190
1191 LInstruction* LChunkBuilder::DoCallKnownGlobal(HCallKnownGlobal* instr) {
1192 return MarkAsCall(DefineFixed(new(zone()) LCallKnownGlobal, v0), instr);
1193 }
1194
1195
1196 LInstruction* LChunkBuilder::DoCallNew(HCallNew* instr) { 1188 LInstruction* LChunkBuilder::DoCallNew(HCallNew* instr) {
1197 LOperand* context = UseFixed(instr->context(), cp); 1189 LOperand* context = UseFixed(instr->context(), cp);
1198 LOperand* constructor = UseFixed(instr->constructor(), a1); 1190 LOperand* constructor = UseFixed(instr->constructor(), a1);
1199 LCallNew* result = new(zone()) LCallNew(context, constructor); 1191 LCallNew* result = new(zone()) LCallNew(context, constructor);
1200 return MarkAsCall(DefineFixed(result, v0), instr); 1192 return MarkAsCall(DefineFixed(result, v0), instr);
1201 } 1193 }
1202 1194
1203 1195
1204 LInstruction* LChunkBuilder::DoCallNewArray(HCallNewArray* instr) { 1196 LInstruction* LChunkBuilder::DoCallNewArray(HCallNewArray* instr) {
1205 LOperand* context = UseFixed(instr->context(), cp); 1197 LOperand* context = UseFixed(instr->context(), cp);
(...skipping 1272 matching lines...) Expand 10 before | Expand all | Expand 10 after
2478 2470
2479 2471
2480 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { 2472 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) {
2481 LOperand* object = UseRegister(instr->object()); 2473 LOperand* object = UseRegister(instr->object());
2482 LOperand* index = UseRegister(instr->index()); 2474 LOperand* index = UseRegister(instr->index());
2483 return DefineAsRegister(new(zone()) LLoadFieldByIndex(object, index)); 2475 return DefineAsRegister(new(zone()) LLoadFieldByIndex(object, index));
2484 } 2476 }
2485 2477
2486 2478
2487 } } // namespace v8::internal 2479 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/mips/lithium-mips.h ('k') | src/mips/macro-assembler-mips.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698