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

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

Issue 104663004: Preview of a first step towards unification of hydrogen calls (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Merge fix 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/ia32/lithium-ia32.h ('k') | src/ia32/macro-assembler-ia32.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 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 300
301 301
302 void LInnerAllocatedObject::PrintDataTo(StringStream* stream) { 302 void LInnerAllocatedObject::PrintDataTo(StringStream* stream) {
303 stream->Add(" = "); 303 stream->Add(" = ");
304 base_object()->PrintTo(stream); 304 base_object()->PrintTo(stream);
305 stream->Add(" + "); 305 stream->Add(" + ");
306 offset()->PrintTo(stream); 306 offset()->PrintTo(stream);
307 } 307 }
308 308
309 309
310 void LCallConstantFunction::PrintDataTo(StringStream* stream) { 310 void LCallJSFunction::PrintDataTo(StringStream* stream) {
311 stream->Add("= ");
312 function()->PrintTo(stream);
311 stream->Add("#%d / ", arity()); 313 stream->Add("#%d / ", arity());
312 } 314 }
313 315
316
317 void LCallWithDescriptor::PrintDataTo(StringStream* stream) {
318 for (int i = 0; i < InputCount(); i++) {
319 InputAt(i)->PrintTo(stream);
320 stream->Add(" ");
321 }
322 stream->Add("#%d / ", arity());
323 }
324
314 325
315 void LLoadContextSlot::PrintDataTo(StringStream* stream) { 326 void LLoadContextSlot::PrintDataTo(StringStream* stream) {
316 context()->PrintTo(stream); 327 context()->PrintTo(stream);
317 stream->Add("[%d]", slot_index()); 328 stream->Add("[%d]", slot_index());
318 } 329 }
319 330
320 331
321 void LStoreContextSlot::PrintDataTo(StringStream* stream) { 332 void LStoreContextSlot::PrintDataTo(StringStream* stream) {
322 context()->PrintTo(stream); 333 context()->PrintTo(stream);
323 stream->Add("[%d] <- ", slot_index()); 334 stream->Add("[%d] <- ", slot_index());
324 value()->PrintTo(stream); 335 value()->PrintTo(stream);
325 } 336 }
326 337
327 338
328 void LInvokeFunction::PrintDataTo(StringStream* stream) { 339 void LInvokeFunction::PrintDataTo(StringStream* stream) {
329 stream->Add("= "); 340 stream->Add("= ");
330 context()->PrintTo(stream); 341 context()->PrintTo(stream);
331 stream->Add(" "); 342 stream->Add(" ");
332 function()->PrintTo(stream); 343 function()->PrintTo(stream);
333 stream->Add(" #%d / ", arity()); 344 stream->Add(" #%d / ", arity());
334 } 345 }
335 346
336 347
337 void LCallKeyed::PrintDataTo(StringStream* stream) {
338 stream->Add("[ecx] #%d / ", arity());
339 }
340
341
342 void LCallNamed::PrintDataTo(StringStream* stream) {
343 SmartArrayPointer<char> name_string = name()->ToCString();
344 stream->Add("%s #%d / ", name_string.get(), arity());
345 }
346
347
348 void LCallKnownGlobal::PrintDataTo(StringStream* stream) {
349 stream->Add("#%d / ", arity());
350 }
351
352
353 void LCallNew::PrintDataTo(StringStream* stream) { 348 void LCallNew::PrintDataTo(StringStream* stream) {
354 stream->Add("= "); 349 stream->Add("= ");
355 context()->PrintTo(stream); 350 context()->PrintTo(stream);
356 stream->Add(" "); 351 stream->Add(" ");
357 constructor()->PrintTo(stream); 352 constructor()->PrintTo(stream);
358 stream->Add(" #%d / ", arity()); 353 stream->Add(" #%d / ", arity());
359 } 354 }
360 355
361 356
362 void LCallNewArray::PrintDataTo(StringStream* stream) { 357 void LCallNewArray::PrintDataTo(StringStream* stream) {
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
612 LOperand* LChunkBuilder::Use(HValue* value, LUnallocated* operand) { 607 LOperand* LChunkBuilder::Use(HValue* value, LUnallocated* operand) {
613 if (value->EmitAtUses()) { 608 if (value->EmitAtUses()) {
614 HInstruction* instr = HInstruction::cast(value); 609 HInstruction* instr = HInstruction::cast(value);
615 VisitInstruction(instr); 610 VisitInstruction(instr);
616 } 611 }
617 operand->set_virtual_register(value->id()); 612 operand->set_virtual_register(value->id());
618 return operand; 613 return operand;
619 } 614 }
620 615
621 616
622 template<int I, int T> 617 LInstruction* LChunkBuilder::Define(LTemplateResultInstruction<1>* instr,
623 LInstruction* LChunkBuilder::Define(LTemplateInstruction<1, I, T>* instr,
624 LUnallocated* result) { 618 LUnallocated* result) {
625 result->set_virtual_register(current_instruction_->id()); 619 result->set_virtual_register(current_instruction_->id());
626 instr->set_result(result); 620 instr->set_result(result);
627 return instr; 621 return instr;
628 } 622 }
629 623
630 624
631 template<int I, int T>
632 LInstruction* LChunkBuilder::DefineAsRegister( 625 LInstruction* LChunkBuilder::DefineAsRegister(
633 LTemplateInstruction<1, I, T>* instr) { 626 LTemplateResultInstruction<1>* instr) {
634 return Define(instr, 627 return Define(instr,
635 new(zone()) LUnallocated(LUnallocated::MUST_HAVE_REGISTER)); 628 new(zone()) LUnallocated(LUnallocated::MUST_HAVE_REGISTER));
636 } 629 }
637 630
638 631
639 template<int I, int T>
640 LInstruction* LChunkBuilder::DefineAsSpilled( 632 LInstruction* LChunkBuilder::DefineAsSpilled(
641 LTemplateInstruction<1, I, T>* instr, 633 LTemplateResultInstruction<1>* instr,
642 int index) { 634 int index) {
643 return Define(instr, 635 return Define(instr,
644 new(zone()) LUnallocated(LUnallocated::FIXED_SLOT, index)); 636 new(zone()) LUnallocated(LUnallocated::FIXED_SLOT, index));
645 } 637 }
646 638
647 639
648 template<int I, int T>
649 LInstruction* LChunkBuilder::DefineSameAsFirst( 640 LInstruction* LChunkBuilder::DefineSameAsFirst(
650 LTemplateInstruction<1, I, T>* instr) { 641 LTemplateResultInstruction<1>* instr) {
651 return Define(instr, 642 return Define(instr,
652 new(zone()) LUnallocated(LUnallocated::SAME_AS_FIRST_INPUT)); 643 new(zone()) LUnallocated(LUnallocated::SAME_AS_FIRST_INPUT));
653 } 644 }
654 645
655 646
656 template<int I, int T> 647 LInstruction* LChunkBuilder::DefineFixed(LTemplateResultInstruction<1>* instr,
657 LInstruction* LChunkBuilder::DefineFixed(LTemplateInstruction<1, I, T>* instr,
658 Register reg) { 648 Register reg) {
659 return Define(instr, ToUnallocated(reg)); 649 return Define(instr, ToUnallocated(reg));
660 } 650 }
661 651
662 652
663 template<int I, int T>
664 LInstruction* LChunkBuilder::DefineFixedDouble( 653 LInstruction* LChunkBuilder::DefineFixedDouble(
665 LTemplateInstruction<1, I, T>* instr, 654 LTemplateResultInstruction<1>* instr,
666 XMMRegister reg) { 655 XMMRegister reg) {
667 return Define(instr, ToUnallocated(reg)); 656 return Define(instr, ToUnallocated(reg));
668 } 657 }
669 658
670 659
671 LInstruction* LChunkBuilder::AssignEnvironment(LInstruction* instr) { 660 LInstruction* LChunkBuilder::AssignEnvironment(LInstruction* instr) {
672 HEnvironment* hydrogen_env = current_block_->last_environment(); 661 HEnvironment* hydrogen_env = current_block_->last_environment();
673 int argument_index_accumulator = 0; 662 int argument_index_accumulator = 0;
674 ZoneList<HValue*> objects_to_materialize(0, zone()); 663 ZoneList<HValue*> objects_to_materialize(0, zone());
675 instr->set_environment(CreateEnvironment(hydrogen_env, 664 instr->set_environment(CreateEnvironment(hydrogen_env,
(...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after
1155 return DefineAsRegister(new(zone()) LGlobalObject(context)); 1144 return DefineAsRegister(new(zone()) LGlobalObject(context));
1156 } 1145 }
1157 1146
1158 1147
1159 LInstruction* LChunkBuilder::DoGlobalReceiver(HGlobalReceiver* instr) { 1148 LInstruction* LChunkBuilder::DoGlobalReceiver(HGlobalReceiver* instr) {
1160 LOperand* global_object = UseRegisterAtStart(instr->value()); 1149 LOperand* global_object = UseRegisterAtStart(instr->value());
1161 return DefineAsRegister(new(zone()) LGlobalReceiver(global_object)); 1150 return DefineAsRegister(new(zone()) LGlobalReceiver(global_object));
1162 } 1151 }
1163 1152
1164 1153
1165 LInstruction* LChunkBuilder::DoCallConstantFunction( 1154 LInstruction* LChunkBuilder::DoCallJSFunction(
1166 HCallConstantFunction* instr) { 1155 HCallJSFunction* instr) {
1167 return MarkAsCall(DefineFixed(new(zone()) LCallConstantFunction, eax), instr); 1156 LOperand* function = UseFixed(instr->function(), edi);
1157
1158 LCallJSFunction* result = new(zone()) LCallJSFunction(function);
1159
1160 return MarkAsCall(DefineFixed(result, eax), instr, CANNOT_DEOPTIMIZE_EAGERLY);
1168 } 1161 }
1169 1162
1170 1163
1164 LInstruction* LChunkBuilder::DoCallWithDescriptor(
1165 HCallWithDescriptor* instr) {
1166 const CallInterfaceDescriptor* descriptor = instr->descriptor();
1167
1168 LOperand* target = UseRegisterOrConstantAtStart(instr->target());
1169 ZoneList<LOperand*> ops(instr->OperandCount(), zone());
1170 ops.Add(target, zone());
1171 for (int i = 1; i < instr->OperandCount(); i++) {
1172 LOperand* op = UseFixed(instr->OperandAt(i),
1173 descriptor->GetParameterRegister(i - 1));
1174 ops.Add(op, zone());
1175 }
1176
1177 LCallWithDescriptor* result = new(zone()) LCallWithDescriptor(
1178 descriptor, ops, zone());
1179 return MarkAsCall(DefineFixed(result, eax), instr, CANNOT_DEOPTIMIZE_EAGERLY);
1180 }
1181
1182
1171 LInstruction* LChunkBuilder::DoInvokeFunction(HInvokeFunction* instr) { 1183 LInstruction* LChunkBuilder::DoInvokeFunction(HInvokeFunction* instr) {
1172 LOperand* context = UseFixed(instr->context(), esi); 1184 LOperand* context = UseFixed(instr->context(), esi);
1173 LOperand* function = UseFixed(instr->function(), edi); 1185 LOperand* function = UseFixed(instr->function(), edi);
1174 LInvokeFunction* result = new(zone()) LInvokeFunction(context, function); 1186 LInvokeFunction* result = new(zone()) LInvokeFunction(context, function);
1175 return MarkAsCall(DefineFixed(result, eax), instr, CANNOT_DEOPTIMIZE_EAGERLY); 1187 return MarkAsCall(DefineFixed(result, eax), instr, CANNOT_DEOPTIMIZE_EAGERLY);
1176 } 1188 }
1177 1189
1178 1190
1179 LInstruction* LChunkBuilder::DoUnaryMathOperation(HUnaryMathOperation* instr) { 1191 LInstruction* LChunkBuilder::DoUnaryMathOperation(HUnaryMathOperation* instr) {
1180 switch (instr->op()) { 1192 switch (instr->op()) {
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
1242 1254
1243 1255
1244 LInstruction* LChunkBuilder::DoMathPowHalf(HUnaryMathOperation* instr) { 1256 LInstruction* LChunkBuilder::DoMathPowHalf(HUnaryMathOperation* instr) {
1245 LOperand* input = UseRegisterAtStart(instr->value()); 1257 LOperand* input = UseRegisterAtStart(instr->value());
1246 LOperand* temp = TempRegister(); 1258 LOperand* temp = TempRegister();
1247 LMathPowHalf* result = new(zone()) LMathPowHalf(input, temp); 1259 LMathPowHalf* result = new(zone()) LMathPowHalf(input, temp);
1248 return DefineSameAsFirst(result); 1260 return DefineSameAsFirst(result);
1249 } 1261 }
1250 1262
1251 1263
1252 LInstruction* LChunkBuilder::DoCallKeyed(HCallKeyed* instr) {
1253 ASSERT(instr->key()->representation().IsTagged());
1254 LOperand* context = UseFixed(instr->context(), esi);
1255 LOperand* key = UseFixed(instr->key(), ecx);
1256 LCallKeyed* result = new(zone()) LCallKeyed(context, key);
1257 return MarkAsCall(DefineFixed(result, eax), instr);
1258 }
1259
1260
1261 LInstruction* LChunkBuilder::DoCallNamed(HCallNamed* instr) {
1262 LOperand* context = UseFixed(instr->context(), esi);
1263 LCallNamed* result = new(zone()) LCallNamed(context);
1264 return MarkAsCall(DefineFixed(result, eax), instr);
1265 }
1266
1267
1268 LInstruction* LChunkBuilder::DoCallKnownGlobal(HCallKnownGlobal* instr) {
1269 return MarkAsCall(DefineFixed(new(zone()) LCallKnownGlobal, eax), instr);
1270 }
1271
1272
1273 LInstruction* LChunkBuilder::DoCallNew(HCallNew* instr) { 1264 LInstruction* LChunkBuilder::DoCallNew(HCallNew* instr) {
1274 LOperand* context = UseFixed(instr->context(), esi); 1265 LOperand* context = UseFixed(instr->context(), esi);
1275 LOperand* constructor = UseFixed(instr->constructor(), edi); 1266 LOperand* constructor = UseFixed(instr->constructor(), edi);
1276 LCallNew* result = new(zone()) LCallNew(context, constructor); 1267 LCallNew* result = new(zone()) LCallNew(context, constructor);
1277 return MarkAsCall(DefineFixed(result, eax), instr); 1268 return MarkAsCall(DefineFixed(result, eax), instr);
1278 } 1269 }
1279 1270
1280 1271
1281 LInstruction* LChunkBuilder::DoCallNewArray(HCallNewArray* instr) { 1272 LInstruction* LChunkBuilder::DoCallNewArray(HCallNewArray* instr) {
1282 LOperand* context = UseFixed(instr->context(), esi); 1273 LOperand* context = UseFixed(instr->context(), esi);
(...skipping 1383 matching lines...) Expand 10 before | Expand all | Expand 10 after
2666 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { 2657 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) {
2667 LOperand* object = UseRegister(instr->object()); 2658 LOperand* object = UseRegister(instr->object());
2668 LOperand* index = UseTempRegister(instr->index()); 2659 LOperand* index = UseTempRegister(instr->index());
2669 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); 2660 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index));
2670 } 2661 }
2671 2662
2672 2663
2673 } } // namespace v8::internal 2664 } } // namespace v8::internal
2674 2665
2675 #endif // V8_TARGET_ARCH_IA32 2666 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ia32/lithium-ia32.h ('k') | src/ia32/macro-assembler-ia32.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698