Index: runtime/vm/snapshot.cc |
=================================================================== |
--- runtime/vm/snapshot.cc (revision 11276) |
+++ runtime/vm/snapshot.cc (working copy) |
@@ -114,6 +114,11 @@ |
} |
+static Heap::Space space(Snapshot::Kind kind) { |
cshapiro
2012/08/25 03:30:11
Is this change missing heap.h or am I confused?
L
siva
2012/08/27 17:15:21
I would have preferred to put this in snapshot.h b
|
+ return (kind == Snapshot::kMessage) ? Heap::kNew : Heap::kOld; |
+} |
+ |
+ |
// TODO(5411462): Temporary setup of snapshot for testing purposes, |
// the actual creation of a snapshot maybe done differently. |
const Snapshot* Snapshot::SetupFromBuffer(const void* raw_memory) { |
@@ -198,7 +203,7 @@ |
RawObject* SnapshotReader::ReadObjectImpl() { |
int64_t value = Read<int64_t>(); |
if ((value & kSmiTagMask) == 0) { |
- return Integer::New((value >> kSmiTagShift)); |
+ return Integer::New((value >> kSmiTagShift), space(kind_)); |
} |
return ReadObjectImpl(value); |
} |
@@ -221,7 +226,7 @@ |
RawObject* SnapshotReader::ReadObjectRef() { |
int64_t header_value = Read<int64_t>(); |
if ((header_value & kSmiTagMask) == 0) { |
- return Integer::New((header_value >> kSmiTagShift)); |
+ return Integer::New((header_value >> kSmiTagShift), space(kind_)); |
} |
ASSERT((header_value <= kIntptrMax) && (header_value >= kIntptrMin)); |
if (IsVMIsolateObject(header_value)) { |
@@ -250,7 +255,7 @@ |
if (kind_ == Snapshot::kFull) { |
result ^= AllocateUninitialized(cls_, instance_size); |
} else { |
- result ^= Object::Allocate(cls_.id(), instance_size, Heap::kNew); |
+ result ^= Object::Allocate(cls_.id(), instance_size, space(kind_)); |
} |
return result.raw(); |
} |
@@ -266,7 +271,8 @@ |
intptr_t len = ReadSmiValue(); |
Array& array = Array::ZoneHandle( |
isolate(), |
- (kind_ == Snapshot::kFull) ? NewArray(len) : Array::New(len)); |
+ ((kind_ == Snapshot::kFull) ? |
+ NewArray(len) : Array::New(len, space(kind_)))); |
AddBackRef(object_id, &array, kIsNotDeserialized); |
return array.raw(); |
@@ -277,7 +283,7 @@ |
ImmutableArray& array = ImmutableArray::ZoneHandle( |
isolate(), |
(kind_ == Snapshot::kFull) ? |
- NewImmutableArray(len) : ImmutableArray::New(len)); |
+ NewImmutableArray(len) : ImmutableArray::New(len, space(kind_))); |
AddBackRef(object_id, &array, kIsNotDeserialized); |
return array.raw(); |
@@ -661,7 +667,7 @@ |
if (kind_ == Snapshot::kFull) { |
*result ^= AllocateUninitialized(cls_, instance_size); |
} else { |
- *result ^= Object::Allocate(cls_.id(), instance_size, Heap::kNew); |
+ *result ^= Object::Allocate(cls_.id(), instance_size, space(kind_)); |
} |
} else { |
cls_ ^= ReadObjectImpl(); |