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

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: Addressed code review comments 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
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);
313 stream->Add(" ");
314 call_kind()->PrintTo(stream);
311 stream->Add("#%d / ", arity()); 315 stream->Add("#%d / ", arity());
312 } 316 }
313 317
318
319 void LCallWithDescriptor::PrintDataTo(StringStream* stream) {
320 for (int i = 0; i < InputCount(); i++) {
321 InputAt(i)->PrintTo(stream);
322 stream->Add(" ");
323 }
324 stream->Add("#%d / ", arity());
325 }
326
314 327
315 void LLoadContextSlot::PrintDataTo(StringStream* stream) { 328 void LLoadContextSlot::PrintDataTo(StringStream* stream) {
316 context()->PrintTo(stream); 329 context()->PrintTo(stream);
317 stream->Add("[%d]", slot_index()); 330 stream->Add("[%d]", slot_index());
318 } 331 }
319 332
320 333
321 void LStoreContextSlot::PrintDataTo(StringStream* stream) { 334 void LStoreContextSlot::PrintDataTo(StringStream* stream) {
322 context()->PrintTo(stream); 335 context()->PrintTo(stream);
323 stream->Add("[%d] <- ", slot_index()); 336 stream->Add("[%d] <- ", slot_index());
324 value()->PrintTo(stream); 337 value()->PrintTo(stream);
325 } 338 }
326 339
327 340
328 void LInvokeFunction::PrintDataTo(StringStream* stream) { 341 void LInvokeFunction::PrintDataTo(StringStream* stream) {
329 stream->Add("= "); 342 stream->Add("= ");
330 context()->PrintTo(stream); 343 context()->PrintTo(stream);
331 stream->Add(" "); 344 stream->Add(" ");
332 function()->PrintTo(stream); 345 function()->PrintTo(stream);
333 stream->Add(" #%d / ", arity()); 346 stream->Add(" #%d / ", arity());
334 } 347 }
335 348
336 349
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 LCallGlobal::PrintDataTo(StringStream* stream) { 350 void LCallGlobal::PrintDataTo(StringStream* stream) {
349 SmartArrayPointer<char> name_string = name()->ToCString(); 351 SmartArrayPointer<char> name_string = name()->ToCString();
350 stream->Add("%s #%d / ", name_string.get(), arity()); 352 stream->Add("%s #%d / ", name_string.get(), arity());
351 } 353 }
352 354
353 355
354 void LCallKnownGlobal::PrintDataTo(StringStream* stream) {
355 stream->Add("#%d / ", arity());
356 }
357
358
359 void LCallNew::PrintDataTo(StringStream* stream) { 356 void LCallNew::PrintDataTo(StringStream* stream) {
360 stream->Add("= "); 357 stream->Add("= ");
361 context()->PrintTo(stream); 358 context()->PrintTo(stream);
362 stream->Add(" "); 359 stream->Add(" ");
363 constructor()->PrintTo(stream); 360 constructor()->PrintTo(stream);
364 stream->Add(" #%d / ", arity()); 361 stream->Add(" #%d / ", arity());
365 } 362 }
366 363
367 364
368 void LCallNewArray::PrintDataTo(StringStream* stream) { 365 void LCallNewArray::PrintDataTo(StringStream* stream) {
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
618 LOperand* LChunkBuilder::Use(HValue* value, LUnallocated* operand) { 615 LOperand* LChunkBuilder::Use(HValue* value, LUnallocated* operand) {
619 if (value->EmitAtUses()) { 616 if (value->EmitAtUses()) {
620 HInstruction* instr = HInstruction::cast(value); 617 HInstruction* instr = HInstruction::cast(value);
621 VisitInstruction(instr); 618 VisitInstruction(instr);
622 } 619 }
623 operand->set_virtual_register(value->id()); 620 operand->set_virtual_register(value->id());
624 return operand; 621 return operand;
625 } 622 }
626 623
627 624
628 template<int I, int T> 625 LInstruction* LChunkBuilder::Define(LTemplateResultInstruction<1>* instr,
629 LInstruction* LChunkBuilder::Define(LTemplateInstruction<1, I, T>* instr,
630 LUnallocated* result) { 626 LUnallocated* result) {
631 result->set_virtual_register(current_instruction_->id()); 627 result->set_virtual_register(current_instruction_->id());
632 instr->set_result(result); 628 instr->set_result(result);
633 return instr; 629 return instr;
634 } 630 }
635 631
636 632
637 template<int I, int T>
638 LInstruction* LChunkBuilder::DefineAsRegister( 633 LInstruction* LChunkBuilder::DefineAsRegister(
639 LTemplateInstruction<1, I, T>* instr) { 634 LTemplateResultInstruction<1>* instr) {
640 return Define(instr, 635 return Define(instr,
641 new(zone()) LUnallocated(LUnallocated::MUST_HAVE_REGISTER)); 636 new(zone()) LUnallocated(LUnallocated::MUST_HAVE_REGISTER));
642 } 637 }
643 638
644 639
645 template<int I, int T>
646 LInstruction* LChunkBuilder::DefineAsSpilled( 640 LInstruction* LChunkBuilder::DefineAsSpilled(
647 LTemplateInstruction<1, I, T>* instr, 641 LTemplateResultInstruction<1>* instr,
648 int index) { 642 int index) {
649 return Define(instr, 643 return Define(instr,
650 new(zone()) LUnallocated(LUnallocated::FIXED_SLOT, index)); 644 new(zone()) LUnallocated(LUnallocated::FIXED_SLOT, index));
651 } 645 }
652 646
653 647
654 template<int I, int T>
655 LInstruction* LChunkBuilder::DefineSameAsFirst( 648 LInstruction* LChunkBuilder::DefineSameAsFirst(
656 LTemplateInstruction<1, I, T>* instr) { 649 LTemplateResultInstruction<1>* instr) {
657 return Define(instr, 650 return Define(instr,
658 new(zone()) LUnallocated(LUnallocated::SAME_AS_FIRST_INPUT)); 651 new(zone()) LUnallocated(LUnallocated::SAME_AS_FIRST_INPUT));
659 } 652 }
660 653
661 654
662 template<int I, int T> 655 LInstruction* LChunkBuilder::DefineFixed(LTemplateResultInstruction<1>* instr,
663 LInstruction* LChunkBuilder::DefineFixed(LTemplateInstruction<1, I, T>* instr,
664 Register reg) { 656 Register reg) {
665 return Define(instr, ToUnallocated(reg)); 657 return Define(instr, ToUnallocated(reg));
666 } 658 }
667 659
668 660
669 template<int I, int T>
670 LInstruction* LChunkBuilder::DefineFixedDouble( 661 LInstruction* LChunkBuilder::DefineFixedDouble(
671 LTemplateInstruction<1, I, T>* instr, 662 LTemplateResultInstruction<1>* instr,
672 XMMRegister reg) { 663 XMMRegister reg) {
673 return Define(instr, ToUnallocated(reg)); 664 return Define(instr, ToUnallocated(reg));
674 } 665 }
675 666
676 667
677 LInstruction* LChunkBuilder::AssignEnvironment(LInstruction* instr) { 668 LInstruction* LChunkBuilder::AssignEnvironment(LInstruction* instr) {
678 HEnvironment* hydrogen_env = current_block_->last_environment(); 669 HEnvironment* hydrogen_env = current_block_->last_environment();
679 int argument_index_accumulator = 0; 670 int argument_index_accumulator = 0;
680 ZoneList<HValue*> objects_to_materialize(0, zone()); 671 ZoneList<HValue*> objects_to_materialize(0, zone());
681 instr->set_environment(CreateEnvironment(hydrogen_env, 672 instr->set_environment(CreateEnvironment(hydrogen_env,
(...skipping 563 matching lines...) Expand 10 before | Expand all | Expand 10 after
1245 return DefineAsRegister(new(zone()) LGlobalObject(context)); 1236 return DefineAsRegister(new(zone()) LGlobalObject(context));
1246 } 1237 }
1247 1238
1248 1239
1249 LInstruction* LChunkBuilder::DoGlobalReceiver(HGlobalReceiver* instr) { 1240 LInstruction* LChunkBuilder::DoGlobalReceiver(HGlobalReceiver* instr) {
1250 LOperand* global_object = UseRegisterAtStart(instr->value()); 1241 LOperand* global_object = UseRegisterAtStart(instr->value());
1251 return DefineAsRegister(new(zone()) LGlobalReceiver(global_object)); 1242 return DefineAsRegister(new(zone()) LGlobalReceiver(global_object));
1252 } 1243 }
1253 1244
1254 1245
1255 LInstruction* LChunkBuilder::DoCallConstantFunction( 1246 LInstruction* LChunkBuilder::DoCallJSFunction(
1256 HCallConstantFunction* instr) { 1247 HCallJSFunction* instr) {
1257 return MarkAsCall(DefineFixed(new(zone()) LCallConstantFunction, eax), instr); 1248 LOperand* function = UseFixed(instr->function(), edi);
1249 LOperand* call_kind = UseFixed(instr->call_kind(), ecx);
1250
1251 LCallJSFunction* result = new(zone()) LCallJSFunction(function, call_kind);
1252
1253 return MarkAsCall(DefineFixed(result, eax), instr, CANNOT_DEOPTIMIZE_EAGERLY);
1258 } 1254 }
1259 1255
1260 1256
1257 LInstruction* LChunkBuilder::DoCallWithDescriptor(
1258 HCallWithDescriptor* instr) {
1259 const CallInterfaceDescriptor* descriptor = instr->descriptor();
1260
1261 LOperand* target = UseRegisterOrConstantAtStart(instr->target());
1262 ZoneList<LOperand*> ops(instr->OperandCount(), zone());
1263 ops.Add(target, zone());
1264 for (int i = 1; i < instr->OperandCount(); i++) {
1265 LOperand* op = UseFixed(instr->OperandAt(i),
1266 descriptor->GetParameterRegister(i - 1));
Toon Verwaest 2014/01/14 15:33:50 4-space indent
Jarin 2014/01/14 19:08:08 Done.
1267 ops.Add(op, zone());
1268 }
1269
1270 LCallWithDescriptor* result = new(zone()) LCallWithDescriptor(
1271 descriptor, ops, zone());
1272 return MarkAsCall(DefineFixed(result, eax), instr, CANNOT_DEOPTIMIZE_EAGERLY);
1273 }
1274
1275
1261 LInstruction* LChunkBuilder::DoInvokeFunction(HInvokeFunction* instr) { 1276 LInstruction* LChunkBuilder::DoInvokeFunction(HInvokeFunction* instr) {
1262 LOperand* context = UseFixed(instr->context(), esi); 1277 LOperand* context = UseFixed(instr->context(), esi);
1263 LOperand* function = UseFixed(instr->function(), edi); 1278 LOperand* function = UseFixed(instr->function(), edi);
1264 LInvokeFunction* result = new(zone()) LInvokeFunction(context, function); 1279 LInvokeFunction* result = new(zone()) LInvokeFunction(context, function);
1265 return MarkAsCall(DefineFixed(result, eax), instr, CANNOT_DEOPTIMIZE_EAGERLY); 1280 return MarkAsCall(DefineFixed(result, eax), instr, CANNOT_DEOPTIMIZE_EAGERLY);
1266 } 1281 }
1267 1282
1268 1283
1269 LInstruction* LChunkBuilder::DoUnaryMathOperation(HUnaryMathOperation* instr) { 1284 LInstruction* LChunkBuilder::DoUnaryMathOperation(HUnaryMathOperation* instr) {
1270 switch (instr->op()) { 1285 switch (instr->op()) {
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
1332 1347
1333 1348
1334 LInstruction* LChunkBuilder::DoMathPowHalf(HUnaryMathOperation* instr) { 1349 LInstruction* LChunkBuilder::DoMathPowHalf(HUnaryMathOperation* instr) {
1335 LOperand* input = UseRegisterAtStart(instr->value()); 1350 LOperand* input = UseRegisterAtStart(instr->value());
1336 LOperand* temp = TempRegister(); 1351 LOperand* temp = TempRegister();
1337 LMathPowHalf* result = new(zone()) LMathPowHalf(input, temp); 1352 LMathPowHalf* result = new(zone()) LMathPowHalf(input, temp);
1338 return DefineSameAsFirst(result); 1353 return DefineSameAsFirst(result);
1339 } 1354 }
1340 1355
1341 1356
1342 LInstruction* LChunkBuilder::DoCallKeyed(HCallKeyed* instr) {
1343 ASSERT(instr->key()->representation().IsTagged());
1344 LOperand* context = UseFixed(instr->context(), esi);
1345 LOperand* key = UseFixed(instr->key(), ecx);
1346 LCallKeyed* result = new(zone()) LCallKeyed(context, key);
1347 return MarkAsCall(DefineFixed(result, eax), instr);
1348 }
1349
1350
1351 LInstruction* LChunkBuilder::DoCallNamed(HCallNamed* instr) {
1352 LOperand* context = UseFixed(instr->context(), esi);
1353 LCallNamed* result = new(zone()) LCallNamed(context);
1354 return MarkAsCall(DefineFixed(result, eax), instr);
1355 }
1356
1357
1358 LInstruction* LChunkBuilder::DoCallGlobal(HCallGlobal* instr) { 1357 LInstruction* LChunkBuilder::DoCallGlobal(HCallGlobal* instr) {
1359 LOperand* context = UseFixed(instr->context(), esi); 1358 LOperand* context = UseFixed(instr->context(), esi);
1360 LCallGlobal* result = new(zone()) LCallGlobal(context); 1359 LCallGlobal* result = new(zone()) LCallGlobal(context);
1361 return MarkAsCall(DefineFixed(result, eax), instr); 1360 return MarkAsCall(DefineFixed(result, eax), instr);
1362 } 1361 }
1363 1362
1364 1363
1365 LInstruction* LChunkBuilder::DoCallKnownGlobal(HCallKnownGlobal* instr) {
1366 return MarkAsCall(DefineFixed(new(zone()) LCallKnownGlobal, eax), instr);
1367 }
1368
1369
1370 LInstruction* LChunkBuilder::DoCallNew(HCallNew* instr) { 1364 LInstruction* LChunkBuilder::DoCallNew(HCallNew* instr) {
1371 LOperand* context = UseFixed(instr->context(), esi); 1365 LOperand* context = UseFixed(instr->context(), esi);
1372 LOperand* constructor = UseFixed(instr->constructor(), edi); 1366 LOperand* constructor = UseFixed(instr->constructor(), edi);
1373 LCallNew* result = new(zone()) LCallNew(context, constructor); 1367 LCallNew* result = new(zone()) LCallNew(context, constructor);
1374 return MarkAsCall(DefineFixed(result, eax), instr); 1368 return MarkAsCall(DefineFixed(result, eax), instr);
1375 } 1369 }
1376 1370
1377 1371
1378 LInstruction* LChunkBuilder::DoCallNewArray(HCallNewArray* instr) { 1372 LInstruction* LChunkBuilder::DoCallNewArray(HCallNewArray* instr) {
1379 LOperand* context = UseFixed(instr->context(), esi); 1373 LOperand* context = UseFixed(instr->context(), esi);
(...skipping 1384 matching lines...) Expand 10 before | Expand all | Expand 10 after
2764 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { 2758 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) {
2765 LOperand* object = UseRegister(instr->object()); 2759 LOperand* object = UseRegister(instr->object());
2766 LOperand* index = UseTempRegister(instr->index()); 2760 LOperand* index = UseTempRegister(instr->index());
2767 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); 2761 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index));
2768 } 2762 }
2769 2763
2770 2764
2771 } } // namespace v8::internal 2765 } } // namespace v8::internal
2772 2766
2773 #endif // V8_TARGET_ARCH_IA32 2767 #endif // V8_TARGET_ARCH_IA32
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698