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

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

Issue 1938653002: JIT precompilated snapshots. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 7 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
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/native_entry.h" 5 #include "vm/native_entry.h"
6 #include "vm/object.h" 6 #include "vm/object.h"
7 #include "vm/object_store.h" 7 #include "vm/object_store.h"
8 #include "vm/snapshot.h" 8 #include "vm/snapshot.h"
9 #include "vm/stub_code.h" 9 #include "vm/stub_code.h"
10 #include "vm/symbols.h" 10 #include "vm/symbols.h"
(...skipping 626 matching lines...) Expand 10 before | Expand all | Expand 10 after
637 // Write out the serialization header value for this object. 637 // Write out the serialization header value for this object.
638 writer->WriteInlinedObjectHeader(object_id); 638 writer->WriteInlinedObjectHeader(object_id);
639 639
640 // Write out the class and tags information. 640 // Write out the class and tags information.
641 writer->WriteVMIsolateObject(kClosureDataCid); 641 writer->WriteVMIsolateObject(kClosureDataCid);
642 writer->WriteTags(writer->GetObjectTags(this)); 642 writer->WriteTags(writer->GetObjectTags(this));
643 643
644 // Context scope. 644 // Context scope.
645 if (ptr()->context_scope_ == Object::empty_context_scope().raw()) { 645 if (ptr()->context_scope_ == Object::empty_context_scope().raw()) {
646 writer->WriteVMIsolateObject(kEmptyContextScopeObject); 646 writer->WriteVMIsolateObject(kEmptyContextScopeObject);
647 } else if (ptr()->context_scope_->ptr()->is_implicit_ ||
648 (kind == Snapshot::kAppWithJIT)) {
649 writer->WriteObjectImpl(ptr()->context_scope_, kAsInlinedObject);
647 } else { 650 } else {
648 if (ptr()->context_scope_->ptr()->is_implicit_) { 651 // We don't write non implicit context scopes in the snapshot.
649 writer->WriteObjectImpl(ptr()->context_scope_, kAsInlinedObject); 652 writer->WriteVMIsolateObject(kNullObject);
650 } else {
651 // We don't write non implicit context scopes in the snapshot.
652 writer->WriteVMIsolateObject(kNullObject);
653 }
654 } 653 }
655 654
656 // Parent function. 655 // Parent function.
657 writer->WriteObjectImpl(ptr()->parent_function_, kAsInlinedObject); 656 writer->WriteObjectImpl(ptr()->parent_function_, kAsInlinedObject);
658 657
659 // Signature type. 658 // Signature type.
660 writer->WriteObjectImpl(ptr()->signature_type_, kAsInlinedObject); 659 writer->WriteObjectImpl(ptr()->signature_type_, kAsInlinedObject);
661 660
662 // Canonical static closure. 661 // Canonical static closure.
663 writer->WriteObjectImpl(ptr()->closure_, kAsInlinedObject); 662 writer->WriteObjectImpl(ptr()->closure_, kAsInlinedObject);
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
723 722
724 // Set all the non object fields. Read the token positions now but 723 // Set all the non object fields. Read the token positions now but
725 // don't set them until after setting the kind. 724 // don't set them until after setting the kind.
726 const int32_t token_pos = reader->Read<int32_t>(); 725 const int32_t token_pos = reader->Read<int32_t>();
727 const int32_t end_token_pos = reader->Read<uint32_t>(); 726 const int32_t end_token_pos = reader->Read<uint32_t>();
728 func.set_num_fixed_parameters(reader->Read<int16_t>()); 727 func.set_num_fixed_parameters(reader->Read<int16_t>());
729 func.set_num_optional_parameters(reader->Read<int16_t>()); 728 func.set_num_optional_parameters(reader->Read<int16_t>());
730 func.set_kind_tag(reader->Read<uint32_t>()); 729 func.set_kind_tag(reader->Read<uint32_t>());
731 func.set_token_pos(TokenPosition::SnapshotDecode(token_pos)); 730 func.set_token_pos(TokenPosition::SnapshotDecode(token_pos));
732 func.set_end_token_pos(TokenPosition::SnapshotDecode(end_token_pos)); 731 func.set_end_token_pos(TokenPosition::SnapshotDecode(end_token_pos));
733 if (Snapshot::IncludesCode(kind)) { 732 if (kind == Snapshot::kAppNoJIT) {
734 func.set_usage_counter(0); 733 func.set_usage_counter(0);
735 func.set_deoptimization_counter(0); 734 func.set_deoptimization_counter(0);
736 func.set_optimized_instruction_count(0); 735 func.set_optimized_instruction_count(0);
737 func.set_optimized_call_site_count(0); 736 func.set_optimized_call_site_count(0);
738 } else { 737 } else {
739 func.set_usage_counter(reader->Read<int32_t>()); 738 func.set_usage_counter(reader->Read<int32_t>());
740 func.set_deoptimization_counter(reader->Read<int8_t>()); 739 func.set_deoptimization_counter(reader->Read<int8_t>());
741 func.set_optimized_instruction_count(reader->Read<uint16_t>()); 740 func.set_optimized_instruction_count(reader->Read<uint16_t>());
742 func.set_optimized_call_site_count(reader->Read<uint16_t>()); 741 func.set_optimized_call_site_count(reader->Read<uint16_t>());
743 } 742 }
744 func.set_was_compiled(false); 743 func.set_was_compiled(false);
745 744
746 // Set all the object fields. 745 // Set all the object fields.
747 READ_OBJECT_FIELDS(func, 746 READ_OBJECT_FIELDS(func,
748 func.raw()->from(), func.raw()->to_snapshot(), 747 func.raw()->from(), func.raw()->to_snapshot(),
749 kAsReference); 748 kAsReference);
750 // Initialize all fields that are not part of the snapshot. 749 // Initialize all fields that are not part of the snapshot.
751 if (Snapshot::IncludesCode(kind)) { 750 if (kind == Snapshot::kAppNoJIT) {
752 func.ClearICDataArray(); 751 func.ClearICDataArray();
753 func.ClearCode(); 752 func.ClearCode();
754 // Read the code object and fixup entry point. 753 // Read the code object and fixup entry point.
755 (*reader->CodeHandle()) ^= reader->ReadObjectImpl(kAsInlinedObject); 754 (*reader->CodeHandle()) ^= reader->ReadObjectImpl(kAsInlinedObject);
756 func.SetInstructions(*reader->CodeHandle()); 755 func.SetInstructions(*reader->CodeHandle());
756 } else if (kind == Snapshot::kAppWithJIT) {
757 func.ClearICDataArray();
siva 2016/05/05 00:08:32 why do you have to clear the IC data array here we
rmacnak 2016/05/05 01:47:03 ClearICData satisfied assert in ClearCode below.
758 func.ClearCode();
siva 2016/05/05 00:08:32 Ditto question about ClearCode can we do it condit
rmacnak 2016/05/05 01:47:03 Yes, that works.
759 (*reader->ArrayHandle()) ^= reader->ReadObjectImpl(kAsReference);
760 func.set_ic_data_array(*reader->ArrayHandle());
761 (*reader->CodeHandle()) ^= reader->ReadObjectImpl(kAsInlinedObject);
762 func.set_unoptimized_code(*reader->CodeHandle());
763 if (!reader->CodeHandle()->IsNull()) {
764 func.SetInstructions(*reader->CodeHandle());
765 func.set_was_compiled(true);
766 }
757 } else { 767 } else {
758 bool is_optimized = func.usage_counter() != 0; 768 bool is_optimized = func.usage_counter() != 0;
759 if (is_optimized) { 769 if (is_optimized) {
760 // Read the ic data array as the function is an optimized one. 770 // Read the ic data array as the function is an optimized one.
761 (*reader->ArrayHandle()) ^= reader->ReadObjectImpl(kAsReference); 771 (*reader->ArrayHandle()) ^= reader->ReadObjectImpl(kAsReference);
762 func.set_ic_data_array(*reader->ArrayHandle()); 772 func.set_ic_data_array(*reader->ArrayHandle());
763 } else { 773 } else {
764 func.ClearICDataArray(); 774 func.ClearICDataArray();
765 } 775 }
766 func.ClearCode(); 776 func.ClearCode();
(...skipping 10 matching lines...) Expand all
777 Snapshot::Kind kind, 787 Snapshot::Kind kind,
778 bool as_reference) { 788 bool as_reference) {
779 ASSERT(writer != NULL); 789 ASSERT(writer != NULL);
780 ASSERT((kind == Snapshot::kScript) || (Snapshot::IsFull(kind))); 790 ASSERT((kind == Snapshot::kScript) || (Snapshot::IsFull(kind)));
781 bool is_in_fullsnapshot = false; 791 bool is_in_fullsnapshot = false;
782 bool owner_is_class = false; 792 bool owner_is_class = false;
783 if ((kind == Snapshot::kScript) && !Function::IsSignatureFunction(this)) { 793 if ((kind == Snapshot::kScript) && !Function::IsSignatureFunction(this)) {
784 intptr_t tags = writer->GetObjectTags(ptr()->owner_); 794 intptr_t tags = writer->GetObjectTags(ptr()->owner_);
785 intptr_t cid = ClassIdTag::decode(tags); 795 intptr_t cid = ClassIdTag::decode(tags);
786 owner_is_class = (cid == kClassCid); 796 owner_is_class = (cid == kClassCid);
787 is_in_fullsnapshot = owner_is_class ? 797 is_in_fullsnapshot = owner_is_class ?
788 Class::IsInFullSnapshot(reinterpret_cast<RawClass*>(ptr()->owner_)) : 798 Class::IsInFullSnapshot(reinterpret_cast<RawClass*>(ptr()->owner_)) :
789 PatchClass::IsInFullSnapshot( 799 PatchClass::IsInFullSnapshot(
790 reinterpret_cast<RawPatchClass*>(ptr()->owner_)); 800 reinterpret_cast<RawPatchClass*>(ptr()->owner_));
791 } 801 }
792 802
793 // Write out the serialization header value for this object. 803 // Write out the serialization header value for this object.
794 writer->WriteInlinedObjectHeader(object_id); 804 writer->WriteInlinedObjectHeader(object_id);
795 805
796 // Write out the class and tags information. 806 // Write out the class and tags information.
797 writer->WriteVMIsolateObject(kFunctionCid); 807 writer->WriteVMIsolateObject(kFunctionCid);
798 writer->WriteTags(writer->GetObjectTags(this)); 808 writer->WriteTags(writer->GetObjectTags(this));
799 809
800 // Write out the boolean is_in_fullsnapshot first as this will 810 // Write out the boolean is_in_fullsnapshot first as this will
801 // help the reader decide how the rest of the information needs 811 // help the reader decide how the rest of the information needs
802 // to be interpreted. 812 // to be interpreted.
803 writer->Write<bool>(is_in_fullsnapshot); 813 writer->Write<bool>(is_in_fullsnapshot);
804 814
805 if (Snapshot::IsFull(kind) || !is_in_fullsnapshot) { 815 if (Snapshot::IsFull(kind) || !is_in_fullsnapshot) {
806 bool is_optimized = Code::IsOptimized(ptr()->code_); 816 bool is_optimized = Code::IsOptimized(ptr()->code_);
807 817
808 // Write out all the non object fields. 818 // Write out all the non object fields.
809 writer->Write<int32_t>(ptr()->token_pos_.SnapshotEncode()); 819 writer->Write<int32_t>(ptr()->token_pos_.SnapshotEncode());
810 writer->Write<int32_t>(ptr()->end_token_pos_.SnapshotEncode()); 820 writer->Write<int32_t>(ptr()->end_token_pos_.SnapshotEncode());
811 writer->Write<int16_t>(ptr()->num_fixed_parameters_); 821 writer->Write<int16_t>(ptr()->num_fixed_parameters_);
812 writer->Write<int16_t>(ptr()->num_optional_parameters_); 822 writer->Write<int16_t>(ptr()->num_optional_parameters_);
813 writer->Write<uint32_t>(ptr()->kind_tag_); 823 writer->Write<uint32_t>(ptr()->kind_tag_);
814 if (Snapshot::IncludesCode(kind)) { 824 if (kind == Snapshot::kAppNoJIT) {
815 // Omit fields used to support de/reoptimization. 825 // Omit fields used to support de/reoptimization.
816 } else { 826 } else {
817 if (is_optimized) { 827 if (is_optimized) {
818 writer->Write<int32_t>(FLAG_optimization_counter_threshold); 828 writer->Write<int32_t>(FLAG_optimization_counter_threshold);
819 } else { 829 } else {
820 writer->Write<int32_t>(0); 830 writer->Write<int32_t>(0);
821 } 831 }
822 writer->Write<int8_t>(ptr()->deoptimization_counter_); 832 writer->Write<int8_t>(ptr()->deoptimization_counter_);
823 writer->Write<uint16_t>(ptr()->optimized_instruction_count_); 833 writer->Write<uint16_t>(ptr()->optimized_instruction_count_);
824 writer->Write<uint16_t>(ptr()->optimized_call_site_count_); 834 writer->Write<uint16_t>(ptr()->optimized_call_site_count_);
825 } 835 }
826 836
827 // Write out all the object pointer fields. 837 // Write out all the object pointer fields.
828 SnapshotWriterVisitor visitor(writer, kAsReference); 838 SnapshotWriterVisitor visitor(writer, kAsReference);
829 visitor.VisitPointers(from(), to_snapshot()); 839 visitor.VisitPointers(from(), to_snapshot());
830 if (Snapshot::IncludesCode(kind)) { 840 if (kind == Snapshot::kAppNoJIT) {
831 ASSERT(ptr()->ic_data_array_ == Array::null()); 841 ASSERT(ptr()->ic_data_array_ == Array::null());
832 ASSERT((ptr()->code_ == ptr()->unoptimized_code_) || 842 ASSERT((ptr()->code_ == ptr()->unoptimized_code_) ||
833 (ptr()->unoptimized_code_ == Code::null())); 843 (ptr()->unoptimized_code_ == Code::null()));
834 // Write out the code object as we are generating a precompiled snapshot.
835 writer->WriteObjectImpl(ptr()->code_, kAsInlinedObject); 844 writer->WriteObjectImpl(ptr()->code_, kAsInlinedObject);
845 } else if (kind == Snapshot::kAppWithJIT) {
846 writer->WriteObjectImpl(ptr()->ic_data_array_, kAsReference);
847 writer->WriteObjectImpl(ptr()->unoptimized_code_, kAsInlinedObject);
836 } else if (is_optimized) { 848 } else if (is_optimized) {
837 // Write out the ic data array as the function is optimized or 849 // Write out the ic data array as the function is optimized.
838 // we are generating a precompiled snapshot.
839 writer->WriteObjectImpl(ptr()->ic_data_array_, kAsReference); 850 writer->WriteObjectImpl(ptr()->ic_data_array_, kAsReference);
840 } 851 }
841 } else { 852 } else {
842 writer->WriteFunctionId(this, owner_is_class); 853 writer->WriteFunctionId(this, owner_is_class);
843 } 854 }
844 } 855 }
845 856
846 857
847 RawField* Field::ReadFrom(SnapshotReader* reader, 858 RawField* Field::ReadFrom(SnapshotReader* reader,
848 intptr_t object_id, 859 intptr_t object_id,
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
915 // Write out the owner. 926 // Write out the owner.
916 writer->WriteObjectImpl(ptr()->owner_, kAsReference); 927 writer->WriteObjectImpl(ptr()->owner_, kAsReference);
917 // Write out the type. 928 // Write out the type.
918 writer->WriteObjectImpl(ptr()->type_, kAsReference); 929 writer->WriteObjectImpl(ptr()->type_, kAsReference);
919 // Write out the initial static value or field offset. 930 // Write out the initial static value or field offset.
920 if (Field::StaticBit::decode(ptr()->kind_bits_)) { 931 if (Field::StaticBit::decode(ptr()->kind_bits_)) {
921 if (kind == Snapshot::kAppNoJIT) { 932 if (kind == Snapshot::kAppNoJIT) {
922 // For precompiled static fields, the value was already reset and 933 // For precompiled static fields, the value was already reset and
923 // initializer_ now contains a Function. 934 // initializer_ now contains a Function.
924 writer->WriteObjectImpl(ptr()->value_.static_value_, kAsReference); 935 writer->WriteObjectImpl(ptr()->value_.static_value_, kAsReference);
936 } else if (Field::ConstBit::decode(ptr()->kind_bits_)) {
937 // Do not reset const fields.
938 writer->WriteObjectImpl(ptr()->value_.static_value_, kAsReference);
925 } else { 939 } else {
926 // Otherwise, for static fields we write out the initial static value. 940 // Otherwise, for static fields we write out the initial static value.
927 writer->WriteObjectImpl(ptr()->initializer_.saved_value_, kAsReference); 941 writer->WriteObjectImpl(ptr()->initializer_.saved_value_, kAsReference);
928 } 942 }
929 } else { 943 } else {
930 writer->WriteObjectImpl(ptr()->value_.offset_, kAsReference); 944 writer->WriteObjectImpl(ptr()->value_.offset_, kAsReference);
931 } 945 }
932 // Write out the initializer function or saved initial value. 946 // Write out the initializer function or saved initial value.
933 if (kind == Snapshot::kAppNoJIT) { 947 if (kind == Snapshot::kAppNoJIT) {
934 writer->WriteObjectImpl(ptr()->initializer_.precompiled_, kAsReference); 948 writer->WriteObjectImpl(ptr()->initializer_.precompiled_, kAsReference);
(...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after
1428 1442
1429 void RawCode::WriteTo(SnapshotWriter* writer, 1443 void RawCode::WriteTo(SnapshotWriter* writer,
1430 intptr_t object_id, 1444 intptr_t object_id,
1431 Snapshot::Kind kind, 1445 Snapshot::Kind kind,
1432 bool as_reference) { 1446 bool as_reference) {
1433 ASSERT(Snapshot::IncludesCode(kind)); 1447 ASSERT(Snapshot::IncludesCode(kind));
1434 ASSERT(Snapshot::IsFull(kind)); 1448 ASSERT(Snapshot::IsFull(kind));
1435 1449
1436 intptr_t pointer_offsets_length = 1450 intptr_t pointer_offsets_length =
1437 Code::PtrOffBits::decode(ptr()->state_bits_); 1451 Code::PtrOffBits::decode(ptr()->state_bits_);
1438 if (pointer_offsets_length != 0) { 1452 // Cannot serialize code with embedded pointers (IA32).
1439 // Should only be IA32. 1453 ASSERT(pointer_offsets_length == 0);
siva 2016/05/05 00:08:32 Why did you change this to an assert from FATAL?
rmacnak 2016/05/05 01:47:03 Was thinking the fatals on --precompilation would
1440 FATAL("Cannot serialize code with embedded pointers"); 1454 if (kind == Snapshot::kAppNoJIT) {
1455 // No disabled code in precompilation.
1456 ASSERT(ptr()->instructions_ == ptr()->active_instructions_);
1457 } else {
1458 ASSERT(kind == Snapshot::kAppWithJIT);
1459 // We never include optimized code in JIT precompilation. Deoptimization
1460 // requires code patching and we cannot patch code that is shared between
1461 // isolates and should not mutate memory allocated by the embedder.
1462 bool is_optimized = Code::PtrOffBits::decode(ptr()->state_bits_);
1463 ASSERT(!is_optimized);
siva 2016/05/05 00:08:32 shouldn't this ASSERT be a FATAL instead?
rmacnak 2016/05/05 01:47:03 Done.
1441 } 1464 }
1442 1465
1443 // Write out the serialization header value for this object. 1466 // Write out the serialization header value for this object.
1444 writer->WriteInlinedObjectHeader(object_id); 1467 writer->WriteInlinedObjectHeader(object_id);
1445 1468
1446 // Write out the class and tags information. 1469 // Write out the class and tags information.
1447 writer->WriteVMIsolateObject(kCodeCid); 1470 writer->WriteVMIsolateObject(kCodeCid);
1448 writer->WriteTags(writer->GetObjectTags(this)); 1471 writer->WriteTags(writer->GetObjectTags(this));
1449 1472
1450 // Write out all the non object fields. 1473 // Write out all the non object fields.
1451 writer->Write<int32_t>(ptr()->state_bits_); 1474 writer->Write<int32_t>(ptr()->state_bits_);
1452 1475
1453 // No disabled code in precompilation.
1454 ASSERT(ptr()->instructions_ == ptr()->active_instructions_);
1455
1456 RawInstructions* instr = ptr()->instructions_; 1476 RawInstructions* instr = ptr()->instructions_;
1457 int32_t text_offset = writer->GetInstructionsId(instr, this); 1477 int32_t text_offset = writer->GetInstructionsId(instr, this);
1458 writer->Write<int32_t>(text_offset); 1478 writer->Write<int32_t>(text_offset);
1459 1479
1460 #if defined(DEBUG) 1480 #if defined(DEBUG)
1461 uword entry = ptr()->entry_point_; 1481 uword entry = ptr()->entry_point_;
1462 intptr_t instructions_size = Utils::RoundUp(instr->size_, 1482 intptr_t instructions_size = Utils::RoundUp(instr->size_,
1463 OS::PreferredCodeAlignment()); 1483 OS::PreferredCodeAlignment());
1464 uword check = Checksum(entry, instructions_size); 1484 uword check = Checksum(entry, instructions_size);
1465 writer->Write<uword>(check); 1485 writer->Write<uword>(check);
(...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after
1925 1945
1926 // Create a descriptor for 'this' variable. 1946 // Create a descriptor for 'this' variable.
1927 context_scope.SetTokenIndexAt(0, TokenPosition::kMinSource); 1947 context_scope.SetTokenIndexAt(0, TokenPosition::kMinSource);
1928 context_scope.SetNameAt(0, Symbols::This()); 1948 context_scope.SetNameAt(0, Symbols::This());
1929 context_scope.SetIsFinalAt(0, true); 1949 context_scope.SetIsFinalAt(0, true);
1930 context_scope.SetIsConstAt(0, false); 1950 context_scope.SetIsConstAt(0, false);
1931 context_scope.SetTypeAt(0, *reader->TypeHandle()); 1951 context_scope.SetTypeAt(0, *reader->TypeHandle());
1932 context_scope.SetContextIndexAt(0, 0); 1952 context_scope.SetContextIndexAt(0, 0);
1933 context_scope.SetContextLevelAt(0, 0); 1953 context_scope.SetContextLevelAt(0, 0);
1934 return context_scope.raw(); 1954 return context_scope.raw();
1955 } else if (kind == Snapshot::kAppWithJIT) {
1956 int32_t num_vars = reader->Read<int32_t>();
1957
1958 ContextScope& context_scope = ContextScope::ZoneHandle();
siva 2016/05/05 00:08:32 ZoneHandle(zone());
rmacnak 2016/05/05 01:47:03 Done.
1959 context_scope = reader->NewContextScope(num_vars);
1960 context_scope.set_is_implicit(false);
1961 reader->AddBackRef(object_id, &context_scope, kIsDeserialized);
1962
1963 READ_OBJECT_FIELDS(context_scope,
1964 context_scope.raw()->from(),
1965 context_scope.raw()->to(num_vars),
1966 kAsInlinedObject);
1967 return context_scope.raw();
1935 } 1968 }
1936 UNREACHABLE(); 1969 UNREACHABLE();
1937 return NULL; 1970 return NULL;
1938 } 1971 }
1939 1972
1940 1973
1941 void RawContextScope::WriteTo(SnapshotWriter* writer, 1974 void RawContextScope::WriteTo(SnapshotWriter* writer,
1942 intptr_t object_id, 1975 intptr_t object_id,
1943 Snapshot::Kind kind, 1976 Snapshot::Kind kind,
1944 bool as_reference) { 1977 bool as_reference) {
(...skipping 10 matching lines...) Expand all
1955 writer->WriteVMIsolateObject(kContextScopeCid); 1988 writer->WriteVMIsolateObject(kContextScopeCid);
1956 writer->WriteTags(writer->GetObjectTags(this)); 1989 writer->WriteTags(writer->GetObjectTags(this));
1957 1990
1958 // Write out is_implicit flag for the context scope. 1991 // Write out is_implicit flag for the context scope.
1959 writer->Write<bool>(true); 1992 writer->Write<bool>(true);
1960 1993
1961 // Write out the type of 'this' the variable. 1994 // Write out the type of 'this' the variable.
1962 writer->WriteObjectImpl(var->type, kAsInlinedObject); 1995 writer->WriteObjectImpl(var->type, kAsInlinedObject);
1963 1996
1964 return; 1997 return;
1998 } else if (kind == Snapshot::kAppWithJIT) {
1999 // Write out the serialization header value for this object.
2000 writer->WriteInlinedObjectHeader(object_id);
2001
2002 // Write out the class and tags information.
2003 writer->WriteVMIsolateObject(kContextScopeCid);
2004 writer->WriteTags(writer->GetObjectTags(this));
2005
2006 // Write out is_implicit flag for the context scope.
2007 writer->Write<bool>(false);
2008 int32_t num_vars = ptr()->num_variables_;
2009 writer->Write<int32_t>(num_vars);
2010
2011 SnapshotWriterVisitor visitor(writer, kAsInlinedObject);
2012 visitor.VisitPointers(from(), to(num_vars));
2013
2014 return;
1965 } 2015 }
1966 UNREACHABLE(); 2016 UNREACHABLE();
1967 } 2017 }
1968 2018
1969 2019
1970 RawICData* ICData::ReadFrom(SnapshotReader* reader, 2020 RawICData* ICData::ReadFrom(SnapshotReader* reader,
1971 intptr_t object_id, 2021 intptr_t object_id,
1972 intptr_t tags, 2022 intptr_t tags,
1973 Snapshot::Kind kind, 2023 Snapshot::Kind kind,
1974 bool as_reference) { 2024 bool as_reference) {
(...skipping 1728 matching lines...) Expand 10 before | Expand all | Expand 10 after
3703 // We do not allow objects with native fields in an isolate message. 3753 // We do not allow objects with native fields in an isolate message.
3704 writer->SetWriteException(Exceptions::kArgument, 3754 writer->SetWriteException(Exceptions::kArgument,
3705 "Illegal argument in isolate message" 3755 "Illegal argument in isolate message"
3706 " : (object is a UserTag)"); 3756 " : (object is a UserTag)");
3707 } else { 3757 } else {
3708 UNREACHABLE(); 3758 UNREACHABLE();
3709 } 3759 }
3710 } 3760 }
3711 3761
3712 } // namespace dart 3762 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698