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

Unified Diff: runtime/vm/snapshot_test.cc

Issue 1123813002: Move symbol table from per isolate snapshot to vm isolate snapshot, this reduces the per isolate in… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 5 years, 7 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.cc ('k') | runtime/vm/symbols.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/snapshot_test.cc
===================================================================
--- runtime/vm/snapshot_test.cc (revision 45789)
+++ runtime/vm/snapshot_test.cc (working copy)
@@ -157,8 +157,10 @@
intptr_t buffer_len = writer.BytesWritten();
// Read object back from the snapshot.
- SnapshotReader reader(buffer, buffer_len,
- Snapshot::kMessage, Isolate::Current(), zone.GetZone());
+ MessageSnapshotReader reader(buffer,
+ buffer_len,
+ Isolate::Current(),
+ zone.GetZone());
const Object& serialized_object = Object::Handle(reader.ReadObject());
EXPECT(Equals(null_object, serialized_object));
@@ -183,8 +185,10 @@
intptr_t buffer_len = writer.BytesWritten();
// Read object back from the snapshot.
- SnapshotReader reader(buffer, buffer_len,
- Snapshot::kMessage, Isolate::Current(), zone.GetZone());
+ MessageSnapshotReader reader(buffer,
+ buffer_len,
+ Isolate::Current(),
+ zone.GetZone());
const Object& serialized_object = Object::Handle(reader.ReadObject());
EXPECT(Equals(smi, serialized_object));
@@ -210,8 +214,10 @@
intptr_t buffer_len = writer.BytesWritten();
// Read object back from the snapshot.
- SnapshotReader reader(buffer, buffer_len,
- Snapshot::kMessage, Isolate::Current(), zone.GetZone());
+ MessageSnapshotReader reader(buffer,
+ buffer_len,
+ Isolate::Current(),
+ zone.GetZone());
const Object& serialized_object = Object::Handle(reader.ReadObject());
EXPECT(Equals(smi, serialized_object));
@@ -234,9 +240,10 @@
intptr_t buffer_len = writer.BytesWritten();
// Read object back from the snapshot.
- SnapshotReader reader(buffer, buffer_len,
- Snapshot::kMessage, Isolate::Current(),
- Thread::Current()->zone());
+ MessageSnapshotReader reader(buffer,
+ buffer_len,
+ Isolate::Current(),
+ Thread::Current()->zone());
const Object& serialized_object = Object::Handle(reader.ReadObject());
EXPECT(serialized_object.IsMint());
@@ -306,8 +313,10 @@
intptr_t buffer_len = writer.BytesWritten();
// Read object back from the snapshot.
- SnapshotReader reader(buffer, buffer_len,
- Snapshot::kMessage, Isolate::Current(), zone.GetZone());
+ MessageSnapshotReader reader(buffer,
+ buffer_len,
+ Isolate::Current(),
+ zone.GetZone());
const Object& serialized_object = Object::Handle(reader.ReadObject());
EXPECT(Equals(dbl, serialized_object));
@@ -333,8 +342,10 @@
intptr_t buffer_len = writer.BytesWritten();
// Read object back from the snapshot.
- SnapshotReader reader(buffer, buffer_len,
- Snapshot::kMessage, Isolate::Current(), zone.GetZone());
+ MessageSnapshotReader reader(buffer,
+ buffer_len,
+ Isolate::Current(),
+ zone.GetZone());
const Object& serialized_object = Object::Handle(reader.ReadObject());
fprintf(stderr, "%s / %s\n", bl.ToCString(), serialized_object.ToCString());
@@ -362,8 +373,10 @@
intptr_t buffer_len = writer.BytesWritten();
// Read object back from the snapshot.
- SnapshotReader reader(buffer, buffer_len,
- Snapshot::kMessage, Isolate::Current(), zone.GetZone());
+ MessageSnapshotReader reader(buffer,
+ buffer_len,
+ Isolate::Current(),
+ zone.GetZone());
const Object& serialized_object = Object::Handle(reader.ReadObject());
EXPECT(Equals(bl, serialized_object));
@@ -397,8 +410,10 @@
intptr_t buffer_len = writer.BytesWritten();
// Read object back from the snapshot.
- SnapshotReader reader(buffer, buffer_len,
- Snapshot::kMessage, Isolate::Current(), zone.GetZone());
+ MessageSnapshotReader reader(buffer,
+ buffer_len,
+ Isolate::Current(),
+ zone.GetZone());
Bigint& obj = Bigint::Handle();
obj ^= reader.ReadObject();
@@ -425,9 +440,10 @@
intptr_t buffer_len = writer.BytesWritten();
// Read object back from the snapshot.
- SnapshotReader reader(buffer, buffer_len,
- Snapshot::kMessage, Isolate::Current(),
- Thread::Current()->zone());
+ MessageSnapshotReader reader(buffer,
+ buffer_len,
+ Isolate::Current(),
+ Thread::Current()->zone());
Bigint& serialized_bigint = Bigint::Handle();
serialized_bigint ^= reader.ReadObject();
const char* str1 = bigint.ToHexCString(allocator);
@@ -490,8 +506,10 @@
intptr_t buffer_len = writer.BytesWritten();
// Read object back from the snapshot.
- SnapshotReader reader(buffer, buffer_len, Snapshot::kMessage,
- Isolate::Current(), Thread::Current()->zone());
+ MessageSnapshotReader reader(buffer,
+ buffer_len,
+ Isolate::Current(),
+ Thread::Current()->zone());
EXPECT(Object::class_class() == reader.ReadObject());
EXPECT(Object::type_arguments_class() == reader.ReadObject());
EXPECT(Object::function_class() == reader.ReadObject());
@@ -521,8 +539,10 @@
intptr_t buffer_len = writer.BytesWritten();
// Read object back from the snapshot.
- SnapshotReader reader(buffer, buffer_len,
- Snapshot::kMessage, Isolate::Current(), zone.GetZone());
+ MessageSnapshotReader reader(buffer,
+ buffer_len,
+ Isolate::Current(),
+ zone.GetZone());
String& serialized_str = String::Handle();
serialized_str ^= reader.ReadObject();
EXPECT(str.Equals(serialized_str));
@@ -569,8 +589,10 @@
intptr_t buffer_len = writer.BytesWritten();
// Read object back from the snapshot.
- SnapshotReader reader(buffer, buffer_len,
- Snapshot::kMessage, Isolate::Current(), zone.GetZone());
+ MessageSnapshotReader reader(buffer,
+ buffer_len,
+ Isolate::Current(),
+ zone.GetZone());
Array& serialized_array = Array::Handle();
serialized_array ^= reader.ReadObject();
EXPECT(array.CanonicalizeEquals(serialized_array));
@@ -654,8 +676,10 @@
intptr_t buffer_len = writer.BytesWritten();
// Read object back from the snapshot.
- SnapshotReader reader(buffer, buffer_len,
- Snapshot::kMessage, Isolate::Current(), zone.GetZone());
+ MessageSnapshotReader reader(buffer,
+ buffer_len,
+ Isolate::Current(),
+ zone.GetZone());
Array& serialized_array = Array::Handle();
serialized_array ^= reader.ReadObject();
EXPECT(array.CanonicalizeEquals(serialized_array));
@@ -687,8 +711,10 @@
intptr_t buffer_len = writer.BytesWritten();
// Read object back from the snapshot.
- SnapshotReader reader(buffer, buffer_len,
- Snapshot::kMessage, Isolate::Current(), zone.GetZone());
+ MessageSnapshotReader reader(buffer,
+ buffer_len,
+ Isolate::Current(),
+ zone.GetZone());
TypedData& serialized_typed_data = TypedData::Handle();
serialized_typed_data ^= reader.ReadObject();
EXPECT(serialized_typed_data.IsTypedData());
@@ -720,8 +746,8 @@
} \
writer.WriteMessage(array); \
intptr_t buffer_len = writer.BytesWritten(); \
- SnapshotReader reader(buffer, buffer_len, \
- Snapshot::kMessage, Isolate::Current(), \
+ MessageSnapshotReader reader(buffer, buffer_len, \
+ Isolate::Current(), \
zone.GetZone()); \
TypedData& serialized_array = TypedData::Handle(); \
serialized_array ^= reader.ReadObject(); \
@@ -745,8 +771,8 @@
MessageWriter writer(&buffer, &zone_allocator, true); \
writer.WriteMessage(array); \
intptr_t buffer_len = writer.BytesWritten(); \
- SnapshotReader reader(buffer, buffer_len, \
- Snapshot::kMessage, Isolate::Current(), \
+ MessageSnapshotReader reader(buffer, buffer_len, \
+ Isolate::Current(), \
zone.GetZone()); \
TypedData& serialized_array = TypedData::Handle(); \
serialized_array ^= reader.ReadObject(); \
@@ -798,8 +824,10 @@
intptr_t buffer_len = writer.BytesWritten();
// Read object back from the snapshot.
- SnapshotReader reader(buffer, buffer_len,
- Snapshot::kMessage, Isolate::Current(), zone.GetZone());
+ MessageSnapshotReader reader(buffer,
+ buffer_len,
+ Isolate::Current(),
+ zone.GetZone());
TypedData& serialized_typed_data = TypedData::Handle();
serialized_typed_data ^= reader.ReadObject();
EXPECT(serialized_typed_data.IsTypedData());
@@ -820,7 +848,13 @@
public:
static const intptr_t kInitialSize = 64 * KB;
TestSnapshotWriter(uint8_t** buffer, ReAlloc alloc)
- : SnapshotWriter(Snapshot::kScript, buffer, alloc, kInitialSize, true) {
+ : SnapshotWriter(Snapshot::kScript,
+ buffer,
+ alloc,
+ kInitialSize,
+ &forward_list_,
+ true),
+ forward_list_(SnapshotWriter::FirstObjectId()) {
ASSERT(buffer != NULL);
ASSERT(alloc != NULL);
}
@@ -833,6 +867,8 @@
}
private:
+ ForwardList forward_list_;
+
DISALLOW_COPY_AND_ASSIGN(TestSnapshotWriter);
};
@@ -929,9 +965,10 @@
writer.WriteScript(script);
// Read object back from the snapshot.
- SnapshotReader reader(buffer, writer.BytesWritten(),
- Snapshot::kScript, Isolate::Current(),
- Thread::Current()->zone());
+ ScriptSnapshotReader reader(buffer,
+ writer.BytesWritten(),
+ Isolate::Current(),
+ Thread::Current()->zone());
Script& serialized_script = Script::Handle();
serialized_script ^= reader.ReadObject();
@@ -1029,7 +1066,6 @@
"}\n";
Dart_Handle result;
- uint8_t* vm_isolate_snapshot_buffer;
uint8_t* isolate_snapshot_buffer;
// Start an Isolate, load a script and create a full snapshot.
@@ -1049,7 +1085,7 @@
OS::PrintErr("Without Snapshot: %" Pd64 "us\n", timer1.TotalElapsedTime());
// Write snapshot with object content.
- FullSnapshotWriter writer(&vm_isolate_snapshot_buffer,
+ FullSnapshotWriter writer(NULL,
&isolate_snapshot_buffer,
&malloc_allocator);
writer.WriteFullSnapshot();
@@ -1086,7 +1122,6 @@
};
const char* kScriptChars = kFullSnapshotScriptChars;
- uint8_t* vm_isolate_snapshot_buffer;
uint8_t* isolate_snapshot_buffer;
// Start an Isolate, load a script and create a full snapshot.
@@ -1106,7 +1141,7 @@
OS::PrintErr("Without Snapshot: %" Pd64 "us\n", timer1.TotalElapsedTime());
// Write snapshot with object content.
- FullSnapshotWriter writer(&vm_isolate_snapshot_buffer,
+ FullSnapshotWriter writer(NULL,
&isolate_snapshot_buffer,
&malloc_allocator);
writer.WriteFullSnapshot();
@@ -1189,7 +1224,6 @@
uint8_t* buffer;
intptr_t size;
- uint8_t* vm_isolate_snapshot = NULL;
intptr_t vm_isolate_snapshot_size;
uint8_t* isolate_snapshot = NULL;
intptr_t isolate_snapshot_size;
@@ -1204,7 +1238,7 @@
Dart_EnterScope(); // Start a Dart API scope for invoking API functions.
// Write out the script snapshot.
- result = Dart_CreateSnapshot(&vm_isolate_snapshot,
+ result = Dart_CreateSnapshot(NULL,
&vm_isolate_snapshot_size,
&isolate_snapshot,
&isolate_snapshot_size);
@@ -1288,7 +1322,6 @@
Dart_Handle result;
uint8_t* buffer;
intptr_t size;
- uint8_t* vm_isolate_snapshot = NULL;
intptr_t vm_isolate_snapshot_size;
uint8_t* isolate_snapshot = NULL;
intptr_t isolate_snapshot_size;
@@ -1301,7 +1334,7 @@
Dart_EnterScope(); // Start a Dart API scope for invoking API functions.
// Write out the script snapshot.
- result = Dart_CreateSnapshot(&vm_isolate_snapshot,
+ result = Dart_CreateSnapshot(NULL,
&vm_isolate_snapshot_size,
&isolate_snapshot,
&isolate_snapshot_size);
@@ -1372,7 +1405,6 @@
uint8_t* buffer;
intptr_t size;
- uint8_t* vm_isolate_snapshot = NULL;
intptr_t vm_isolate_snapshot_size;
uint8_t* isolate_snapshot = NULL;
intptr_t isolate_snapshot_size;
@@ -1389,7 +1421,7 @@
Dart_EnterScope(); // Start a Dart API scope for invoking API functions.
// Write out the script snapshot.
- result = Dart_CreateSnapshot(&vm_isolate_snapshot,
+ result = Dart_CreateSnapshot(NULL,
&vm_isolate_snapshot_size,
&isolate_snapshot,
&isolate_snapshot_size);
@@ -1472,7 +1504,10 @@
// Read object back from the snapshot into a C structure.
ApiNativeScope scope;
- ApiMessageReader api_reader(buffer, writer.BytesWritten(), &zone_allocator);
+ ApiMessageReader api_reader(buffer,
+ writer.BytesWritten(),
+ &zone_allocator,
+ false);
Dart_CObject* root = api_reader.ReadMessage();
EXPECT_EQ(Dart_CObject_kArray, root->type);
EXPECT_EQ(kArrayLength, root->value.as_array.length);
« no previous file with comments | « runtime/vm/snapshot.cc ('k') | runtime/vm/symbols.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698