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

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

Issue 324843004: Significantly improve performance of code coverage tool by precomputing a map token_pos->line numbe… (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
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 940 matching lines...) Expand 10 before | Expand all | Expand 10 after
951 // Set all the object fields. 951 // Set all the object fields.
952 // TODO(5411462): Need to assert No GC can happen here, even though 952 // TODO(5411462): Need to assert No GC can happen here, even though
953 // allocations may happen. 953 // allocations may happen.
954 *reader->StringHandle() ^= reader->ReadObjectImpl(); 954 *reader->StringHandle() ^= reader->ReadObjectImpl();
955 script.set_url(*reader->StringHandle()); 955 script.set_url(*reader->StringHandle());
956 *reader->StringHandle() ^= String::null(); 956 *reader->StringHandle() ^= String::null();
957 script.set_source(*reader->StringHandle()); 957 script.set_source(*reader->StringHandle());
958 TokenStream& stream = TokenStream::Handle(); 958 TokenStream& stream = TokenStream::Handle();
959 stream ^= reader->ReadObjectImpl(); 959 stream ^= reader->ReadObjectImpl();
960 script.set_tokens(stream); 960 script.set_tokens(stream);
961 TypedData& array = TypedData::Handle();
962 array ^= reader->ReadObjectImpl();
963 script.set_token_pos_to_line_nr(array);
961 964
962 script.raw_ptr()->line_offset_ = reader->Read<int32_t>(); 965 script.raw_ptr()->line_offset_ = reader->Read<int32_t>();
963 script.raw_ptr()->col_offset_ = reader->Read<int32_t>(); 966 script.raw_ptr()->col_offset_ = reader->Read<int32_t>();
964 script.raw_ptr()->kind_ = reader->Read<int8_t>(); 967 script.raw_ptr()->kind_ = reader->Read<int8_t>();
965 968
966 return script.raw(); 969 return script.raw();
967 } 970 }
968 971
969 972
970 void RawScript::WriteTo(SnapshotWriter* writer, 973 void RawScript::WriteTo(SnapshotWriter* writer,
971 intptr_t object_id, 974 intptr_t object_id,
972 Snapshot::Kind kind) { 975 Snapshot::Kind kind) {
973 ASSERT(writer != NULL); 976 ASSERT(writer != NULL);
974 ASSERT(tokens_ != TokenStream::null()); 977 ASSERT(tokens_ != TokenStream::null());
975 ASSERT(((kind == Snapshot::kScript) && 978 ASSERT(((kind == Snapshot::kScript) &&
976 !RawObject::IsCreatedFromSnapshot(writer->GetObjectTags(this))) || 979 !RawObject::IsCreatedFromSnapshot(writer->GetObjectTags(this))) ||
977 (kind == Snapshot::kFull)); 980 (kind == Snapshot::kFull));
978 981
979 // Write out the serialization header value for this object. 982 // Write out the serialization header value for this object.
980 writer->WriteInlinedObjectHeader(object_id); 983 writer->WriteInlinedObjectHeader(object_id);
981 984
982 // Write out the class and tags information. 985 // Write out the class and tags information.
983 writer->WriteVMIsolateObject(kScriptCid); 986 writer->WriteVMIsolateObject(kScriptCid);
984 writer->WriteIntptrValue(writer->GetObjectTags(this)); 987 writer->WriteIntptrValue(writer->GetObjectTags(this));
985 988
986 // Write out all the object pointer fields. 989 // Write out all the object pointer fields.
987 writer->WriteObjectImpl(ptr()->url_); 990 writer->WriteObjectImpl(ptr()->url_);
988 writer->WriteObjectImpl(ptr()->tokens_); 991 writer->WriteObjectImpl(ptr()->tokens_);
992 writer->WriteObjectImpl(ptr()->token_pos_to_line_nr_);
989 993
990 writer->Write<int32_t>(ptr()->line_offset_); 994 writer->Write<int32_t>(ptr()->line_offset_);
991 writer->Write<int32_t>(ptr()->col_offset_); 995 writer->Write<int32_t>(ptr()->col_offset_);
992 writer->Write<int8_t>(ptr()->kind_); 996 writer->Write<int8_t>(ptr()->kind_);
993 } 997 }
994 998
995 999
996 RawLibrary* Library::ReadFrom(SnapshotReader* reader, 1000 RawLibrary* Library::ReadFrom(SnapshotReader* reader,
997 intptr_t object_id, 1001 intptr_t object_id,
998 intptr_t tags, 1002 intptr_t tags,
(...skipping 1784 matching lines...) Expand 10 before | Expand all | Expand 10 after
2783 // We do not allow objects with native fields in an isolate message. 2787 // We do not allow objects with native fields in an isolate message.
2784 writer->SetWriteException(Exceptions::kArgument, 2788 writer->SetWriteException(Exceptions::kArgument,
2785 "Illegal argument in isolate message" 2789 "Illegal argument in isolate message"
2786 " : (object is a UserTag)"); 2790 " : (object is a UserTag)");
2787 } else { 2791 } else {
2788 UNREACHABLE(); 2792 UNREACHABLE();
2789 } 2793 }
2790 } 2794 }
2791 2795
2792 } // namespace dart 2796 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698