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

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

Issue 335173002: Save ICData of unoptimized code in the function, thus preserving it across repated unoptimized comp… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 6 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
« no previous file with comments | « runtime/vm/raw_object.h ('k') | tests/standalone/issue14236_test.dart » ('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) 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/bigint_operations.h" 5 #include "vm/bigint_operations.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 687 matching lines...) Expand 10 before | Expand all | Expand 10 after
698 func.set_num_fixed_parameters(reader->Read<int16_t>()); 698 func.set_num_fixed_parameters(reader->Read<int16_t>());
699 func.set_num_optional_parameters(reader->Read<int16_t>()); 699 func.set_num_optional_parameters(reader->Read<int16_t>());
700 func.set_deoptimization_counter(reader->Read<int16_t>()); 700 func.set_deoptimization_counter(reader->Read<int16_t>());
701 func.set_kind_tag(reader->Read<uint16_t>()); 701 func.set_kind_tag(reader->Read<uint16_t>());
702 func.set_optimized_instruction_count(reader->Read<uint16_t>()); 702 func.set_optimized_instruction_count(reader->Read<uint16_t>());
703 func.set_optimized_call_site_count(reader->Read<uint16_t>()); 703 func.set_optimized_call_site_count(reader->Read<uint16_t>());
704 704
705 // Set all the object fields. 705 // Set all the object fields.
706 // TODO(5411462): Need to assert No GC can happen here, even though 706 // TODO(5411462): Need to assert No GC can happen here, even though
707 // allocations may happen. 707 // allocations may happen.
708 intptr_t num_flds = (func.raw()->to() - func.raw()->from()); 708 intptr_t num_flds = (func.raw()->to_snapshot() - func.raw()->from());
709 for (intptr_t i = 0; i <= num_flds; i++) { 709 for (intptr_t i = 0; i <= num_flds; i++) {
710 *(func.raw()->from() + i) = reader->ReadObjectRef(); 710 *(func.raw()->from() + i) = reader->ReadObjectRef();
711 } 711 }
712 712
713 // Set up code pointer with the lazy-compile-stub. 713 // Initialize all fields that are not part of the snapshot.
714 func.SetInstructions(Code::Handle(StubCode::LazyCompile_entry()->code())); 714 func.ClearCode();
715 715 func.set_ic_data_array(Array::Handle());
716 return func.raw(); 716 return func.raw();
717 } 717 }
718 718
719 719
720 void RawFunction::WriteTo(SnapshotWriter* writer, 720 void RawFunction::WriteTo(SnapshotWriter* writer,
721 intptr_t object_id, 721 intptr_t object_id,
722 Snapshot::Kind kind) { 722 Snapshot::Kind kind) {
723 ASSERT(writer != NULL); 723 ASSERT(writer != NULL);
724 ASSERT(((kind == Snapshot::kScript) && 724 ASSERT(((kind == Snapshot::kScript) &&
725 !RawObject::IsCreatedFromSnapshot(writer->GetObjectTags(this))) || 725 !RawObject::IsCreatedFromSnapshot(writer->GetObjectTags(this))) ||
(...skipping 12 matching lines...) Expand all
738 writer->Write<int32_t>(ptr()->usage_counter_); 738 writer->Write<int32_t>(ptr()->usage_counter_);
739 writer->Write<int16_t>(ptr()->num_fixed_parameters_); 739 writer->Write<int16_t>(ptr()->num_fixed_parameters_);
740 writer->Write<int16_t>(ptr()->num_optional_parameters_); 740 writer->Write<int16_t>(ptr()->num_optional_parameters_);
741 writer->Write<int16_t>(ptr()->deoptimization_counter_); 741 writer->Write<int16_t>(ptr()->deoptimization_counter_);
742 writer->Write<uint16_t>(ptr()->kind_tag_); 742 writer->Write<uint16_t>(ptr()->kind_tag_);
743 writer->Write<uint16_t>(ptr()->optimized_instruction_count_); 743 writer->Write<uint16_t>(ptr()->optimized_instruction_count_);
744 writer->Write<uint16_t>(ptr()->optimized_call_site_count_); 744 writer->Write<uint16_t>(ptr()->optimized_call_site_count_);
745 745
746 // Write out all the object pointer fields. 746 // Write out all the object pointer fields.
747 SnapshotWriterVisitor visitor(writer); 747 SnapshotWriterVisitor visitor(writer);
748 visitor.VisitPointers(from(), to_no_code()); 748 visitor.VisitPointers(from(), to_snapshot());
749
750 // Write null for the instructions and unoptimized code.
751 writer->WriteVMIsolateObject(kNullObject);
752 writer->WriteVMIsolateObject(kNullObject);
753 } 749 }
754 750
755 751
756 RawField* Field::ReadFrom(SnapshotReader* reader, 752 RawField* Field::ReadFrom(SnapshotReader* reader,
757 intptr_t object_id, 753 intptr_t object_id,
758 intptr_t tags, 754 intptr_t tags,
759 Snapshot::Kind kind) { 755 Snapshot::Kind kind) {
760 ASSERT(reader != NULL); 756 ASSERT(reader != NULL);
761 ASSERT(((kind == Snapshot::kScript) && 757 ASSERT(((kind == Snapshot::kScript) &&
762 !RawObject::IsCreatedFromSnapshot(tags)) || 758 !RawObject::IsCreatedFromSnapshot(tags)) ||
(...skipping 2020 matching lines...) Expand 10 before | Expand all | Expand 10 after
2783 // We do not allow objects with native fields in an isolate message. 2779 // We do not allow objects with native fields in an isolate message.
2784 writer->SetWriteException(Exceptions::kArgument, 2780 writer->SetWriteException(Exceptions::kArgument,
2785 "Illegal argument in isolate message" 2781 "Illegal argument in isolate message"
2786 " : (object is a UserTag)"); 2782 " : (object is a UserTag)");
2787 } else { 2783 } else {
2788 UNREACHABLE(); 2784 UNREACHABLE();
2789 } 2785 }
2790 } 2786 }
2791 2787
2792 } // namespace dart 2788 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/raw_object.h ('k') | tests/standalone/issue14236_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698