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

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

Issue 1857273002: Fix detection if a function was compiled, (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Comments Created 4 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/raw_object.h ('k') | no next file » | 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/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 715 matching lines...) Expand 10 before | Expand all | Expand 10 after
726 func.set_kind_tag(reader->Read<uint32_t>()); 726 func.set_kind_tag(reader->Read<uint32_t>());
727 func.set_token_pos(TokenPosition::SnapshotDecode(token_pos)); 727 func.set_token_pos(TokenPosition::SnapshotDecode(token_pos));
728 func.set_end_token_pos(TokenPosition::SnapshotDecode(end_token_pos)); 728 func.set_end_token_pos(TokenPosition::SnapshotDecode(end_token_pos));
729 if (reader->snapshot_code()) { 729 if (reader->snapshot_code()) {
730 func.set_usage_counter(0); 730 func.set_usage_counter(0);
731 func.set_deoptimization_counter(0); 731 func.set_deoptimization_counter(0);
732 func.set_optimized_instruction_count(0); 732 func.set_optimized_instruction_count(0);
733 func.set_optimized_call_site_count(0); 733 func.set_optimized_call_site_count(0);
734 } else { 734 } else {
735 func.set_usage_counter(reader->Read<int32_t>()); 735 func.set_usage_counter(reader->Read<int32_t>());
736 func.set_deoptimization_counter(reader->Read<int16_t>()); 736 func.set_deoptimization_counter(reader->Read<int8_t>());
737 func.set_optimized_instruction_count(reader->Read<uint16_t>()); 737 func.set_optimized_instruction_count(reader->Read<uint16_t>());
738 func.set_optimized_call_site_count(reader->Read<uint16_t>()); 738 func.set_optimized_call_site_count(reader->Read<uint16_t>());
739 } 739 }
740 func.set_was_compiled(false);
740 741
741 // Set all the object fields. 742 // Set all the object fields.
742 READ_OBJECT_FIELDS(func, 743 READ_OBJECT_FIELDS(func,
743 func.raw()->from(), func.raw()->to_snapshot(), 744 func.raw()->from(), func.raw()->to_snapshot(),
744 kAsReference); 745 kAsReference);
745 // Initialize all fields that are not part of the snapshot. 746 // Initialize all fields that are not part of the snapshot.
746 if (reader->snapshot_code()) { 747 if (reader->snapshot_code()) {
747 func.ClearICDataArray(); 748 func.ClearICDataArray();
748 func.ClearCode(); 749 func.ClearCode();
749 // Read the code object and fixup entry point. 750 // Read the code object and fixup entry point.
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
807 writer->Write<int16_t>(ptr()->num_optional_parameters_); 808 writer->Write<int16_t>(ptr()->num_optional_parameters_);
808 writer->Write<uint32_t>(ptr()->kind_tag_); 809 writer->Write<uint32_t>(ptr()->kind_tag_);
809 if (writer->snapshot_code()) { 810 if (writer->snapshot_code()) {
810 // Omit fields used to support de/reoptimization. 811 // Omit fields used to support de/reoptimization.
811 } else { 812 } else {
812 if (is_optimized) { 813 if (is_optimized) {
813 writer->Write<int32_t>(FLAG_optimization_counter_threshold); 814 writer->Write<int32_t>(FLAG_optimization_counter_threshold);
814 } else { 815 } else {
815 writer->Write<int32_t>(0); 816 writer->Write<int32_t>(0);
816 } 817 }
817 writer->Write<int16_t>(ptr()->deoptimization_counter_); 818 writer->Write<int8_t>(ptr()->deoptimization_counter_);
818 writer->Write<uint16_t>(ptr()->optimized_instruction_count_); 819 writer->Write<uint16_t>(ptr()->optimized_instruction_count_);
819 writer->Write<uint16_t>(ptr()->optimized_call_site_count_); 820 writer->Write<uint16_t>(ptr()->optimized_call_site_count_);
820 } 821 }
821 822
822 // Write out all the object pointer fields. 823 // Write out all the object pointer fields.
823 SnapshotWriterVisitor visitor(writer, kAsReference); 824 SnapshotWriterVisitor visitor(writer, kAsReference);
824 visitor.VisitPointers(from(), to_snapshot()); 825 visitor.VisitPointers(from(), to_snapshot());
825 if (writer->snapshot_code()) { 826 if (writer->snapshot_code()) {
826 ASSERT(ptr()->ic_data_array_ == Array::null()); 827 ASSERT(ptr()->ic_data_array_ == Array::null());
827 ASSERT((ptr()->code_ == ptr()->unoptimized_code_) || 828 ASSERT((ptr()->code_ == ptr()->unoptimized_code_) ||
(...skipping 2865 matching lines...) Expand 10 before | Expand all | Expand 10 after
3693 // We do not allow objects with native fields in an isolate message. 3694 // We do not allow objects with native fields in an isolate message.
3694 writer->SetWriteException(Exceptions::kArgument, 3695 writer->SetWriteException(Exceptions::kArgument,
3695 "Illegal argument in isolate message" 3696 "Illegal argument in isolate message"
3696 " : (object is a UserTag)"); 3697 " : (object is a UserTag)");
3697 } else { 3698 } else {
3698 UNREACHABLE(); 3699 UNREACHABLE();
3699 } 3700 }
3700 } 3701 }
3701 3702
3702 } // namespace dart 3703 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/raw_object.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698