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

Unified Diff: runtime/vm/snapshot.cc

Issue 1918313003: Split Snapshot::kFull into kCore, kAppWithJIT, and kAppNoJIT. Remove snapshot_code flag. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: sync 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/snapshot.h ('k') | runtime/vm/snapshot_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/snapshot.cc
diff --git a/runtime/vm/snapshot.cc b/runtime/vm/snapshot.cc
index 472979820c3a6a476c9da091ea1c137a7939b19c..6107c5306e3fb23c517f88e32ba60ca5b98d5f91 100644
--- a/runtime/vm/snapshot.cc
+++ b/runtime/vm/snapshot.cc
@@ -182,7 +182,6 @@ SnapshotReader::SnapshotReader(
instructions_buffer_(instructions_buffer),
data_buffer_(data_buffer),
kind_(kind),
- snapshot_code_(instructions_buffer != NULL),
thread_(thread),
zone_(thread->zone()),
heap_(isolate()->heap()),
@@ -205,7 +204,7 @@ SnapshotReader::SnapshotReader(
megamorphic_cache_(MegamorphicCache::Handle(zone_)),
error_(UnhandledException::Handle(zone_)),
max_vm_isolate_object_id_(
- (kind == Snapshot::kFull) ?
+ (Snapshot::IsFull(kind)) ?
Object::vm_isolate_snapshot_object_table().Length() : 0),
backward_references_(backward_refs),
instructions_reader_(NULL) {
@@ -228,7 +227,7 @@ RawObject* SnapshotReader::ReadObject() {
(*backward_references_)[i].set_state(kIsDeserialized);
}
}
- if (kind() != Snapshot::kFull) {
+ if (!Snapshot::IsFull(kind())) {
ProcessDeferredCanonicalizations();
}
return obj.raw();
@@ -242,7 +241,7 @@ RawObject* SnapshotReader::ReadObject() {
RawClass* SnapshotReader::ReadClassId(intptr_t object_id) {
- ASSERT(kind_ != Snapshot::kFull);
+ ASSERT(!Snapshot::IsFull(kind_));
// Read the class header information and lookup the class.
intptr_t class_header = Read<int32_t>();
ASSERT((class_header & kSmiTagMask) != kSmiTag);
@@ -307,7 +306,7 @@ RawFunction* SnapshotReader::ReadFunctionId(intptr_t object_id) {
RawObject* SnapshotReader::ReadStaticImplicitClosure(intptr_t object_id,
intptr_t class_header) {
- ASSERT(kind_ != Snapshot::kFull);
+ ASSERT(!Snapshot::IsFull(kind_));
// First create a function object and associate it with the specified
// 'object_id'.
@@ -488,7 +487,7 @@ RawObject* SnapshotReader::ReadInstance(intptr_t object_id,
instance_size = cls_.instance_size();
ASSERT(instance_size > 0);
// Allocate the instance and read in all the fields for the object.
- if (kind_ == Snapshot::kFull) {
+ if (Snapshot::IsFull(kind_)) {
*result ^= AllocateUninitialized(cls_.id(), instance_size);
} else {
*result ^= Object::Allocate(cls_.id(), instance_size, HEAP_SPACE(kind_));
@@ -530,7 +529,7 @@ RawObject* SnapshotReader::ReadInstance(intptr_t object_id,
// snapshot (kFull, kScript) with asserts.
offset += kWordSize;
}
- if (kind_ == Snapshot::kFull) {
+ if (Snapshot::IsFull(kind_)) {
// We create an uninitialized object in the case of full snapshots, so
// we need to initialize any remaining padding area with the Null object.
while (offset < instance_size) {
@@ -539,7 +538,7 @@ RawObject* SnapshotReader::ReadInstance(intptr_t object_id,
}
}
if (RawObject::IsCanonical(tags)) {
- if (kind_ == Snapshot::kFull) {
+ if (Snapshot::IsFull(kind_)) {
result->SetCanonical();
} else {
*result = result->CheckAndCanonicalize(thread(), NULL);
@@ -592,7 +591,7 @@ class HeapLocker : public StackResource {
RawApiError* SnapshotReader::ReadFullSnapshot() {
- ASSERT(kind_ == Snapshot::kFull);
+ ASSERT(Snapshot::IsFull(kind_));
Thread* thread = Thread::Current();
Isolate* isolate = thread->isolate();
ASSERT(isolate != NULL);
@@ -614,9 +613,8 @@ RawApiError* SnapshotReader::ReadFullSnapshot() {
HeapLocker hl(thread, old_space());
// Read in all the objects stored in the object store.
- RawObject** toobj = snapshot_code() ? object_store->to()
- : object_store->to_snapshot();
- intptr_t num_flds = (toobj - object_store->from());
+ intptr_t num_flds =
+ (object_store->to_snapshot(kind_) - object_store->from());
for (intptr_t i = 0; i <= num_flds; i++) {
*(object_store->from() + i) = ReadObjectImpl(kAsInlinedObject);
}
@@ -627,7 +625,7 @@ RawApiError* SnapshotReader::ReadFullSnapshot() {
}
}
- if (snapshot_code()) {
+ if (Snapshot::IncludesCode(kind_)) {
ICData& ic = ICData::Handle(thread->zone());
Object& funcOrCode = Object::Handle(thread->zone());
Code& code = Code::Handle(thread->zone());
@@ -724,7 +722,7 @@ RawApiError* SnapshotReader::VerifyVersion() {
OS::SNPrint(message_buffer,
kMessageBufferSize,
"Wrong %s snapshot version, expected '%s' found '%s'",
- (kind_ == Snapshot::kFull) ? "full" : "script",
+ (Snapshot::IsFull(kind_)) ? "full" : "script",
Version::SnapshotString(),
actual_version);
free(actual_version);
@@ -739,7 +737,7 @@ RawApiError* SnapshotReader::VerifyVersion() {
#define ALLOC_NEW_OBJECT_WITH_LEN(type, length) \
- ASSERT(kind_ == Snapshot::kFull); \
+ ASSERT(Snapshot::IsFull(kind_)); \
ASSERT_NO_SAFEPOINT_SCOPE(); \
Raw##type* obj = reinterpret_cast<Raw##type*>( \
AllocateUninitialized(k##type##Cid, type::InstanceSize(length))); \
@@ -773,7 +771,7 @@ RawTypeArguments* SnapshotReader::NewTypeArguments(intptr_t len) {
RawObjectPool* SnapshotReader::NewObjectPool(intptr_t len) {
- ASSERT(kind_ == Snapshot::kFull);
+ ASSERT(Snapshot::IsFull(kind_));
ASSERT_NO_SAFEPOINT_SCOPE();
RawObjectPool* obj = reinterpret_cast<RawObjectPool*>(
AllocateUninitialized(kObjectPoolCid, ObjectPool::InstanceSize(len)));
@@ -784,7 +782,7 @@ RawObjectPool* SnapshotReader::NewObjectPool(intptr_t len) {
RawLocalVarDescriptors* SnapshotReader::NewLocalVarDescriptors(
intptr_t num_entries) {
- ASSERT(kind_ == Snapshot::kFull);
+ ASSERT(Snapshot::IsFull(kind_));
ASSERT_NO_SAFEPOINT_SCOPE();
RawLocalVarDescriptors* obj = reinterpret_cast<RawLocalVarDescriptors*>(
AllocateUninitialized(kLocalVarDescriptorsCid,
@@ -796,7 +794,7 @@ RawLocalVarDescriptors* SnapshotReader::NewLocalVarDescriptors(
RawExceptionHandlers* SnapshotReader::NewExceptionHandlers(
intptr_t num_entries) {
- ASSERT(kind_ == Snapshot::kFull);
+ ASSERT(Snapshot::IsFull(kind_));
ASSERT_NO_SAFEPOINT_SCOPE();
RawExceptionHandlers* obj = reinterpret_cast<RawExceptionHandlers*>(
AllocateUninitialized(kExceptionHandlersCid,
@@ -807,7 +805,7 @@ RawExceptionHandlers* SnapshotReader::NewExceptionHandlers(
RawPcDescriptors* SnapshotReader::NewPcDescriptors(intptr_t len) {
- ASSERT(kind_ == Snapshot::kFull);
+ ASSERT(Snapshot::IsFull(kind_));
ASSERT_NO_SAFEPOINT_SCOPE();
RawPcDescriptors* obj = reinterpret_cast<RawPcDescriptors*>(
AllocateUninitialized(kPcDescriptorsCid,
@@ -818,7 +816,7 @@ RawPcDescriptors* SnapshotReader::NewPcDescriptors(intptr_t len) {
RawCodeSourceMap* SnapshotReader::NewCodeSourceMap(intptr_t len) {
- ASSERT(kind_ == Snapshot::kFull);
+ ASSERT(Snapshot::IsFull(kind_));
ASSERT_NO_SAFEPOINT_SCOPE();
RawCodeSourceMap* obj = reinterpret_cast<RawCodeSourceMap*>(
AllocateUninitialized(kCodeSourceMapCid,
@@ -829,7 +827,7 @@ RawCodeSourceMap* SnapshotReader::NewCodeSourceMap(intptr_t len) {
RawStackmap* SnapshotReader::NewStackmap(intptr_t len) {
- ASSERT(kind_ == Snapshot::kFull);
+ ASSERT(Snapshot::IsFull(kind_));
ASSERT_NO_SAFEPOINT_SCOPE();
RawStackmap* obj = reinterpret_cast<RawStackmap*>(
AllocateUninitialized(kStackmapCid, Stackmap::InstanceSize(len)));
@@ -839,7 +837,7 @@ RawStackmap* SnapshotReader::NewStackmap(intptr_t len) {
RawContextScope* SnapshotReader::NewContextScope(intptr_t num_variables) {
- ASSERT(kind_ == Snapshot::kFull);
+ ASSERT(Snapshot::IsFull(kind_));
ASSERT_NO_SAFEPOINT_SCOPE();
RawContextScope* obj = reinterpret_cast<RawContextScope*>(
AllocateUninitialized(kContextScopeCid,
@@ -851,7 +849,7 @@ RawContextScope* SnapshotReader::NewContextScope(intptr_t num_variables) {
RawCode* SnapshotReader::NewCode(intptr_t pointer_offsets_length) {
ASSERT(pointer_offsets_length == 0);
- ASSERT(kind_ == Snapshot::kFull);
+ ASSERT(Snapshot::IsFull(kind_));
ASSERT_NO_SAFEPOINT_SCOPE();
RawCode* obj = reinterpret_cast<RawCode*>(
AllocateUninitialized(kCodeCid, Code::InstanceSize(0)));
@@ -860,7 +858,7 @@ RawCode* SnapshotReader::NewCode(intptr_t pointer_offsets_length) {
RawTokenStream* SnapshotReader::NewTokenStream(intptr_t len) {
- ASSERT(kind_ == Snapshot::kFull);
+ ASSERT(Snapshot::IsFull(kind_));
ASSERT_NO_SAFEPOINT_SCOPE();
stream_ = reinterpret_cast<RawTokenStream*>(
AllocateUninitialized(kTokenStreamCid, TokenStream::InstanceSize()));
@@ -878,7 +876,7 @@ RawTokenStream* SnapshotReader::NewTokenStream(intptr_t len) {
RawContext* SnapshotReader::NewContext(intptr_t num_variables) {
- ASSERT(kind_ == Snapshot::kFull);
+ ASSERT(Snapshot::IsFull(kind_));
ASSERT_NO_SAFEPOINT_SCOPE();
RawContext* obj = reinterpret_cast<RawContext*>(
AllocateUninitialized(kContextCid, Context::InstanceSize(num_variables)));
@@ -888,7 +886,7 @@ RawContext* SnapshotReader::NewContext(intptr_t num_variables) {
RawClass* SnapshotReader::NewClass(intptr_t class_id) {
- ASSERT(kind_ == Snapshot::kFull);
+ ASSERT(Snapshot::IsFull(kind_));
ASSERT_NO_SAFEPOINT_SCOPE();
if (class_id < kNumPredefinedCids) {
ASSERT((class_id >= kInstanceCid) &&
@@ -907,7 +905,7 @@ RawClass* SnapshotReader::NewClass(intptr_t class_id) {
RawInstance* SnapshotReader::NewInstance() {
- ASSERT(kind_ == Snapshot::kFull);
+ ASSERT(Snapshot::IsFull(kind_));
ASSERT_NO_SAFEPOINT_SCOPE();
RawInstance* obj = reinterpret_cast<RawInstance*>(
AllocateUninitialized(kInstanceCid, Instance::InstanceSize()));
@@ -916,7 +914,7 @@ RawInstance* SnapshotReader::NewInstance() {
RawMint* SnapshotReader::NewMint(int64_t value) {
- ASSERT(kind_ == Snapshot::kFull);
+ ASSERT(Snapshot::IsFull(kind_));
ASSERT_NO_SAFEPOINT_SCOPE();
RawMint* obj = reinterpret_cast<RawMint*>(
AllocateUninitialized(kMintCid, Mint::InstanceSize()));
@@ -926,7 +924,7 @@ RawMint* SnapshotReader::NewMint(int64_t value) {
RawDouble* SnapshotReader::NewDouble(double value) {
- ASSERT(kind_ == Snapshot::kFull);
+ ASSERT(Snapshot::IsFull(kind_));
ASSERT_NO_SAFEPOINT_SCOPE();
RawDouble* obj = reinterpret_cast<RawDouble*>(
AllocateUninitialized(kDoubleCid, Double::InstanceSize()));
@@ -936,7 +934,7 @@ RawDouble* SnapshotReader::NewDouble(double value) {
RawTypedData* SnapshotReader::NewTypedData(intptr_t class_id, intptr_t len) {
- ASSERT(kind_ == Snapshot::kFull);
+ ASSERT(Snapshot::IsFull(kind_));
ASSERT_NO_SAFEPOINT_SCOPE();
const intptr_t lengthInBytes = len * TypedData::ElementSizeInBytes(class_id);
RawTypedData* obj = reinterpret_cast<RawTypedData*>(
@@ -947,7 +945,7 @@ RawTypedData* SnapshotReader::NewTypedData(intptr_t class_id, intptr_t len) {
#define ALLOC_NEW_OBJECT(type) \
- ASSERT(kind_ == Snapshot::kFull); \
+ ASSERT(Snapshot::IsFull(kind_)); \
ASSERT_NO_SAFEPOINT_SCOPE(); \
return reinterpret_cast<Raw##type*>( \
AllocateUninitialized(k##type##Cid, type::InstanceSize())); \
@@ -1080,7 +1078,7 @@ RawRegExp* SnapshotReader::NewRegExp() {
RawFloat32x4* SnapshotReader::NewFloat32x4(float v0, float v1, float v2,
float v3) {
- ASSERT(kind_ == Snapshot::kFull);
+ ASSERT(Snapshot::IsFull(kind_));
ASSERT_NO_SAFEPOINT_SCOPE();
RawFloat32x4* obj = reinterpret_cast<RawFloat32x4*>(
AllocateUninitialized(kFloat32x4Cid, Float32x4::InstanceSize()));
@@ -1094,7 +1092,7 @@ RawFloat32x4* SnapshotReader::NewFloat32x4(float v0, float v1, float v2,
RawInt32x4* SnapshotReader::NewInt32x4(uint32_t v0, uint32_t v1, uint32_t v2,
uint32_t v3) {
- ASSERT(kind_ == Snapshot::kFull);
+ ASSERT(Snapshot::IsFull(kind_));
ASSERT_NO_SAFEPOINT_SCOPE();
RawInt32x4* obj = reinterpret_cast<RawInt32x4*>(
AllocateUninitialized(kInt32x4Cid, Int32x4::InstanceSize()));
@@ -1107,7 +1105,7 @@ RawInt32x4* SnapshotReader::NewInt32x4(uint32_t v0, uint32_t v1, uint32_t v2,
RawFloat64x2* SnapshotReader::NewFloat64x2(double v0, double v1) {
- ASSERT(kind_ == Snapshot::kFull);
+ ASSERT(Snapshot::IsFull(kind_));
ASSERT_NO_SAFEPOINT_SCOPE();
RawFloat64x2* obj = reinterpret_cast<RawFloat64x2*>(
AllocateUninitialized(kFloat64x2Cid, Float64x2::InstanceSize()));
@@ -1138,7 +1136,7 @@ RawObject* SnapshotReader::NewInteger(int64_t value) {
if (Smi::IsValid(value)) {
return Smi::New(static_cast<intptr_t>(value));
}
- if (kind_ == Snapshot::kFull) {
+ if (Snapshot::IsFull(kind_)) {
return NewMint(value);
}
return Mint::NewCanonical(value);
@@ -1530,7 +1528,7 @@ RawObject* SnapshotReader::ReadIndexedObject(intptr_t object_id,
if (IsObjectStoreClassId(class_id)) {
return isolate()->class_table()->At(class_id); // get singleton class.
}
- if (kind_ != Snapshot::kFull) {
+ if (!Snapshot::IsFull(kind_)) {
if (IsObjectStoreTypeId(object_id)) {
return GetType(object_store(), object_id); // return type obj.
}
@@ -1548,7 +1546,7 @@ RawObject* SnapshotReader::ReadIndexedObject(intptr_t object_id,
void SnapshotReader::AddPatchRecord(intptr_t object_id,
intptr_t patch_object_id,
intptr_t patch_offset) {
- if (patch_object_id != kInvalidPatchIndex && kind() != Snapshot::kFull) {
+ if (patch_object_id != kInvalidPatchIndex && !Snapshot::IsFull(kind())) {
ASSERT(object_id >= kMaxPredefinedObjectIds);
intptr_t index = (object_id - kMaxPredefinedObjectIds);
ASSERT(index >= max_vm_isolate_object_id_);
@@ -1629,6 +1627,7 @@ void SnapshotReader::ArrayReadFrom(intptr_t object_id,
VmIsolateSnapshotReader::VmIsolateSnapshotReader(
+ Snapshot::Kind kind,
const uint8_t* buffer,
intptr_t size,
const uint8_t* instructions_buffer,
@@ -1638,10 +1637,11 @@ VmIsolateSnapshotReader::VmIsolateSnapshotReader(
size,
instructions_buffer,
data_buffer,
- Snapshot::kFull,
+ kind,
new ZoneGrowableArray<BackRefNode>(
kNumVmIsolateSnapshotReferences),
thread) {
+ ASSERT(Snapshot::IsFull(kind));
}
@@ -1660,7 +1660,7 @@ VmIsolateSnapshotReader::~VmIsolateSnapshotReader() {
RawApiError* VmIsolateSnapshotReader::ReadVmIsolateSnapshot() {
- ASSERT(kind() == Snapshot::kFull);
+ ASSERT(Snapshot::IsFull(kind()));
Thread* thread = Thread::Current();
Isolate* isolate = thread->isolate();
ASSERT(isolate != NULL);
@@ -1690,7 +1690,7 @@ RawApiError* VmIsolateSnapshotReader::ReadVmIsolateSnapshot() {
// only memory.
*(ArrayHandle()) ^= ReadObject();
- if (snapshot_code()) {
+ if (Snapshot::IncludesCode(kind())) {
StubCode::ReadFrom(this);
}
@@ -1704,7 +1704,8 @@ RawApiError* VmIsolateSnapshotReader::ReadVmIsolateSnapshot() {
}
-IsolateSnapshotReader::IsolateSnapshotReader(const uint8_t* buffer,
+IsolateSnapshotReader::IsolateSnapshotReader(Snapshot::Kind kind,
+ const uint8_t* buffer,
intptr_t size,
const uint8_t* instructions_buffer,
const uint8_t* data_buffer,
@@ -1713,11 +1714,12 @@ IsolateSnapshotReader::IsolateSnapshotReader(const uint8_t* buffer,
size,
instructions_buffer,
data_buffer,
- Snapshot::kFull,
+ kind,
new ZoneGrowableArray<BackRefNode>(
kNumInitialReferencesInFullSnapshot),
thread) {
isolate()->set_compilation_allowed(instructions_buffer_ == NULL);
+ ASSERT(Snapshot::IsFull(kind));
}
@@ -1762,19 +1764,18 @@ MessageSnapshotReader::~MessageSnapshotReader() {
}
-SnapshotWriter::SnapshotWriter(Snapshot::Kind kind,
- Thread* thread,
+SnapshotWriter::SnapshotWriter(Thread* thread,
+ Snapshot::Kind kind,
uint8_t** buffer,
ReAlloc alloc,
intptr_t initial_size,
ForwardList* forward_list,
InstructionsWriter* instructions_writer,
bool can_send_any_object,
- bool snapshot_code,
bool vm_isolate_is_symbolic)
: BaseWriter(buffer, alloc, initial_size),
- kind_(kind),
thread_(thread),
+ kind_(kind),
object_store_(isolate()->object_store()),
class_table_(isolate()->class_table()),
forward_list_(forward_list),
@@ -1783,7 +1784,6 @@ SnapshotWriter::SnapshotWriter(Snapshot::Kind kind,
exception_msg_(NULL),
unmarked_objects_(false),
can_send_any_object_(can_send_any_object),
- snapshot_code_(snapshot_code),
vm_isolate_is_symbolic_(vm_isolate_is_symbolic) {
ASSERT(forward_list_ != NULL);
}
@@ -1876,7 +1876,7 @@ bool SnapshotWriter::HandleVMIsolateObject(RawObject* rawobj) {
}
}
- if (kind() == Snapshot::kFull) {
+ if (Snapshot::IsFull(kind())) {
// Check it is a predefined symbol in the VM isolate.
id = Symbols::LookupVMSymbol(rawobj);
if (id != kInvalidIndex) {
@@ -1961,13 +1961,14 @@ class ScriptVisitor : public ObjectVisitor {
};
-FullSnapshotWriter::FullSnapshotWriter(uint8_t** vm_isolate_snapshot_buffer,
+FullSnapshotWriter::FullSnapshotWriter(Snapshot::Kind kind,
+ uint8_t** vm_isolate_snapshot_buffer,
uint8_t** isolate_snapshot_buffer,
ReAlloc alloc,
InstructionsWriter* instructions_writer,
- bool snapshot_code,
bool vm_isolate_is_symbolic)
: thread_(Thread::Current()),
+ kind_(kind),
vm_isolate_snapshot_buffer_(vm_isolate_snapshot_buffer),
isolate_snapshot_buffer_(isolate_snapshot_buffer),
alloc_(alloc),
@@ -1977,7 +1978,6 @@ FullSnapshotWriter::FullSnapshotWriter(uint8_t** vm_isolate_snapshot_buffer,
instructions_writer_(instructions_writer),
scripts_(Array::Handle(zone())),
symbol_table_(Array::Handle(zone())),
- snapshot_code_(snapshot_code),
vm_isolate_is_symbolic_(vm_isolate_is_symbolic) {
ASSERT(isolate_snapshot_buffer_ != NULL);
ASSERT(alloc_ != NULL);
@@ -2029,15 +2029,14 @@ FullSnapshotWriter::~FullSnapshotWriter() {
void FullSnapshotWriter::WriteVmIsolateSnapshot() {
ASSERT(vm_isolate_snapshot_buffer_ != NULL);
- SnapshotWriter writer(Snapshot::kFull,
- thread(),
+ SnapshotWriter writer(thread(),
+ kind_,
vm_isolate_snapshot_buffer_,
alloc_,
kInitialSize,
forward_list_,
instructions_writer_,
true, /* can_send_any_object */
- snapshot_code_,
vm_isolate_is_symbolic_);
// Write full snapshot for the VM isolate.
// Setup for long jump in case there is an exception while writing
@@ -2064,7 +2063,7 @@ void FullSnapshotWriter::WriteVmIsolateSnapshot() {
// read only memory.
writer.WriteObject(scripts_.raw());
- if (snapshot_code_) {
+ if (Snapshot::IncludesCode(kind_)) {
ASSERT(!vm_isolate_is_symbolic_);
StubCode::WriteTo(&writer);
}
@@ -2080,15 +2079,14 @@ void FullSnapshotWriter::WriteVmIsolateSnapshot() {
void FullSnapshotWriter::WriteIsolateFullSnapshot() {
- SnapshotWriter writer(Snapshot::kFull,
- thread(),
+ SnapshotWriter writer(thread(),
+ kind_,
isolate_snapshot_buffer_,
alloc_,
kInitialSize,
forward_list_,
instructions_writer_,
true, /* can_send_any_object */
- snapshot_code_,
true /* vm_isolate_is_symbolic */);
ObjectStore* object_store = isolate()->object_store();
ASSERT(object_store != NULL);
@@ -2110,8 +2108,7 @@ void FullSnapshotWriter::WriteIsolateFullSnapshot() {
// is the root set for all dart allocated objects at this point.
SnapshotWriterVisitor visitor(&writer, false);
visitor.VisitPointers(object_store->from(),
- snapshot_code_ ? object_store->to()
- : object_store->to_snapshot());
+ object_store->to_snapshot(kind_));
// Write out all forwarded objects.
writer.WriteForwardedObjects();
@@ -2130,7 +2127,7 @@ void FullSnapshotWriter::WriteFullSnapshot() {
WriteVmIsolateSnapshot();
}
WriteIsolateFullSnapshot();
- if (snapshot_code_) {
+ if (Snapshot::IncludesCode(kind_)) {
instructions_writer_->Write();
OS::Print("VMIsolate(CodeSize): %" Pd "\n", VmIsolateSnapshotSize());
@@ -2150,11 +2147,11 @@ PrecompiledSnapshotWriter::PrecompiledSnapshotWriter(
uint8_t** isolate_snapshot_buffer,
ReAlloc alloc,
InstructionsWriter* instructions_writer)
- : FullSnapshotWriter(vm_isolate_snapshot_buffer,
+ : FullSnapshotWriter(Snapshot::kAppNoJIT,
+ vm_isolate_snapshot_buffer,
isolate_snapshot_buffer,
alloc,
instructions_writer,
- true, /* snapshot_code */
false /* vm_isolate_is_symbolic */) {
}
@@ -2240,14 +2237,14 @@ bool SnapshotWriter::CheckAndWritePredefinedObject(RawObject* rawobj) {
// Check if it is a code object in that case just write a Null object
// as we do not want code objects in the snapshot.
- if (cid == kCodeCid && !snapshot_code()) {
+ if (cid == kCodeCid && !Snapshot::IncludesCode(kind_)) {
WriteVMIsolateObject(kNullObject);
return true;
}
// Check if classes are not being serialized and it is preinitialized type
// or a predefined internal VM class in the object store.
- if (kind_ != Snapshot::kFull) {
+ if (!Snapshot::IsFull(kind_)) {
// Check if it is an internal VM class which is in the object store.
if (cid == kClassCid) {
RawClass* raw_class = reinterpret_cast<RawClass*>(rawobj);
@@ -2402,7 +2399,7 @@ void ForwardList::SerializeAll(ObjectVisitor* writer) {
void SnapshotWriter::WriteClassId(RawClass* cls) {
- ASSERT(kind_ != Snapshot::kFull);
+ ASSERT(!Snapshot::IsFull(kind_));
int class_id = cls->ptr()->id_;
ASSERT(!IsSingletonClassId(class_id) && !IsObjectStoreClassId(class_id));
@@ -2662,15 +2659,14 @@ intptr_t SnapshotWriter::FirstObjectId() {
ScriptSnapshotWriter::ScriptSnapshotWriter(uint8_t** buffer,
ReAlloc alloc)
- : SnapshotWriter(Snapshot::kScript,
- Thread::Current(),
+ : SnapshotWriter(Thread::Current(),
+ Snapshot::kScript,
buffer,
alloc,
kInitialSize,
&forward_list_,
NULL, /* instructions_writer */
true, /* can_send_any_object */
- false, /* snapshot_code */
true /* vm_isolate_is_symbolic */),
forward_list_(thread(), kMaxPredefinedObjectIds) {
ASSERT(buffer != NULL);
@@ -2719,15 +2715,14 @@ void SnapshotWriterVisitor::VisitPointers(RawObject** first, RawObject** last) {
MessageWriter::MessageWriter(uint8_t** buffer,
ReAlloc alloc,
bool can_send_any_object)
- : SnapshotWriter(Snapshot::kMessage,
- Thread::Current(),
+ : SnapshotWriter(Thread::Current(),
+ Snapshot::kMessage,
buffer,
alloc,
kInitialSize,
&forward_list_,
NULL, /* instructions_writer */
can_send_any_object,
- false, /* snapshot_code */
true /* vm_isolate_is_symbolic */),
forward_list_(thread(), kMaxPredefinedObjectIds) {
ASSERT(buffer != NULL);
« no previous file with comments | « runtime/vm/snapshot.h ('k') | runtime/vm/snapshot_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698