OLD | NEW |
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/object.h" | 5 #include "vm/object.h" |
6 #include "vm/object_store.h" | 6 #include "vm/object_store.h" |
7 #include "vm/snapshot.h" | 7 #include "vm/snapshot.h" |
8 #include "vm/stub_code.h" | 8 #include "vm/stub_code.h" |
9 #include "vm/symbols.h" | 9 #include "vm/symbols.h" |
10 #include "vm/visitor.h" | 10 #include "vm/visitor.h" |
(...skipping 667 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
678 reader->zone(), NEW_OBJECT(Function)); | 678 reader->zone(), NEW_OBJECT(Function)); |
679 reader->AddBackRef(object_id, &func, kIsDeserialized); | 679 reader->AddBackRef(object_id, &func, kIsDeserialized); |
680 | 680 |
681 // Set all the non object fields. | 681 // Set all the non object fields. |
682 func.set_token_pos(reader->Read<int32_t>()); | 682 func.set_token_pos(reader->Read<int32_t>()); |
683 func.set_end_token_pos(reader->Read<int32_t>()); | 683 func.set_end_token_pos(reader->Read<int32_t>()); |
684 func.set_usage_counter(reader->Read<int32_t>()); | 684 func.set_usage_counter(reader->Read<int32_t>()); |
685 func.set_num_fixed_parameters(reader->Read<int16_t>()); | 685 func.set_num_fixed_parameters(reader->Read<int16_t>()); |
686 func.set_num_optional_parameters(reader->Read<int16_t>()); | 686 func.set_num_optional_parameters(reader->Read<int16_t>()); |
687 func.set_deoptimization_counter(reader->Read<int16_t>()); | 687 func.set_deoptimization_counter(reader->Read<int16_t>()); |
688 func.set_regexp_cid(reader->ReadClassIDValue()); | |
689 func.set_kind_tag(reader->Read<uint32_t>()); | 688 func.set_kind_tag(reader->Read<uint32_t>()); |
690 func.set_optimized_instruction_count(reader->Read<uint16_t>()); | 689 func.set_optimized_instruction_count(reader->Read<uint16_t>()); |
691 func.set_optimized_call_site_count(reader->Read<uint16_t>()); | 690 func.set_optimized_call_site_count(reader->Read<uint16_t>()); |
692 | 691 |
693 // Set all the object fields. | 692 // Set all the object fields. |
694 // TODO(5411462): Need to assert No GC can happen here, even though | 693 // TODO(5411462): Need to assert No GC can happen here, even though |
695 // allocations may happen. | 694 // allocations may happen. |
696 intptr_t num_flds = (func.raw()->to_snapshot() - func.raw()->from()); | 695 intptr_t num_flds = (func.raw()->to_snapshot() - func.raw()->from()); |
697 intptr_t from_offset = OFFSET_OF_FROM(func); | 696 intptr_t from_offset = OFFSET_OF_FROM(func); |
698 for (intptr_t i = 0; i <= num_flds; i++) { | 697 for (intptr_t i = 0; i <= num_flds; i++) { |
(...skipping 23 matching lines...) Expand all Loading... |
722 writer->WriteVMIsolateObject(kFunctionCid); | 721 writer->WriteVMIsolateObject(kFunctionCid); |
723 writer->WriteTags(writer->GetObjectTags(this)); | 722 writer->WriteTags(writer->GetObjectTags(this)); |
724 | 723 |
725 // Write out all the non object fields. | 724 // Write out all the non object fields. |
726 writer->Write<int32_t>(ptr()->token_pos_); | 725 writer->Write<int32_t>(ptr()->token_pos_); |
727 writer->Write<int32_t>(ptr()->end_token_pos_); | 726 writer->Write<int32_t>(ptr()->end_token_pos_); |
728 writer->Write<int32_t>(ptr()->usage_counter_); | 727 writer->Write<int32_t>(ptr()->usage_counter_); |
729 writer->Write<int16_t>(ptr()->num_fixed_parameters_); | 728 writer->Write<int16_t>(ptr()->num_fixed_parameters_); |
730 writer->Write<int16_t>(ptr()->num_optional_parameters_); | 729 writer->Write<int16_t>(ptr()->num_optional_parameters_); |
731 writer->Write<int16_t>(ptr()->deoptimization_counter_); | 730 writer->Write<int16_t>(ptr()->deoptimization_counter_); |
732 writer->WriteClassIDValue(ptr()->regexp_cid_); | |
733 writer->Write<uint32_t>(ptr()->kind_tag_); | 731 writer->Write<uint32_t>(ptr()->kind_tag_); |
734 writer->Write<uint16_t>(ptr()->optimized_instruction_count_); | 732 writer->Write<uint16_t>(ptr()->optimized_instruction_count_); |
735 writer->Write<uint16_t>(ptr()->optimized_call_site_count_); | 733 writer->Write<uint16_t>(ptr()->optimized_call_site_count_); |
736 | 734 |
737 // Write out all the object pointer fields. | 735 // Write out all the object pointer fields. |
738 SnapshotWriterVisitor visitor(writer); | 736 SnapshotWriterVisitor visitor(writer); |
739 visitor.VisitPointers(from(), to_snapshot()); | 737 visitor.VisitPointers(from(), to_snapshot()); |
740 } | 738 } |
741 | 739 |
742 | 740 |
(...skipping 2266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3009 // We do not allow objects with native fields in an isolate message. | 3007 // We do not allow objects with native fields in an isolate message. |
3010 writer->SetWriteException(Exceptions::kArgument, | 3008 writer->SetWriteException(Exceptions::kArgument, |
3011 "Illegal argument in isolate message" | 3009 "Illegal argument in isolate message" |
3012 " : (object is a UserTag)"); | 3010 " : (object is a UserTag)"); |
3013 } else { | 3011 } else { |
3014 UNREACHABLE(); | 3012 UNREACHABLE(); |
3015 } | 3013 } |
3016 } | 3014 } |
3017 | 3015 |
3018 } // namespace dart | 3016 } // namespace dart |
OLD | NEW |