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

Unified Diff: src/snapshot-external.cc

Issue 781443002: Encode reservation meta data in the snapshot blob. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@snapshotformat
Patch Set: rebased Created 6 years 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 | « src/snapshot-empty.cc ('k') | src/snapshot-source-sink.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/snapshot-external.cc
diff --git a/src/snapshot-external.cc b/src/snapshot-external.cc
index b75e232295096aa124a537b4aa1d0fb4e8f16734..1e5aec9250600c643a5e78942714eda64490f790 100644
--- a/src/snapshot-external.cc
+++ b/src/snapshot-external.cc
@@ -18,25 +18,8 @@ struct SnapshotImpl {
public:
const byte* data;
int size;
- int new_space_used;
- int pointer_space_used;
- int data_space_used;
- int code_space_used;
- int map_space_used;
- int cell_space_used;
- int property_cell_space_used;
- int lo_space_used;
-
const byte* context_data;
int context_size;
- int context_new_space_used;
- int context_pointer_space_used;
- int context_data_space_used;
- int context_code_space_used;
- int context_map_space_used;
- int context_cell_space_used;
- int context_property_cell_space_used;
- int context_lo_space_used;
};
@@ -49,25 +32,13 @@ bool Snapshot::HaveASnapshotToStartFrom() {
bool Snapshot::Initialize(Isolate* isolate) {
- if (!HaveASnapshotToStartFrom())
- return false;
-
+ if (!HaveASnapshotToStartFrom()) return false;
base::ElapsedTimer timer;
- if (FLAG_profile_deserialization) {
- timer.Start();
- }
- SnapshotByteSource source(snapshot_impl_->data, snapshot_impl_->size);
- Deserializer deserializer(&source);
- deserializer.AddReservation(NEW_SPACE, snapshot_impl_->new_space_used);
- deserializer.AddReservation(OLD_POINTER_SPACE,
- snapshot_impl_->pointer_space_used);
- deserializer.AddReservation(OLD_DATA_SPACE, snapshot_impl_->data_space_used);
- deserializer.AddReservation(CODE_SPACE, snapshot_impl_->code_space_used);
- deserializer.AddReservation(MAP_SPACE, snapshot_impl_->map_space_used);
- deserializer.AddReservation(CELL_SPACE, snapshot_impl_->cell_space_used);
- deserializer.AddReservation(PROPERTY_CELL_SPACE,
- snapshot_impl_->property_cell_space_used);
- deserializer.AddReservation(LO_SPACE, snapshot_impl_->lo_space_used);
+ if (FLAG_profile_deserialization) timer.Start();
+
+
+ SnapshotData snapshot_data(snapshot_impl_->data, snapshot_impl_->size);
+ Deserializer deserializer(&snapshot_data);
bool success = isolate->Init(&deserializer);
if (FLAG_profile_deserialization) {
double ms = timer.Elapsed().InMillisecondsF();
@@ -78,27 +49,11 @@ bool Snapshot::Initialize(Isolate* isolate) {
Handle<Context> Snapshot::NewContextFromSnapshot(Isolate* isolate) {
- if (!HaveASnapshotToStartFrom())
- return Handle<Context>();
-
- SnapshotByteSource source(snapshot_impl_->context_data,
- snapshot_impl_->context_size);
- Deserializer deserializer(&source);
- deserializer.AddReservation(NEW_SPACE,
- snapshot_impl_->context_new_space_used);
- deserializer.AddReservation(OLD_POINTER_SPACE,
- snapshot_impl_->context_pointer_space_used);
- deserializer.AddReservation(OLD_DATA_SPACE,
- snapshot_impl_->context_data_space_used);
- deserializer.AddReservation(CODE_SPACE,
- snapshot_impl_->context_code_space_used);
- deserializer.AddReservation(MAP_SPACE,
- snapshot_impl_->context_map_space_used);
- deserializer.AddReservation(CELL_SPACE,
- snapshot_impl_->context_cell_space_used);
- deserializer.AddReservation(PROPERTY_CELL_SPACE,
- snapshot_impl_->context_property_cell_space_used);
- deserializer.AddReservation(LO_SPACE, snapshot_impl_->context_lo_space_used);
+ if (!HaveASnapshotToStartFrom()) return Handle<Context>();
+
+ SnapshotData snapshot_data(snapshot_impl_->context_data,
+ snapshot_impl_->context_size);
+ Deserializer deserializer(&snapshot_data);
Object* root;
deserializer.DeserializePartial(isolate, &root);
CHECK(root->IsContext());
@@ -115,29 +70,10 @@ void SetSnapshotFromFile(StartupData* snapshot_blob) {
snapshot_impl_ = new SnapshotImpl;
SnapshotByteSource source(reinterpret_cast<const byte*>(snapshot_blob->data),
snapshot_blob->raw_size);
-
bool success = source.GetBlob(&snapshot_impl_->data,
&snapshot_impl_->size);
- snapshot_impl_->new_space_used = source.GetInt();
- snapshot_impl_->pointer_space_used = source.GetInt();
- snapshot_impl_->data_space_used = source.GetInt();
- snapshot_impl_->code_space_used = source.GetInt();
- snapshot_impl_->map_space_used = source.GetInt();
- snapshot_impl_->cell_space_used = source.GetInt();
- snapshot_impl_->property_cell_space_used = source.GetInt();
- snapshot_impl_->lo_space_used = source.GetInt();
-
success &= source.GetBlob(&snapshot_impl_->context_data,
&snapshot_impl_->context_size);
- snapshot_impl_->context_new_space_used = source.GetInt();
- snapshot_impl_->context_pointer_space_used = source.GetInt();
- snapshot_impl_->context_data_space_used = source.GetInt();
- snapshot_impl_->context_code_space_used = source.GetInt();
- snapshot_impl_->context_map_space_used = source.GetInt();
- snapshot_impl_->context_cell_space_used = source.GetInt();
- snapshot_impl_->context_property_cell_space_used = source.GetInt();
- snapshot_impl_->context_lo_space_used = source.GetInt();
-
DCHECK(success);
}
« no previous file with comments | « src/snapshot-empty.cc ('k') | src/snapshot-source-sink.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698