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

Side by Side Diff: runtime/vm/il_printer.cc

Issue 2941643002: Check for a passed-in type argument vector in the prolog of generic functions. (Closed)
Patch Set: address review comments Created 3 years, 6 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
« no previous file with comments | « runtime/vm/flow_graph_compiler_x64.cc ('k') | runtime/vm/intermediate_language_ia32.cc » ('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 (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/il_printer.h" 5 #include "vm/il_printer.h"
6 6
7 #include "vm/flow_graph_range_analysis.h" 7 #include "vm/flow_graph_range_analysis.h"
8 #include "vm/intermediate_language.h" 8 #include "vm/intermediate_language.h"
9 #include "vm/os.h" 9 #include "vm/os.h"
10 #include "vm/parser.h" 10 #include "vm/parser.h"
(...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after
493 f->Print("%" Pd "", num_temps()); 493 f->Print("%" Pd "", num_temps());
494 if (value() != NULL) { 494 if (value() != NULL) {
495 f->Print(", "); 495 f->Print(", ");
496 value()->PrintTo(f); 496 value()->PrintTo(f);
497 } 497 }
498 } 498 }
499 499
500 500
501 void AssertAssignableInstr::PrintOperandsTo(BufferFormatter* f) const { 501 void AssertAssignableInstr::PrintOperandsTo(BufferFormatter* f) const {
502 value()->PrintTo(f); 502 value()->PrintTo(f);
503 f->Print(", %s, '%s'", dst_type().ToCString(), dst_name().ToCString()); 503 f->Print(", %s, '%s',", dst_type().ToCString(), dst_name().ToCString());
504 f->Print(" instantiator_type_arguments("); 504 f->Print(" instantiator_type_args(");
505 instantiator_type_arguments()->PrintTo(f); 505 instantiator_type_arguments()->PrintTo(f);
506 f->Print("), function_type_args(");
507 function_type_arguments()->PrintTo(f);
506 f->Print(")"); 508 f->Print(")");
507 } 509 }
508 510
509 511
510 void AssertBooleanInstr::PrintOperandsTo(BufferFormatter* f) const { 512 void AssertBooleanInstr::PrintOperandsTo(BufferFormatter* f) const {
511 value()->PrintTo(f); 513 value()->PrintTo(f);
512 } 514 }
513 515
514 516
515 void ClosureCallInstr::PrintOperandsTo(BufferFormatter* f) const { 517 void ClosureCallInstr::PrintOperandsTo(BufferFormatter* f) const {
516 f->Print(" function="); 518 f->Print(" function=");
517 InputAt(0)->PrintTo(f); 519 InputAt(0)->PrintTo(f);
520 f->Print("<%" Pd ">", type_args_len());
518 for (intptr_t i = 0; i < ArgumentCount(); ++i) { 521 for (intptr_t i = 0; i < ArgumentCount(); ++i) {
519 f->Print(", "); 522 f->Print(", ");
520 PushArgumentAt(i)->value()->PrintTo(f); 523 PushArgumentAt(i)->value()->PrintTo(f);
521 } 524 }
522 } 525 }
523 526
524 527
525 void InstanceCallInstr::PrintOperandsTo(BufferFormatter* f) const { 528 void InstanceCallInstr::PrintOperandsTo(BufferFormatter* f) const {
526 f->Print(" %s", function_name().ToCString()); 529 f->Print(" %s<%" Pd ">", function_name().ToCString(), type_args_len());
527 for (intptr_t i = 0; i < ArgumentCount(); ++i) { 530 for (intptr_t i = 0; i < ArgumentCount(); ++i) {
528 f->Print(", "); 531 f->Print(", ");
529 PushArgumentAt(i)->value()->PrintTo(f); 532 PushArgumentAt(i)->value()->PrintTo(f);
530 } 533 }
531 if (HasICData()) { 534 if (HasICData()) {
532 if (FLAG_display_sorted_ic_data) { 535 if (FLAG_display_sorted_ic_data) {
533 PrintICDataSortedHelper(f, *ic_data()); 536 PrintICDataSortedHelper(f, *ic_data());
534 } else { 537 } else {
535 PrintICDataHelper(f, *ic_data(), FlowGraphPrinter::kPrintAll); 538 PrintICDataHelper(f, *ic_data(), FlowGraphPrinter::kPrintAll);
536 } 539 }
537 } 540 }
538 } 541 }
539 542
540 543
541 void PolymorphicInstanceCallInstr::PrintOperandsTo(BufferFormatter* f) const { 544 void PolymorphicInstanceCallInstr::PrintOperandsTo(BufferFormatter* f) const {
542 f->Print(" %s", instance_call()->function_name().ToCString()); 545 f->Print(" %s<%" Pd ">", instance_call()->function_name().ToCString(),
546 instance_call()->type_args_len());
543 for (intptr_t i = 0; i < ArgumentCount(); ++i) { 547 for (intptr_t i = 0; i < ArgumentCount(); ++i) {
544 f->Print(", "); 548 f->Print(", ");
545 PushArgumentAt(i)->value()->PrintTo(f); 549 PushArgumentAt(i)->value()->PrintTo(f);
546 } 550 }
547 PrintTargetsHelper(f, targets_, FlowGraphPrinter::kPrintAll); 551 PrintTargetsHelper(f, targets_, FlowGraphPrinter::kPrintAll);
548 if (complete()) { 552 if (complete()) {
549 f->Print(" COMPLETE"); 553 f->Print(" COMPLETE");
550 } 554 }
551 } 555 }
552 556
(...skipping 29 matching lines...) Expand all
582 586
583 587
584 void EqualityCompareInstr::PrintOperandsTo(BufferFormatter* f) const { 588 void EqualityCompareInstr::PrintOperandsTo(BufferFormatter* f) const {
585 left()->PrintTo(f); 589 left()->PrintTo(f);
586 f->Print(" %s ", Token::Str(kind())); 590 f->Print(" %s ", Token::Str(kind()));
587 right()->PrintTo(f); 591 right()->PrintTo(f);
588 } 592 }
589 593
590 594
591 void StaticCallInstr::PrintOperandsTo(BufferFormatter* f) const { 595 void StaticCallInstr::PrintOperandsTo(BufferFormatter* f) const {
592 f->Print(" %s ", String::Handle(function().name()).ToCString()); 596 f->Print(" %s<%" Pd "> ", String::Handle(function().name()).ToCString(),
597 type_args_len());
593 for (intptr_t i = 0; i < ArgumentCount(); ++i) { 598 for (intptr_t i = 0; i < ArgumentCount(); ++i) {
594 if (i > 0) f->Print(", "); 599 if (i > 0) f->Print(", ");
595 PushArgumentAt(i)->value()->PrintTo(f); 600 PushArgumentAt(i)->value()->PrintTo(f);
596 } 601 }
597 } 602 }
598 603
599 604
600 void LoadLocalInstr::PrintOperandsTo(BufferFormatter* f) const { 605 void LoadLocalInstr::PrintOperandsTo(BufferFormatter* f) const {
601 f->Print("%s @%d", local().name().ToCString(), local().index()); 606 f->Print("%s @%d", local().name().ToCString(), local().index());
602 } 607 }
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
645 650
646 651
647 void StoreStaticFieldInstr::PrintOperandsTo(BufferFormatter* f) const { 652 void StoreStaticFieldInstr::PrintOperandsTo(BufferFormatter* f) const {
648 f->Print("%s, ", String::Handle(field().name()).ToCString()); 653 f->Print("%s, ", String::Handle(field().name()).ToCString());
649 value()->PrintTo(f); 654 value()->PrintTo(f);
650 } 655 }
651 656
652 657
653 void InstanceOfInstr::PrintOperandsTo(BufferFormatter* f) const { 658 void InstanceOfInstr::PrintOperandsTo(BufferFormatter* f) const {
654 value()->PrintTo(f); 659 value()->PrintTo(f);
655 f->Print(" IS %s", String::Handle(type().Name()).ToCString()); 660 f->Print(" IS %s,", String::Handle(type().Name()).ToCString());
656 f->Print(" type-arg("); 661 f->Print(" instantiator_type_args(");
657 instantiator_type_arguments()->PrintTo(f); 662 instantiator_type_arguments()->PrintTo(f);
663 f->Print("), function_type_args(");
664 function_type_arguments()->PrintTo(f);
658 f->Print(")"); 665 f->Print(")");
659 } 666 }
660 667
661 668
662 void RelationalOpInstr::PrintOperandsTo(BufferFormatter* f) const { 669 void RelationalOpInstr::PrintOperandsTo(BufferFormatter* f) const {
663 f->Print("%s, ", Token::Str(kind())); 670 f->Print("%s, ", Token::Str(kind()));
664 left()->PrintTo(f); 671 left()->PrintTo(f);
665 f->Print(", "); 672 f->Print(", ");
666 right()->PrintTo(f); 673 right()->PrintTo(f);
667 } 674 }
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
706 f->Print(" [%s %s]", field()->is_nullable() ? "nullable" : "non-nullable", 713 f->Print(" [%s %s]", field()->is_nullable() ? "nullable" : "non-nullable",
707 expected); 714 expected);
708 } 715 }
709 716
710 f->Print(", immutable=%d", immutable_); 717 f->Print(", immutable=%d", immutable_);
711 } 718 }
712 719
713 720
714 void InstantiateTypeInstr::PrintOperandsTo(BufferFormatter* f) const { 721 void InstantiateTypeInstr::PrintOperandsTo(BufferFormatter* f) const {
715 const String& type_name = String::Handle(type().Name()); 722 const String& type_name = String::Handle(type().Name());
716 f->Print("%s, ", type_name.ToCString()); 723 f->Print("%s,", type_name.ToCString());
724 f->Print(" instantiator_type_args(");
717 instantiator_type_arguments()->PrintTo(f); 725 instantiator_type_arguments()->PrintTo(f);
726 f->Print("), function_type_args(");
727 function_type_arguments()->PrintTo(f);
728 f->Print(")");
718 } 729 }
719 730
720 731
721 void InstantiateTypeArgumentsInstr::PrintOperandsTo(BufferFormatter* f) const { 732 void InstantiateTypeArgumentsInstr::PrintOperandsTo(BufferFormatter* f) const {
722 const String& type_args = String::Handle(type_arguments().Name()); 733 const String& type_args = String::Handle(type_arguments().Name());
723 f->Print("%s, ", type_args.ToCString()); 734 f->Print("%s,", type_args.ToCString());
735 f->Print(" instantiator_type_args(");
724 instantiator_type_arguments()->PrintTo(f); 736 instantiator_type_arguments()->PrintTo(f);
737 f->Print("), function_type_args(");
738 function_type_arguments()->PrintTo(f);
739 f->Print(")");
725 } 740 }
726 741
727 742
728 void AllocateContextInstr::PrintOperandsTo(BufferFormatter* f) const { 743 void AllocateContextInstr::PrintOperandsTo(BufferFormatter* f) const {
729 f->Print("%" Pd "", num_context_variables()); 744 f->Print("%" Pd "", num_context_variables());
730 } 745 }
731 746
732 747
733 void AllocateUninitializedContextInstr::PrintOperandsTo( 748 void AllocateUninitializedContextInstr::PrintOperandsTo(
734 BufferFormatter* f) const { 749 BufferFormatter* f) const {
(...skipping 663 matching lines...) Expand 10 before | Expand all | Expand 10 after
1398 } 1413 }
1399 1414
1400 1415
1401 bool FlowGraphPrinter::ShouldPrint(const Function& function) { 1416 bool FlowGraphPrinter::ShouldPrint(const Function& function) {
1402 return false; 1417 return false;
1403 } 1418 }
1404 1419
1405 #endif // !PRODUCT 1420 #endif // !PRODUCT
1406 1421
1407 } // namespace dart 1422 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph_compiler_x64.cc ('k') | runtime/vm/intermediate_language_ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698