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

Side by Side Diff: src/snapshot-external.cc

Issue 583153002: Reland 24052 - Require V8 to be explicitly initialized before an Isolate is created (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 3 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/snapshot-common.cc ('k') | src/v8.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Used for building with external snapshots. 5 // Used for building with external snapshots.
6 6
7 #include "src/snapshot.h" 7 #include "src/snapshot.h"
8 8
9 #include "src/serialize.h" 9 #include "src/serialize.h"
10 #include "src/snapshot-source-sink.h" 10 #include "src/snapshot-source-sink.h"
(...skipping 28 matching lines...) Expand all
39 39
40 40
41 static SnapshotImpl* snapshot_impl_ = NULL; 41 static SnapshotImpl* snapshot_impl_ = NULL;
42 42
43 43
44 bool Snapshot::HaveASnapshotToStartFrom() { 44 bool Snapshot::HaveASnapshotToStartFrom() {
45 return snapshot_impl_ != NULL; 45 return snapshot_impl_ != NULL;
46 } 46 }
47 47
48 48
49 bool Snapshot::Initialize() { 49 bool Snapshot::Initialize(Isolate* isolate) {
50 if (!HaveASnapshotToStartFrom()) 50 if (!HaveASnapshotToStartFrom())
51 return false; 51 return false;
52 52
53 base::ElapsedTimer timer; 53 base::ElapsedTimer timer;
54 if (FLAG_profile_deserialization) { 54 if (FLAG_profile_deserialization) {
55 timer.Start(); 55 timer.Start();
56 } 56 }
57 SnapshotByteSource source(snapshot_impl_->data, snapshot_impl_->size); 57 SnapshotByteSource source(snapshot_impl_->data, snapshot_impl_->size);
58 Deserializer deserializer(&source); 58 Deserializer deserializer(&source);
59 deserializer.set_reservation(NEW_SPACE, snapshot_impl_->new_space_used); 59 deserializer.set_reservation(NEW_SPACE, snapshot_impl_->new_space_used);
60 deserializer.set_reservation(OLD_POINTER_SPACE, 60 deserializer.set_reservation(OLD_POINTER_SPACE,
61 snapshot_impl_->pointer_space_used); 61 snapshot_impl_->pointer_space_used);
62 deserializer.set_reservation(OLD_DATA_SPACE, 62 deserializer.set_reservation(OLD_DATA_SPACE,
63 snapshot_impl_->data_space_used); 63 snapshot_impl_->data_space_used);
64 deserializer.set_reservation(CODE_SPACE, snapshot_impl_->code_space_used); 64 deserializer.set_reservation(CODE_SPACE, snapshot_impl_->code_space_used);
65 deserializer.set_reservation(MAP_SPACE, snapshot_impl_->map_space_used); 65 deserializer.set_reservation(MAP_SPACE, snapshot_impl_->map_space_used);
66 deserializer.set_reservation(CELL_SPACE, snapshot_impl_->cell_space_used); 66 deserializer.set_reservation(CELL_SPACE, snapshot_impl_->cell_space_used);
67 deserializer.set_reservation(PROPERTY_CELL_SPACE, 67 deserializer.set_reservation(PROPERTY_CELL_SPACE,
68 snapshot_impl_->property_cell_space_used); 68 snapshot_impl_->property_cell_space_used);
69 bool success = V8::Initialize(&deserializer); 69 bool success = isolate->Init(&deserializer);
70 if (FLAG_profile_deserialization) { 70 if (FLAG_profile_deserialization) {
71 double ms = timer.Elapsed().InMillisecondsF(); 71 double ms = timer.Elapsed().InMillisecondsF();
72 PrintF("[Snapshot loading and deserialization took %0.3f ms]\n", ms); 72 PrintF("[Snapshot loading and deserialization took %0.3f ms]\n", ms);
73 } 73 }
74 return success; 74 return success;
75 } 75 }
76 76
77 77
78 Handle<Context> Snapshot::NewContextFromSnapshot(Isolate* isolate) { 78 Handle<Context> Snapshot::NewContextFromSnapshot(Isolate* isolate) {
79 if (!HaveASnapshotToStartFrom()) 79 if (!HaveASnapshotToStartFrom())
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 snapshot_impl_->context_data_space_used = source.GetInt(); 131 snapshot_impl_->context_data_space_used = source.GetInt();
132 snapshot_impl_->context_code_space_used = source.GetInt(); 132 snapshot_impl_->context_code_space_used = source.GetInt();
133 snapshot_impl_->context_map_space_used = source.GetInt(); 133 snapshot_impl_->context_map_space_used = source.GetInt();
134 snapshot_impl_->context_cell_space_used = source.GetInt(); 134 snapshot_impl_->context_cell_space_used = source.GetInt();
135 snapshot_impl_->context_property_cell_space_used = source.GetInt(); 135 snapshot_impl_->context_property_cell_space_used = source.GetInt();
136 136
137 DCHECK(success); 137 DCHECK(success);
138 } 138 }
139 139
140 } } // namespace v8::internal 140 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/snapshot-common.cc ('k') | src/v8.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698