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

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

Issue 12529008: Collect type feedback for fields. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 9 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 (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/intermediate_language.h" 7 #include "vm/intermediate_language.h"
8 #include "vm/os.h" 8 #include "vm/os.h"
9 #include "vm/parser.h" 9 #include "vm/parser.h"
10 10
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 value()->PrintTo(f); 389 value()->PrintTo(f);
390 f->Print(", lvl: %"Pd"", context_level()); 390 f->Print(", lvl: %"Pd"", context_level());
391 } 391 }
392 392
393 393
394 void NativeCallInstr::PrintOperandsTo(BufferFormatter* f) const { 394 void NativeCallInstr::PrintOperandsTo(BufferFormatter* f) const {
395 f->Print("%s", native_name().ToCString()); 395 f->Print("%s", native_name().ToCString());
396 } 396 }
397 397
398 398
399 void GuardFieldInstr::PrintOperandsTo(BufferFormatter* f) const {
400 const char* expected = "?";
401 if (field().guarded_cid() != kIllegalCid) {
402 const Class& cls = Class::Handle(
403 Isolate::Current()->class_table()->At(field().guarded_cid()));
404 expected = String::Handle(cls.Name()).ToCString();
405 }
406
407 f->Print("%s [%s %s], ",
408 String::Handle(field().name()).ToCString(),
409 field().is_nullable() ? "nullable" : "non-nullable",
410 expected);
411 value()->PrintTo(f);
412 }
413
414
399 void StoreInstanceFieldInstr::PrintOperandsTo(BufferFormatter* f) const { 415 void StoreInstanceFieldInstr::PrintOperandsTo(BufferFormatter* f) const {
400 f->Print("%s {%"Pd"}, ", 416 f->Print("%s {%"Pd"}, ",
401 String::Handle(field().name()).ToCString(), 417 String::Handle(field().name()).ToCString(),
402 field().Offset()); 418 field().Offset());
403 instance()->PrintTo(f); 419 instance()->PrintTo(f);
404 f->Print(", "); 420 f->Print(", ");
405 value()->PrintTo(f); 421 value()->PrintTo(f);
406 } 422 }
407 423
408 424
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
475 f->Print("%s", function().ToCString()); 491 f->Print("%s", function().ToCString());
476 for (intptr_t i = 0; i < ArgumentCount(); ++i) { 492 for (intptr_t i = 0; i < ArgumentCount(); ++i) {
477 if (i > 0) f->Print(", "); 493 if (i > 0) f->Print(", ");
478 PushArgumentAt(i)->value()->PrintTo(f); 494 PushArgumentAt(i)->value()->PrintTo(f);
479 } 495 }
480 } 496 }
481 497
482 498
483 void LoadFieldInstr::PrintOperandsTo(BufferFormatter* f) const { 499 void LoadFieldInstr::PrintOperandsTo(BufferFormatter* f) const {
484 value()->PrintTo(f); 500 value()->PrintTo(f);
485 f->Print(", %"Pd", immutable=%d", offset_in_bytes(), immutable_); 501 f->Print(", %"Pd, offset_in_bytes());
502
503 if (field_name_ != NULL) {
504 f->Print(" {%s}", field_name_);
505 }
506
507 if (field() != NULL) {
508 const char* expected = "?";
509 if (field()->guarded_cid() != kIllegalCid) {
510 const Class& cls = Class::Handle(
511 Isolate::Current()->class_table()->At(field()->guarded_cid()));
512 expected = String::Handle(cls.Name()).ToCString();
513 }
514
515 f->Print(" [%s %s]",
516 field()->is_nullable() ? "nullable" : "non-nullable",
517 expected);
518 }
519
520 f->Print(", immutable=%d", immutable_);
486 } 521 }
487 522
488 523
489 void StoreVMFieldInstr::PrintOperandsTo(BufferFormatter* f) const { 524 void StoreVMFieldInstr::PrintOperandsTo(BufferFormatter* f) const {
490 dest()->PrintTo(f); 525 dest()->PrintTo(f);
491 f->Print(", %"Pd", ", offset_in_bytes()); 526 f->Print(", %"Pd", ", offset_in_bytes());
492 value()->PrintTo(f); 527 value()->PrintTo(f);
493 } 528 }
494 529
495 530
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
567 602
568 void UnarySmiOpInstr::PrintOperandsTo(BufferFormatter* f) const { 603 void UnarySmiOpInstr::PrintOperandsTo(BufferFormatter* f) const {
569 f->Print("%s, ", Token::Str(op_kind())); 604 f->Print("%s, ", Token::Str(op_kind()));
570 value()->PrintTo(f); 605 value()->PrintTo(f);
571 } 606 }
572 607
573 608
574 void CheckClassInstr::PrintOperandsTo(BufferFormatter* f) const { 609 void CheckClassInstr::PrintOperandsTo(BufferFormatter* f) const {
575 value()->PrintTo(f); 610 value()->PrintTo(f);
576 PrintICData(f, unary_checks()); 611 PrintICData(f, unary_checks());
612 if (null_check()) {
613 f->Print(" nullcheck");
614 }
577 } 615 }
578 616
579 617
580 void InvokeMathCFunctionInstr::PrintOperandsTo(BufferFormatter* f) const { 618 void InvokeMathCFunctionInstr::PrintOperandsTo(BufferFormatter* f) const {
581 f->Print("%s, ", MethodRecognizer::KindToCString(recognized_kind_)); 619 f->Print("%s, ", MethodRecognizer::KindToCString(recognized_kind_));
582 Definition::PrintOperandsTo(f); 620 Definition::PrintOperandsTo(f);
583 } 621 }
584 622
585 623
586 void GraphEntryInstr::PrintTo(BufferFormatter* f) const { 624 void GraphEntryInstr::PrintTo(BufferFormatter* f) const {
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
713 f->Print(" ["); 751 f->Print(" [");
714 locations_[i].PrintTo(f); 752 locations_[i].PrintTo(f);
715 f->Print("]"); 753 f->Print("]");
716 } 754 }
717 } 755 }
718 f->Print(" }"); 756 f->Print(" }");
719 if (outer_ != NULL) outer_->PrintTo(f); 757 if (outer_ != NULL) outer_->PrintTo(f);
720 } 758 }
721 759
722 } // namespace dart 760 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698