OLD | NEW |
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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 snapshot_impl_-> | 98 snapshot_impl_-> |
99 context_property_cell_space_used); | 99 context_property_cell_space_used); |
100 Object* root; | 100 Object* root; |
101 deserializer.DeserializePartial(isolate, &root); | 101 deserializer.DeserializePartial(isolate, &root); |
102 CHECK(root->IsContext()); | 102 CHECK(root->IsContext()); |
103 return Handle<Context>(Context::cast(root)); | 103 return Handle<Context>(Context::cast(root)); |
104 } | 104 } |
105 | 105 |
106 | 106 |
107 void SetSnapshotFromFile(StartupData* snapshot_blob) { | 107 void SetSnapshotFromFile(StartupData* snapshot_blob) { |
108 ASSERT(snapshot_blob); | 108 DCHECK(snapshot_blob); |
109 ASSERT(snapshot_blob->data); | 109 DCHECK(snapshot_blob->data); |
110 ASSERT(snapshot_blob->raw_size > 0); | 110 DCHECK(snapshot_blob->raw_size > 0); |
111 ASSERT(!snapshot_impl_); | 111 DCHECK(!snapshot_impl_); |
112 | 112 |
113 snapshot_impl_ = new SnapshotImpl; | 113 snapshot_impl_ = new SnapshotImpl; |
114 SnapshotByteSource source(reinterpret_cast<const byte*>(snapshot_blob->data), | 114 SnapshotByteSource source(reinterpret_cast<const byte*>(snapshot_blob->data), |
115 snapshot_blob->raw_size); | 115 snapshot_blob->raw_size); |
116 | 116 |
117 bool success = source.GetBlob(&snapshot_impl_->data, | 117 bool success = source.GetBlob(&snapshot_impl_->data, |
118 &snapshot_impl_->size); | 118 &snapshot_impl_->size); |
119 snapshot_impl_->new_space_used = source.GetInt(); | 119 snapshot_impl_->new_space_used = source.GetInt(); |
120 snapshot_impl_->pointer_space_used = source.GetInt(); | 120 snapshot_impl_->pointer_space_used = source.GetInt(); |
121 snapshot_impl_->data_space_used = source.GetInt(); | 121 snapshot_impl_->data_space_used = source.GetInt(); |
122 snapshot_impl_->code_space_used = source.GetInt(); | 122 snapshot_impl_->code_space_used = source.GetInt(); |
123 snapshot_impl_->map_space_used = source.GetInt(); | 123 snapshot_impl_->map_space_used = source.GetInt(); |
124 snapshot_impl_->cell_space_used = source.GetInt(); | 124 snapshot_impl_->cell_space_used = source.GetInt(); |
125 snapshot_impl_->property_cell_space_used = source.GetInt(); | 125 snapshot_impl_->property_cell_space_used = source.GetInt(); |
126 | 126 |
127 success &= source.GetBlob(&snapshot_impl_->context_data, | 127 success &= source.GetBlob(&snapshot_impl_->context_data, |
128 &snapshot_impl_->context_size); | 128 &snapshot_impl_->context_size); |
129 snapshot_impl_->context_new_space_used = source.GetInt(); | 129 snapshot_impl_->context_new_space_used = source.GetInt(); |
130 snapshot_impl_->context_pointer_space_used = source.GetInt(); | 130 snapshot_impl_->context_pointer_space_used = source.GetInt(); |
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 ASSERT(success); | 137 DCHECK(success); |
138 } | 138 } |
139 | 139 |
140 } } // namespace v8::internal | 140 } } // namespace v8::internal |
OLD | NEW |