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

Unified Diff: src/snapshot-common.cc

Issue 780833002: Revert of Encode reservation meta data in the snapshot blob. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@snapshotformat
Patch Set: 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.h ('k') | src/snapshot-empty.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/snapshot-common.cc
diff --git a/src/snapshot-common.cc b/src/snapshot-common.cc
index f06f38a19983665b1f233251a3a0692169601688..b152ad354b660f16b82bb4c8edee84eaf0342237 100644
--- a/src/snapshot-common.cc
+++ b/src/snapshot-common.cc
@@ -14,14 +14,27 @@
namespace v8 {
namespace internal {
+void Snapshot::ReserveSpaceForLinkedInSnapshot(Deserializer* deserializer) {
+ deserializer->AddReservation(NEW_SPACE, new_space_used_);
+ deserializer->AddReservation(OLD_POINTER_SPACE, pointer_space_used_);
+ deserializer->AddReservation(OLD_DATA_SPACE, data_space_used_);
+ deserializer->AddReservation(CODE_SPACE, code_space_used_);
+ deserializer->AddReservation(MAP_SPACE, map_space_used_);
+ deserializer->AddReservation(CELL_SPACE, cell_space_used_);
+ deserializer->AddReservation(PROPERTY_CELL_SPACE, property_cell_space_used_);
+ deserializer->AddReservation(LO_SPACE, lo_space_used_);
+}
+
bool Snapshot::Initialize(Isolate* isolate) {
if (size_ > 0) {
base::ElapsedTimer timer;
- if (FLAG_profile_deserialization) timer.Start();
-
- SnapshotData snapshot_data(data_, size_);
- Deserializer deserializer(&snapshot_data);
+ if (FLAG_profile_deserialization) {
+ timer.Start();
+ }
+ SnapshotByteSource source(raw_data_, raw_size_);
+ Deserializer deserializer(&source);
+ ReserveSpaceForLinkedInSnapshot(&deserializer);
bool success = isolate->Init(&deserializer);
if (FLAG_profile_deserialization) {
double ms = timer.Elapsed().InMillisecondsF();
@@ -39,11 +52,22 @@
Handle<Context> Snapshot::NewContextFromSnapshot(Isolate* isolate) {
- if (context_size_ == 0) return Handle<Context>();
-
- SnapshotData snapshot_data(context_data_, context_size_);
- Deserializer deserializer(&snapshot_data);
+ if (context_size_ == 0) {
+ return Handle<Context>();
+ }
+ SnapshotByteSource source(context_raw_data_,
+ context_raw_size_);
+ Deserializer deserializer(&source);
Object* root;
+ deserializer.AddReservation(NEW_SPACE, context_new_space_used_);
+ deserializer.AddReservation(OLD_POINTER_SPACE, context_pointer_space_used_);
+ deserializer.AddReservation(OLD_DATA_SPACE, context_data_space_used_);
+ deserializer.AddReservation(CODE_SPACE, context_code_space_used_);
+ deserializer.AddReservation(MAP_SPACE, context_map_space_used_);
+ deserializer.AddReservation(CELL_SPACE, context_cell_space_used_);
+ deserializer.AddReservation(PROPERTY_CELL_SPACE,
+ context_property_cell_space_used_);
+ deserializer.AddReservation(LO_SPACE, context_lo_space_used_);
deserializer.DeserializePartial(isolate, &root);
CHECK(root->IsContext());
return Handle<Context>(Context::cast(root));
« no previous file with comments | « src/snapshot.h ('k') | src/snapshot-empty.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698