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

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

Issue 1634863002: Introduce CodeSourceMap object to hold pc -> token position mappings (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 10 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.cc ('k') | runtime/vm/snapshot.h » ('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/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 1658 matching lines...) Expand 10 before | Expand all | Expand 10 after
1669 writer->WriteTags(writer->GetObjectTags(this)); 1669 writer->WriteTags(writer->GetObjectTags(this));
1670 writer->Write<int32_t>(ptr()->length_); 1670 writer->Write<int32_t>(ptr()->length_);
1671 if (ptr()->length_ > 0) { 1671 if (ptr()->length_ > 0) {
1672 intptr_t len = ptr()->length_; 1672 intptr_t len = ptr()->length_;
1673 uint8_t* data = reinterpret_cast<uint8_t*>(ptr()->data()); 1673 uint8_t* data = reinterpret_cast<uint8_t*>(ptr()->data());
1674 writer->WriteBytes(data, len); 1674 writer->WriteBytes(data, len);
1675 } 1675 }
1676 } 1676 }
1677 1677
1678 1678
1679 RawCodeSourceMap* CodeSourceMap::ReadFrom(SnapshotReader* reader,
1680 intptr_t object_id,
1681 intptr_t tags,
1682 Snapshot::Kind kind,
1683 bool as_reference) {
1684 ASSERT(reader->snapshot_code());
1685 ASSERT(kind == Snapshot::kFull);
1686
1687 const int32_t length = reader->Read<int32_t>();
1688 CodeSourceMap& result =
1689 CodeSourceMap::ZoneHandle(reader->zone(),
1690 NEW_OBJECT_WITH_LEN(CodeSourceMap, length));
1691 reader->AddBackRef(object_id, &result, kIsDeserialized);
1692
1693 if (result.Length() > 0) {
1694 NoSafepointScope no_safepoint;
1695 intptr_t len = result.Length();
1696 uint8_t* data = result.UnsafeMutableNonPointer(result.raw_ptr()->data());
1697 reader->ReadBytes(data, len);
1698 }
1699
1700 return result.raw();
1701 }
1702
1703
1704 void RawCodeSourceMap::WriteTo(SnapshotWriter* writer,
1705 intptr_t object_id,
1706 Snapshot::Kind kind,
1707 bool as_reference) {
1708 ASSERT(writer->snapshot_code());
1709 ASSERT(kind == Snapshot::kFull);
1710
1711 // Write out the serialization header value for this object.
1712 writer->WriteInlinedObjectHeader(object_id);
1713 writer->WriteIndexedObject(kCodeSourceMapCid);
1714 writer->WriteTags(writer->GetObjectTags(this));
1715 writer->Write<int32_t>(ptr()->length_);
1716 if (ptr()->length_ > 0) {
1717 intptr_t len = ptr()->length_;
1718 uint8_t* data = reinterpret_cast<uint8_t*>(ptr()->data());
1719 writer->WriteBytes(data, len);
1720 }
1721 }
1722
1723
1679 RawStackmap* Stackmap::ReadFrom(SnapshotReader* reader, 1724 RawStackmap* Stackmap::ReadFrom(SnapshotReader* reader,
1680 intptr_t object_id, 1725 intptr_t object_id,
1681 intptr_t tags, 1726 intptr_t tags,
1682 Snapshot::Kind kind, 1727 Snapshot::Kind kind,
1683 bool as_reference) { 1728 bool as_reference) {
1684 ASSERT(reader->snapshot_code()); 1729 ASSERT(reader->snapshot_code());
1685 ASSERT(kind == Snapshot::kFull); 1730 ASSERT(kind == Snapshot::kFull);
1686 1731
1687 const int32_t length = reader->Read<int32_t>(); 1732 const int32_t length = reader->Read<int32_t>();
1688 Stackmap& result = 1733 Stackmap& result =
(...skipping 1953 matching lines...) Expand 10 before | Expand all | Expand 10 after
3642 // We do not allow objects with native fields in an isolate message. 3687 // We do not allow objects with native fields in an isolate message.
3643 writer->SetWriteException(Exceptions::kArgument, 3688 writer->SetWriteException(Exceptions::kArgument,
3644 "Illegal argument in isolate message" 3689 "Illegal argument in isolate message"
3645 " : (object is a UserTag)"); 3690 " : (object is a UserTag)");
3646 } else { 3691 } else {
3647 UNREACHABLE(); 3692 UNREACHABLE();
3648 } 3693 }
3649 } 3694 }
3650 3695
3651 } // namespace dart 3696 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/raw_object.cc ('k') | runtime/vm/snapshot.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698