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

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

Issue 2781313003: Add kernel_offset to all expressions; Make KernelConstMapKeyEqualsTraits use kernel_offset (Closed)
Patch Set: Removed debug printf Created 3 years, 8 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/kernel.h ('k') | runtime/vm/kernel_to_il.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 (c) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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 #if !defined(DART_PRECOMPILED_RUNTIME) 4 #if !defined(DART_PRECOMPILED_RUNTIME)
5 5
6 #include "vm/kernel_binary.h" 6 #include "vm/kernel_binary.h"
7 #include "platform/globals.h" 7 #include "platform/globals.h"
8 #include "vm/flags.h" 8 #include "vm/flags.h"
9 #include "vm/growable_array.h" 9 #include "vm/growable_array.h"
10 #include "vm/kernel.h" 10 #include "vm/kernel.h"
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 126
127 String* String::ReadFrom(Reader* reader) { 127 String* String::ReadFrom(Reader* reader) {
128 TRACE_READ_OFFSET(); 128 TRACE_READ_OFFSET();
129 return Reference::ReadStringFrom(reader); 129 return Reference::ReadStringFrom(reader);
130 } 130 }
131 131
132 132
133 String* String::ReadFromImpl(Reader* reader) { 133 String* String::ReadFromImpl(Reader* reader) {
134 TRACE_READ_OFFSET(); 134 TRACE_READ_OFFSET();
135 uint32_t bytes = reader->ReadUInt(); 135 uint32_t bytes = reader->ReadUInt();
136 String* string = new String(reader->Consume(bytes), bytes); 136 return new String(reader->Consume(bytes), bytes);
137 return string;
138 } 137 }
139 138
140 void StringTable::ReadFrom(Reader* reader) { 139 void StringTable::ReadFrom(Reader* reader) {
141 strings_.ReadFromStatic<StringImpl>(reader); 140 strings_.ReadFromStatic<StringImpl>(reader);
142 } 141 }
143 142
144 143
145 void SourceTable::ReadFrom(Reader* reader) { 144 void SourceTable::ReadFrom(Reader* reader) {
146 size_ = reader->helper()->program()->source_uri_table().strings().length(); 145 size_ = reader->helper()->program()->source_uri_table().strings().length();
147 source_code_ = new String*[size_]; 146 source_code_ = new String*[size_];
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after
515 InvalidExpression* invalidExpression = new InvalidExpression(); 514 InvalidExpression* invalidExpression = new InvalidExpression();
516 invalidExpression->kernel_offset_ = 515 invalidExpression->kernel_offset_ =
517 reader->offset() - 1; // -1 to include tag byte. 516 reader->offset() - 1; // -1 to include tag byte.
518 return invalidExpression; 517 return invalidExpression;
519 } 518 }
520 519
521 520
522 VariableGet* VariableGet::ReadFrom(Reader* reader) { 521 VariableGet* VariableGet::ReadFrom(Reader* reader) {
523 TRACE_READ_OFFSET(); 522 TRACE_READ_OFFSET();
524 VariableGet* get = new VariableGet(); 523 VariableGet* get = new VariableGet();
524 get->kernel_offset_ = reader->offset() - 1; // -1 to include tag byte.
525 get->position_ = reader->ReadPosition(); 525 get->position_ = reader->ReadPosition();
526 get->variable_ = reader->helper()->variables().Lookup(reader->ReadUInt()); 526 get->variable_ = reader->helper()->variables().Lookup(reader->ReadUInt());
527 reader->ReadOptional<DartType>(); // Unused promoted type. 527 reader->ReadOptional<DartType>(); // Unused promoted type.
528 return get; 528 return get;
529 } 529 }
530 530
531 531
532 VariableGet* VariableGet::ReadFrom(Reader* reader, uint8_t payload) { 532 VariableGet* VariableGet::ReadFrom(Reader* reader, uint8_t payload) {
533 TRACE_READ_OFFSET(); 533 TRACE_READ_OFFSET();
534 VariableGet* get = new VariableGet(); 534 VariableGet* get = new VariableGet();
535 get->kernel_offset_ = reader->offset() - 1; // -1 to include tag byte.
535 get->position_ = reader->ReadPosition(); 536 get->position_ = reader->ReadPosition();
536 get->variable_ = reader->helper()->variables().Lookup(payload); 537 get->variable_ = reader->helper()->variables().Lookup(payload);
537 return get; 538 return get;
538 } 539 }
539 540
540 541
541 VariableSet* VariableSet::ReadFrom(Reader* reader) { 542 VariableSet* VariableSet::ReadFrom(Reader* reader) {
542 TRACE_READ_OFFSET(); 543 TRACE_READ_OFFSET();
543 VariableSet* set = new VariableSet(); 544 VariableSet* set = new VariableSet();
545 set->kernel_offset_ = reader->offset() - 1; // -1 to include tag byte.
544 set->position_ = reader->ReadPosition(); 546 set->position_ = reader->ReadPosition();
545 set->variable_ = reader->helper()->variables().Lookup(reader->ReadUInt()); 547 set->variable_ = reader->helper()->variables().Lookup(reader->ReadUInt());
546 set->expression_ = Expression::ReadFrom(reader); 548 set->expression_ = Expression::ReadFrom(reader);
547 return set; 549 return set;
548 } 550 }
549 551
550 552
551 VariableSet* VariableSet::ReadFrom(Reader* reader, uint8_t payload) { 553 VariableSet* VariableSet::ReadFrom(Reader* reader, uint8_t payload) {
552 TRACE_READ_OFFSET(); 554 TRACE_READ_OFFSET();
553 VariableSet* set = new VariableSet(); 555 VariableSet* set = new VariableSet();
556 set->kernel_offset_ = reader->offset() - 1; // -1 to include tag byte.
554 set->variable_ = reader->helper()->variables().Lookup(payload); 557 set->variable_ = reader->helper()->variables().Lookup(payload);
555 set->position_ = reader->ReadPosition(); 558 set->position_ = reader->ReadPosition();
556 set->expression_ = Expression::ReadFrom(reader); 559 set->expression_ = Expression::ReadFrom(reader);
557 return set; 560 return set;
558 } 561 }
559 562
560 563
561 PropertyGet* PropertyGet::ReadFrom(Reader* reader) { 564 PropertyGet* PropertyGet::ReadFrom(Reader* reader) {
562 TRACE_READ_OFFSET(); 565 TRACE_READ_OFFSET();
563 PropertyGet* get = new PropertyGet(); 566 PropertyGet* get = new PropertyGet();
567 get->kernel_offset_ = reader->offset() - 1; // -1 to include tag byte.
564 get->position_ = reader->ReadPosition(); 568 get->position_ = reader->ReadPosition();
565 get->receiver_ = Expression::ReadFrom(reader); 569 get->receiver_ = Expression::ReadFrom(reader);
566 get->name_ = Name::ReadFrom(reader); 570 get->name_ = Name::ReadFrom(reader);
567 get->interface_target_reference_ = Reference::ReadMemberFrom(reader, true); 571 get->interface_target_reference_ = Reference::ReadMemberFrom(reader, true);
568 return get; 572 return get;
569 } 573 }
570 574
571 575
572 PropertySet* PropertySet::ReadFrom(Reader* reader) { 576 PropertySet* PropertySet::ReadFrom(Reader* reader) {
573 TRACE_READ_OFFSET(); 577 TRACE_READ_OFFSET();
574 PropertySet* set = new PropertySet(); 578 PropertySet* set = new PropertySet();
579 set->kernel_offset_ = reader->offset() - 1; // -1 to include tag byte.
575 set->position_ = reader->ReadPosition(); 580 set->position_ = reader->ReadPosition();
576 set->receiver_ = Expression::ReadFrom(reader); 581 set->receiver_ = Expression::ReadFrom(reader);
577 set->name_ = Name::ReadFrom(reader); 582 set->name_ = Name::ReadFrom(reader);
578 set->value_ = Expression::ReadFrom(reader); 583 set->value_ = Expression::ReadFrom(reader);
579 set->interface_target_reference_ = Reference::ReadMemberFrom(reader, true); 584 set->interface_target_reference_ = Reference::ReadMemberFrom(reader, true);
580 return set; 585 return set;
581 } 586 }
582 587
583 588
584 DirectPropertyGet* DirectPropertyGet::ReadFrom(Reader* reader) { 589 DirectPropertyGet* DirectPropertyGet::ReadFrom(Reader* reader) {
585 TRACE_READ_OFFSET(); 590 TRACE_READ_OFFSET();
586 DirectPropertyGet* get = new DirectPropertyGet(); 591 DirectPropertyGet* get = new DirectPropertyGet();
592 get->kernel_offset_ = reader->offset() - 1; // -1 to include tag byte.
587 get->position_ = reader->ReadPosition(); 593 get->position_ = reader->ReadPosition();
588 get->receiver_ = Expression::ReadFrom(reader); 594 get->receiver_ = Expression::ReadFrom(reader);
589 get->target_reference_ = Reference::ReadMemberFrom(reader); 595 get->target_reference_ = Reference::ReadMemberFrom(reader);
590 return get; 596 return get;
591 } 597 }
592 598
593 599
594 DirectPropertySet* DirectPropertySet::ReadFrom(Reader* reader) { 600 DirectPropertySet* DirectPropertySet::ReadFrom(Reader* reader) {
595 TRACE_READ_OFFSET(); 601 TRACE_READ_OFFSET();
596 DirectPropertySet* set = new DirectPropertySet(); 602 DirectPropertySet* set = new DirectPropertySet();
603 set->kernel_offset_ = reader->offset() - 1; // -1 to include tag byte.
597 set->position_ = reader->ReadPosition(); 604 set->position_ = reader->ReadPosition();
598 set->receiver_ = Expression::ReadFrom(reader); 605 set->receiver_ = Expression::ReadFrom(reader);
599 set->target_reference_ = Reference::ReadMemberFrom(reader); 606 set->target_reference_ = Reference::ReadMemberFrom(reader);
600 set->value_ = Expression::ReadFrom(reader); 607 set->value_ = Expression::ReadFrom(reader);
601 return set; 608 return set;
602 } 609 }
603 610
604 611
605 StaticGet* StaticGet::ReadFrom(Reader* reader) { 612 StaticGet* StaticGet::ReadFrom(Reader* reader) {
606 TRACE_READ_OFFSET(); 613 TRACE_READ_OFFSET();
607 StaticGet* get = new StaticGet(); 614 StaticGet* get = new StaticGet();
615 get->kernel_offset_ = reader->offset() - 1; // -1 to include tag byte.
608 get->position_ = reader->ReadPosition(); 616 get->position_ = reader->ReadPosition();
609 get->target_reference_ = Reference::ReadMemberFrom(reader); 617 get->target_reference_ = Reference::ReadMemberFrom(reader);
610 return get; 618 return get;
611 } 619 }
612 620
613 621
614 StaticSet* StaticSet::ReadFrom(Reader* reader) { 622 StaticSet* StaticSet::ReadFrom(Reader* reader) {
615 TRACE_READ_OFFSET(); 623 TRACE_READ_OFFSET();
616 StaticSet* set = new StaticSet(); 624 StaticSet* set = new StaticSet();
625 set->kernel_offset_ = reader->offset() - 1; // -1 to include tag byte.
617 set->position_ = reader->ReadPosition(); 626 set->position_ = reader->ReadPosition();
618 set->target_reference_ = Reference::ReadMemberFrom(reader); 627 set->target_reference_ = Reference::ReadMemberFrom(reader);
619 set->expression_ = Expression::ReadFrom(reader); 628 set->expression_ = Expression::ReadFrom(reader);
620 return set; 629 return set;
621 } 630 }
622 631
623 632
624 Arguments* Arguments::ReadFrom(Reader* reader) { 633 Arguments* Arguments::ReadFrom(Reader* reader) {
625 TRACE_READ_OFFSET(); 634 TRACE_READ_OFFSET();
626 Arguments* arguments = new Arguments(); 635 Arguments* arguments = new Arguments();
627 arguments->types().ReadFromStatic<DartType>(reader); 636 arguments->types().ReadFromStatic<DartType>(reader);
628 arguments->positional().ReadFromStatic<Expression>(reader); 637 arguments->positional().ReadFromStatic<Expression>(reader);
629 arguments->named().ReadFromStatic<NamedExpression>(reader); 638 arguments->named().ReadFromStatic<NamedExpression>(reader);
630 return arguments; 639 return arguments;
631 } 640 }
632 641
633 642
634 NamedExpression* NamedExpression::ReadFrom(Reader* reader) { 643 NamedExpression* NamedExpression::ReadFrom(Reader* reader) {
635 TRACE_READ_OFFSET(); 644 TRACE_READ_OFFSET();
636 String* name = Reference::ReadStringFrom(reader); 645 String* name = Reference::ReadStringFrom(reader);
637 Expression* expression = Expression::ReadFrom(reader); 646 Expression* expression = Expression::ReadFrom(reader);
638 return new NamedExpression(name, expression); 647 return new NamedExpression(name, expression);
639 } 648 }
640 649
641 650
642 MethodInvocation* MethodInvocation::ReadFrom(Reader* reader) { 651 MethodInvocation* MethodInvocation::ReadFrom(Reader* reader) {
643 TRACE_READ_OFFSET(); 652 TRACE_READ_OFFSET();
644 MethodInvocation* invocation = new MethodInvocation(); 653 MethodInvocation* invocation = new MethodInvocation();
654 invocation->kernel_offset_ = reader->offset() - 1; // -1 to include tag byte.
645 invocation->position_ = reader->ReadPosition(); 655 invocation->position_ = reader->ReadPosition();
646 invocation->receiver_ = Expression::ReadFrom(reader); 656 invocation->receiver_ = Expression::ReadFrom(reader);
647 invocation->name_ = Name::ReadFrom(reader); 657 invocation->name_ = Name::ReadFrom(reader);
648 invocation->arguments_ = Arguments::ReadFrom(reader); 658 invocation->arguments_ = Arguments::ReadFrom(reader);
649 invocation->interface_target_reference_ = 659 invocation->interface_target_reference_ =
650 Reference::ReadMemberFrom(reader, true); 660 Reference::ReadMemberFrom(reader, true);
651 return invocation; 661 return invocation;
652 } 662 }
653 663
654 664
655 DirectMethodInvocation* DirectMethodInvocation::ReadFrom(Reader* reader) { 665 DirectMethodInvocation* DirectMethodInvocation::ReadFrom(Reader* reader) {
656 TRACE_READ_OFFSET(); 666 TRACE_READ_OFFSET();
657 DirectMethodInvocation* invocation = new DirectMethodInvocation(); 667 DirectMethodInvocation* invocation = new DirectMethodInvocation();
668 invocation->kernel_offset_ = reader->offset() - 1; // -1 to include tag byte.
658 invocation->receiver_ = Expression::ReadFrom(reader); 669 invocation->receiver_ = Expression::ReadFrom(reader);
659 invocation->target_reference_ = Reference::ReadMemberFrom(reader); 670 invocation->target_reference_ = Reference::ReadMemberFrom(reader);
660 invocation->arguments_ = Arguments::ReadFrom(reader); 671 invocation->arguments_ = Arguments::ReadFrom(reader);
661 return invocation; 672 return invocation;
662 } 673 }
663 674
664 675
665 StaticInvocation* StaticInvocation::ReadFrom(Reader* reader, bool is_const) { 676 StaticInvocation* StaticInvocation::ReadFrom(Reader* reader, bool is_const) {
666 TRACE_READ_OFFSET(); 677 TRACE_READ_OFFSET();
667 StaticInvocation* invocation = new StaticInvocation(); 678 StaticInvocation* invocation = new StaticInvocation();
679 invocation->kernel_offset_ = reader->offset() - 1; // -1 to include tag byte.
668 invocation->is_const_ = is_const; 680 invocation->is_const_ = is_const;
669 invocation->position_ = reader->ReadPosition(); 681 invocation->position_ = reader->ReadPosition();
670 invocation->procedure_reference_ = Reference::ReadMemberFrom(reader); 682 invocation->procedure_reference_ = Reference::ReadMemberFrom(reader);
671 invocation->arguments_ = Arguments::ReadFrom(reader); 683 invocation->arguments_ = Arguments::ReadFrom(reader);
672 return invocation; 684 return invocation;
673 } 685 }
674 686
675 687
676 ConstructorInvocation* ConstructorInvocation::ReadFrom(Reader* reader, 688 ConstructorInvocation* ConstructorInvocation::ReadFrom(Reader* reader,
677 bool is_const) { 689 bool is_const) {
678 TRACE_READ_OFFSET(); 690 TRACE_READ_OFFSET();
679 ConstructorInvocation* invocation = new ConstructorInvocation(); 691 ConstructorInvocation* invocation = new ConstructorInvocation();
692 invocation->kernel_offset_ = reader->offset() - 1; // -1 to include tag byte.
680 invocation->is_const_ = is_const; 693 invocation->is_const_ = is_const;
681 invocation->position_ = reader->ReadPosition(); 694 invocation->position_ = reader->ReadPosition();
682 invocation->target_reference_ = Reference::ReadMemberFrom(reader); 695 invocation->target_reference_ = Reference::ReadMemberFrom(reader);
683 invocation->arguments_ = Arguments::ReadFrom(reader); 696 invocation->arguments_ = Arguments::ReadFrom(reader);
684 return invocation; 697 return invocation;
685 } 698 }
686 699
687 700
688 Not* Not::ReadFrom(Reader* reader) { 701 Not* Not::ReadFrom(Reader* reader) {
689 TRACE_READ_OFFSET(); 702 TRACE_READ_OFFSET();
690 Not* n = new Not(); 703 Not* n = new Not();
704 n->kernel_offset_ = reader->offset() - 1; // -1 to include tag byte.
691 n->expression_ = Expression::ReadFrom(reader); 705 n->expression_ = Expression::ReadFrom(reader);
692 return n; 706 return n;
693 } 707 }
694 708
695 709
696 LogicalExpression* LogicalExpression::ReadFrom(Reader* reader) { 710 LogicalExpression* LogicalExpression::ReadFrom(Reader* reader) {
697 TRACE_READ_OFFSET(); 711 TRACE_READ_OFFSET();
698 LogicalExpression* expr = new LogicalExpression(); 712 LogicalExpression* expr = new LogicalExpression();
713 expr->kernel_offset_ = reader->offset() - 1; // -1 to include tag byte.
699 expr->left_ = Expression::ReadFrom(reader); 714 expr->left_ = Expression::ReadFrom(reader);
700 expr->operator_ = static_cast<Operator>(reader->ReadByte()); 715 expr->operator_ = static_cast<Operator>(reader->ReadByte());
701 expr->right_ = Expression::ReadFrom(reader); 716 expr->right_ = Expression::ReadFrom(reader);
702 return expr; 717 return expr;
703 } 718 }
704 719
705 720
706 ConditionalExpression* ConditionalExpression::ReadFrom(Reader* reader) { 721 ConditionalExpression* ConditionalExpression::ReadFrom(Reader* reader) {
707 TRACE_READ_OFFSET(); 722 TRACE_READ_OFFSET();
708 ConditionalExpression* expr = new ConditionalExpression(); 723 ConditionalExpression* expr = new ConditionalExpression();
724 expr->kernel_offset_ = reader->offset() - 1; // -1 to include tag byte.
709 expr->condition_ = Expression::ReadFrom(reader); 725 expr->condition_ = Expression::ReadFrom(reader);
710 expr->then_ = Expression::ReadFrom(reader); 726 expr->then_ = Expression::ReadFrom(reader);
711 expr->otherwise_ = Expression::ReadFrom(reader); 727 expr->otherwise_ = Expression::ReadFrom(reader);
712 reader->ReadOptional<DartType>(); // Unused static type. 728 reader->ReadOptional<DartType>(); // Unused static type.
713 return expr; 729 return expr;
714 } 730 }
715 731
716 732
717 StringConcatenation* StringConcatenation::ReadFrom(Reader* reader) { 733 StringConcatenation* StringConcatenation::ReadFrom(Reader* reader) {
718 TRACE_READ_OFFSET(); 734 TRACE_READ_OFFSET();
719 StringConcatenation* concat = new StringConcatenation(); 735 StringConcatenation* concat = new StringConcatenation();
736 concat->kernel_offset_ = reader->offset() - 1; // -1 to include tag byte.
720 concat->position_ = reader->ReadPosition(); 737 concat->position_ = reader->ReadPosition();
721 concat->expressions_.ReadFromStatic<Expression>(reader); 738 concat->expressions_.ReadFromStatic<Expression>(reader);
722 return concat; 739 return concat;
723 } 740 }
724 741
725 742
726 IsExpression* IsExpression::ReadFrom(Reader* reader) { 743 IsExpression* IsExpression::ReadFrom(Reader* reader) {
727 TRACE_READ_OFFSET(); 744 TRACE_READ_OFFSET();
728 IsExpression* expr = new IsExpression(); 745 IsExpression* expr = new IsExpression();
746 expr->kernel_offset_ = reader->offset() - 1; // -1 to include tag byte.
729 expr->position_ = reader->ReadPosition(); 747 expr->position_ = reader->ReadPosition();
730 expr->operand_ = Expression::ReadFrom(reader); 748 expr->operand_ = Expression::ReadFrom(reader);
731 expr->type_ = DartType::ReadFrom(reader); 749 expr->type_ = DartType::ReadFrom(reader);
732 return expr; 750 return expr;
733 } 751 }
734 752
735 753
736 AsExpression* AsExpression::ReadFrom(Reader* reader) { 754 AsExpression* AsExpression::ReadFrom(Reader* reader) {
737 TRACE_READ_OFFSET(); 755 TRACE_READ_OFFSET();
738 AsExpression* expr = new AsExpression(); 756 AsExpression* expr = new AsExpression();
757 expr->kernel_offset_ = reader->offset() - 1; // -1 to include tag byte.
739 expr->position_ = reader->ReadPosition(); 758 expr->position_ = reader->ReadPosition();
740 expr->operand_ = Expression::ReadFrom(reader); 759 expr->operand_ = Expression::ReadFrom(reader);
741 expr->type_ = DartType::ReadFrom(reader); 760 expr->type_ = DartType::ReadFrom(reader);
742 return expr; 761 return expr;
743 } 762 }
744 763
745 764
746 StringLiteral* StringLiteral::ReadFrom(Reader* reader) { 765 StringLiteral* StringLiteral::ReadFrom(Reader* reader) {
747 TRACE_READ_OFFSET(); 766 TRACE_READ_OFFSET();
748 intptr_t offset = reader->offset() - 1; // -1 to include tag byte. 767 intptr_t offset = reader->offset() - 1; // -1 to include tag byte.
749 StringLiteral* lit = new StringLiteral(Reference::ReadStringFrom(reader)); 768 StringLiteral* lit = new StringLiteral(Reference::ReadStringFrom(reader));
750 lit->kernel_offset_ = offset; 769 lit->kernel_offset_ = offset;
751 return lit; 770 return lit;
752 } 771 }
753 772
754 773
755 BigintLiteral* BigintLiteral::ReadFrom(Reader* reader) { 774 BigintLiteral* BigintLiteral::ReadFrom(Reader* reader) {
756 TRACE_READ_OFFSET(); 775 TRACE_READ_OFFSET();
757 return new BigintLiteral(Reference::ReadStringFrom(reader)); 776 intptr_t offset = reader->offset() - 1; // -1 to include tag byte.
777 BigintLiteral* lit = new BigintLiteral(Reference::ReadStringFrom(reader));
778 lit->kernel_offset_ = offset;
779 return lit;
758 } 780 }
759 781
760 782
761 IntLiteral* IntLiteral::ReadFrom(Reader* reader, bool is_negative) { 783 IntLiteral* IntLiteral::ReadFrom(Reader* reader, bool is_negative) {
762 TRACE_READ_OFFSET(); 784 TRACE_READ_OFFSET();
763 IntLiteral* literal = new IntLiteral(); 785 IntLiteral* literal = new IntLiteral();
764 literal->kernel_offset_ = reader->offset() - 1; // -1 to include tag byte. 786 literal->kernel_offset_ = reader->offset() - 1; // -1 to include tag byte.
765 literal->value_ = is_negative ? -static_cast<int64_t>(reader->ReadUInt()) 787 literal->value_ = is_negative ? -static_cast<int64_t>(reader->ReadUInt())
766 : reader->ReadUInt(); 788 : reader->ReadUInt();
767 return literal; 789 return literal;
768 } 790 }
769 791
770 792
771 IntLiteral* IntLiteral::ReadFrom(Reader* reader, uint8_t payload) { 793 IntLiteral* IntLiteral::ReadFrom(Reader* reader, uint8_t payload) {
772 TRACE_READ_OFFSET(); 794 TRACE_READ_OFFSET();
773 IntLiteral* literal = new IntLiteral(); 795 IntLiteral* literal = new IntLiteral();
774 literal->kernel_offset_ = reader->offset() - 1; // -1 to include tag byte. 796 literal->kernel_offset_ = reader->offset() - 1; // -1 to include tag byte.
775 literal->value_ = static_cast<int32_t>(payload) - SpecializedIntLiteralBias; 797 literal->value_ = static_cast<int32_t>(payload) - SpecializedIntLiteralBias;
776 return literal; 798 return literal;
777 } 799 }
778 800
779 801
780 DoubleLiteral* DoubleLiteral::ReadFrom(Reader* reader) { 802 DoubleLiteral* DoubleLiteral::ReadFrom(Reader* reader) {
781 TRACE_READ_OFFSET(); 803 TRACE_READ_OFFSET();
782 DoubleLiteral* literal = new DoubleLiteral(); 804 DoubleLiteral* literal = new DoubleLiteral();
805 literal->kernel_offset_ = reader->offset() - 1; // -1 to include tag byte.
783 literal->value_ = Reference::ReadStringFrom(reader); 806 literal->value_ = Reference::ReadStringFrom(reader);
784 return literal; 807 return literal;
785 } 808 }
786 809
787 810
788 BoolLiteral* BoolLiteral::ReadFrom(Reader* reader, bool value) { 811 BoolLiteral* BoolLiteral::ReadFrom(Reader* reader, bool value) {
789 TRACE_READ_OFFSET(); 812 TRACE_READ_OFFSET();
790 BoolLiteral* lit = new BoolLiteral(); 813 BoolLiteral* lit = new BoolLiteral();
791 lit->kernel_offset_ = reader->offset() - 1; // -1 to include tag byte. 814 lit->kernel_offset_ = reader->offset() - 1; // -1 to include tag byte.
792 lit->value_ = value; 815 lit->value_ = value;
793 return lit; 816 return lit;
794 } 817 }
795 818
796 819
797 NullLiteral* NullLiteral::ReadFrom(Reader* reader) { 820 NullLiteral* NullLiteral::ReadFrom(Reader* reader) {
798 TRACE_READ_OFFSET(); 821 TRACE_READ_OFFSET();
799 NullLiteral* lit = new NullLiteral(); 822 NullLiteral* lit = new NullLiteral();
800 lit->kernel_offset_ = reader->offset() - 1; // -1 to include tag byte. 823 lit->kernel_offset_ = reader->offset() - 1; // -1 to include tag byte.
801 return lit; 824 return lit;
802 } 825 }
803 826
804 827
805 SymbolLiteral* SymbolLiteral::ReadFrom(Reader* reader) { 828 SymbolLiteral* SymbolLiteral::ReadFrom(Reader* reader) {
806 TRACE_READ_OFFSET(); 829 TRACE_READ_OFFSET();
807 SymbolLiteral* lit = new SymbolLiteral(); 830 SymbolLiteral* lit = new SymbolLiteral();
831 lit->kernel_offset_ = reader->offset() - 1; // -1 to include tag byte.
808 lit->value_ = Reference::ReadStringFrom(reader); 832 lit->value_ = Reference::ReadStringFrom(reader);
809 return lit; 833 return lit;
810 } 834 }
811 835
812 836
813 TypeLiteral* TypeLiteral::ReadFrom(Reader* reader) { 837 TypeLiteral* TypeLiteral::ReadFrom(Reader* reader) {
814 TRACE_READ_OFFSET(); 838 TRACE_READ_OFFSET();
815 TypeLiteral* literal = new TypeLiteral(); 839 TypeLiteral* literal = new TypeLiteral();
840 literal->kernel_offset_ = reader->offset() - 1; // -1 to include tag byte.
816 literal->type_ = DartType::ReadFrom(reader); 841 literal->type_ = DartType::ReadFrom(reader);
817 return literal; 842 return literal;
818 } 843 }
819 844
820 845
821 ThisExpression* ThisExpression::ReadFrom(Reader* reader) { 846 ThisExpression* ThisExpression::ReadFrom(Reader* reader) {
822 TRACE_READ_OFFSET(); 847 TRACE_READ_OFFSET();
823 ThisExpression* this_expr = new ThisExpression(); 848 ThisExpression* this_expr = new ThisExpression();
824 this_expr->kernel_offset_ = reader->offset() - 1; // -1 to include tag byte. 849 this_expr->kernel_offset_ = reader->offset() - 1; // -1 to include tag byte.
825 return this_expr; 850 return this_expr;
826 } 851 }
827 852
828 853
829 Rethrow* Rethrow::ReadFrom(Reader* reader) { 854 Rethrow* Rethrow::ReadFrom(Reader* reader) {
830 TRACE_READ_OFFSET(); 855 TRACE_READ_OFFSET();
831 Rethrow* rethrow = new Rethrow(); 856 Rethrow* rethrow = new Rethrow();
832 rethrow->kernel_offset_ = reader->offset() - 1; // -1 to include tag byte. 857 rethrow->kernel_offset_ = reader->offset() - 1; // -1 to include tag byte.
833 rethrow->position_ = reader->ReadPosition(); 858 rethrow->position_ = reader->ReadPosition();
834 return rethrow; 859 return rethrow;
835 } 860 }
836 861
837 862
838 Throw* Throw::ReadFrom(Reader* reader) { 863 Throw* Throw::ReadFrom(Reader* reader) {
839 TRACE_READ_OFFSET(); 864 TRACE_READ_OFFSET();
840 Throw* t = new Throw(); 865 Throw* t = new Throw();
866 t->kernel_offset_ = reader->offset() - 1; // -1 to include tag byte.
841 t->position_ = reader->ReadPosition(); 867 t->position_ = reader->ReadPosition();
842 t->expression_ = Expression::ReadFrom(reader); 868 t->expression_ = Expression::ReadFrom(reader);
843 return t; 869 return t;
844 } 870 }
845 871
846 872
847 ListLiteral* ListLiteral::ReadFrom(Reader* reader, bool is_const) { 873 ListLiteral* ListLiteral::ReadFrom(Reader* reader, bool is_const) {
848 TRACE_READ_OFFSET(); 874 TRACE_READ_OFFSET();
849 ListLiteral* literal = new ListLiteral(); 875 ListLiteral* literal = new ListLiteral();
876 literal->kernel_offset_ = reader->offset() - 1; // -1 to include tag byte.
850 literal->is_const_ = is_const; 877 literal->is_const_ = is_const;
851 literal->position_ = reader->ReadPosition(); 878 literal->position_ = reader->ReadPosition();
852 literal->type_ = DartType::ReadFrom(reader); 879 literal->type_ = DartType::ReadFrom(reader);
853 literal->expressions_.ReadFromStatic<Expression>(reader); 880 literal->expressions_.ReadFromStatic<Expression>(reader);
854 return literal; 881 return literal;
855 } 882 }
856 883
857 884
858 MapLiteral* MapLiteral::ReadFrom(Reader* reader, bool is_const) { 885 MapLiteral* MapLiteral::ReadFrom(Reader* reader, bool is_const) {
859 TRACE_READ_OFFSET(); 886 TRACE_READ_OFFSET();
860 MapLiteral* literal = new MapLiteral(); 887 MapLiteral* literal = new MapLiteral();
888 literal->kernel_offset_ = reader->offset() - 1; // -1 to include tag byte.
861 literal->is_const_ = is_const; 889 literal->is_const_ = is_const;
862 literal->position_ = reader->ReadPosition(); 890 literal->position_ = reader->ReadPosition();
863 literal->key_type_ = DartType::ReadFrom(reader); 891 literal->key_type_ = DartType::ReadFrom(reader);
864 literal->value_type_ = DartType::ReadFrom(reader); 892 literal->value_type_ = DartType::ReadFrom(reader);
865 literal->entries_.ReadFromStatic<MapEntry>(reader); 893 literal->entries_.ReadFromStatic<MapEntry>(reader);
866 return literal; 894 return literal;
867 } 895 }
868 896
869 897
870 MapEntry* MapEntry::ReadFrom(Reader* reader) { 898 MapEntry* MapEntry::ReadFrom(Reader* reader) {
871 MapEntry* entry = new MapEntry(); 899 MapEntry* entry = new MapEntry();
872 entry->key_ = Expression::ReadFrom(reader); 900 entry->key_ = Expression::ReadFrom(reader);
873 entry->value_ = Expression::ReadFrom(reader); 901 entry->value_ = Expression::ReadFrom(reader);
874 return entry; 902 return entry;
875 } 903 }
876 904
877 905
878 AwaitExpression* AwaitExpression::ReadFrom(Reader* reader) { 906 AwaitExpression* AwaitExpression::ReadFrom(Reader* reader) {
879 TRACE_READ_OFFSET(); 907 TRACE_READ_OFFSET();
880 AwaitExpression* await = new AwaitExpression(); 908 AwaitExpression* await = new AwaitExpression();
909 await->kernel_offset_ = reader->offset() - 1; // -1 to include tag byte.
881 await->operand_ = Expression::ReadFrom(reader); 910 await->operand_ = Expression::ReadFrom(reader);
882 return await; 911 return await;
883 } 912 }
884 913
885 914
886 FunctionExpression* FunctionExpression::ReadFrom(Reader* reader) { 915 FunctionExpression* FunctionExpression::ReadFrom(Reader* reader) {
887 TRACE_READ_OFFSET(); 916 TRACE_READ_OFFSET();
888 VariableScope<ReaderHelper> parameters(reader->helper()); 917 VariableScope<ReaderHelper> parameters(reader->helper());
889 FunctionExpression* expr = new FunctionExpression(); 918 FunctionExpression* expr = new FunctionExpression();
890 expr->kernel_offset_ = reader->offset() - 1; // -1 to include tag byte. 919 expr->kernel_offset_ = reader->offset() - 1; // -1 to include tag byte.
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after
1234 decl->kernel_offset_ = reader->offset() - 1; // -1 to include tag byte. 1263 decl->kernel_offset_ = reader->offset() - 1; // -1 to include tag byte.
1235 decl->position_ = reader->ReadPosition(); 1264 decl->position_ = reader->ReadPosition();
1236 decl->variable_ = VariableDeclaration::ReadFromImpl(reader, false); 1265 decl->variable_ = VariableDeclaration::ReadFromImpl(reader, false);
1237 VariableScope<ReaderHelper> parameters(reader->helper()); 1266 VariableScope<ReaderHelper> parameters(reader->helper());
1238 decl->function_ = FunctionNode::ReadFrom(reader); 1267 decl->function_ = FunctionNode::ReadFrom(reader);
1239 return decl; 1268 return decl;
1240 } 1269 }
1241 1270
1242 1271
1243 Name* Name::ReadFrom(Reader* reader) { 1272 Name* Name::ReadFrom(Reader* reader) {
1244 String* string = Reference::ReadStringFrom(reader); 1273 String* name = Reference::ReadStringFrom(reader);
1245 if (string->size() >= 1 && string->buffer()[0] == '_') { 1274 if (name->size() >= 1 && name->buffer()[0] == '_') {
1246 CanonicalName* library_reference = reader->ReadCanonicalNameReference(); 1275 CanonicalName* library_reference = reader->ReadCanonicalNameReference();
1247 return new Name(string, library_reference); 1276 return new Name(name, library_reference);
1248 } else { 1277 } else {
1249 return new Name(string, NULL); 1278 return new Name(name, NULL);
1250 } 1279 }
1251 } 1280 }
1252 1281
1253 1282
1254 DartType* DartType::ReadFrom(Reader* reader) { 1283 DartType* DartType::ReadFrom(Reader* reader) {
1255 TRACE_READ_OFFSET(); 1284 TRACE_READ_OFFSET();
1256 Tag tag = reader->ReadTag(); 1285 Tag tag = reader->ReadTag();
1257 switch (tag) { 1286 switch (tag) {
1258 case kInvalidType: 1287 case kInvalidType:
1259 return InvalidType::ReadFrom(reader); 1288 return InvalidType::ReadFrom(reader);
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
1440 1469
1441 kernel::Program* ReadPrecompiledKernelFromBuffer(const uint8_t* buffer, 1470 kernel::Program* ReadPrecompiledKernelFromBuffer(const uint8_t* buffer,
1442 intptr_t buffer_length) { 1471 intptr_t buffer_length) {
1443 kernel::Reader reader(buffer, buffer_length); 1472 kernel::Reader reader(buffer, buffer_length);
1444 return kernel::Program::ReadFrom(&reader); 1473 return kernel::Program::ReadFrom(&reader);
1445 } 1474 }
1446 1475
1447 1476
1448 } // namespace dart 1477 } // namespace dart
1449 #endif // !defined(DART_PRECOMPILED_RUNTIME) 1478 #endif // !defined(DART_PRECOMPILED_RUNTIME)
OLDNEW
« no previous file with comments | « runtime/vm/kernel.h ('k') | runtime/vm/kernel_to_il.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698