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

Unified Diff: runtime/vm/clustered_snapshot.h

Issue 2823873003: Tree shaker: (Closed)
Patch Set: . Created 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | runtime/vm/clustered_snapshot.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/clustered_snapshot.h
diff --git a/runtime/vm/clustered_snapshot.h b/runtime/vm/clustered_snapshot.h
index a91497f170b60eeac136c1015a975b4fc54e14a6..9f707b689bd74a1c744045b891ff919e39ec7611 100644
--- a/runtime/vm/clustered_snapshot.h
+++ b/runtime/vm/clustered_snapshot.h
@@ -20,6 +20,10 @@
#include "vm/version.h"
#include "vm/visitor.h"
+#if defined(DEBUG)
+#define SNAPSHOT_BACKTRACE
+#endif
siva 2017/04/18 21:17:58 If this is going to be always on when DEBUG is def
+
namespace dart {
// Forward declarations.
@@ -154,43 +158,17 @@ class Serializer : public StackResource {
next_ref_index_++;
}
- void Push(RawObject* object) {
- if (!object->IsHeapObject()) {
- RawSmi* smi = Smi::RawCast(object);
- if (smi_ids_.Lookup(smi) == NULL) {
- SmiObjectIdPair pair;
- pair.smi_ = smi;
- pair.id_ = 1;
- smi_ids_.Insert(pair);
- stack_.Add(object);
- num_written_objects_++;
- }
- return;
- }
-
- if (object->IsCode() && !Snapshot::IncludesCode(kind_)) {
- return; // Do not trace, will write null.
- }
-
- if (object->IsSendPort()) {
- // TODO(rmacnak): Do a better job of resetting fields in precompilation
- // and assert this is unreachable.
- return; // Do not trace, will write null.
- }
-
- intptr_t id = heap_->GetObjectId(object);
- if (id == 0) {
- heap_->SetObjectId(object, 1);
- ASSERT(heap_->GetObjectId(object) != 0);
- stack_.Add(object);
- num_written_objects_++;
- }
- }
+ void Push(RawObject* object);
void AddUntracedRef() { num_written_objects_++; }
void Trace(RawObject* object);
+ void UnexpectedObject(RawObject* object, const char* message);
+#if defined(SNAPSHOT_BACKTRACE)
+ RawObject* ParentOf(const Object& object);
+#endif
+
SerializationCluster* NewClusterForClass(intptr_t cid);
void ReserveHeader() {
@@ -282,6 +260,11 @@ class Serializer : public StackResource {
intptr_t next_ref_index_;
SmiObjectIdMap smi_ids_;
+#if defined(SNAPSHOT_BACKTRACE)
+ RawObject* current_parent_;
+ GrowableArray<Object*> parent_pairs_;
+#endif
+
DISALLOW_IMPLICIT_CONSTRUCTORS(Serializer);
};
« no previous file with comments | « no previous file | runtime/vm/clustered_snapshot.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698