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 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 } | 109 } |
110 return false; | 110 return false; |
111 } | 111 } |
112 | 112 |
113 | 113 |
114 bool Snapshot::HaveASnapshotToStartFrom() { | 114 bool Snapshot::HaveASnapshotToStartFrom() { |
115 return size_ != 0; | 115 return size_ != 0; |
116 } | 116 } |
117 | 117 |
118 | 118 |
119 Handle<Context> Snapshot::NewContextFromSnapshot() { | 119 Handle<Context> Snapshot::NewContextFromSnapshot(Isolate* isolate) { |
120 if (context_size_ == 0) { | 120 if (context_size_ == 0) { |
121 return Handle<Context>(); | 121 return Handle<Context>(); |
122 } | 122 } |
123 SnapshotByteSource source(context_raw_data_, | 123 SnapshotByteSource source(context_raw_data_, |
124 context_raw_size_); | 124 context_raw_size_); |
125 Deserializer deserializer(&source); | 125 Deserializer deserializer(&source); |
126 Object* root; | 126 Object* root; |
127 deserializer.set_reservation(NEW_SPACE, context_new_space_used_); | 127 deserializer.set_reservation(NEW_SPACE, context_new_space_used_); |
128 deserializer.set_reservation(OLD_POINTER_SPACE, context_pointer_space_used_); | 128 deserializer.set_reservation(OLD_POINTER_SPACE, context_pointer_space_used_); |
129 deserializer.set_reservation(OLD_DATA_SPACE, context_data_space_used_); | 129 deserializer.set_reservation(OLD_DATA_SPACE, context_data_space_used_); |
130 deserializer.set_reservation(CODE_SPACE, context_code_space_used_); | 130 deserializer.set_reservation(CODE_SPACE, context_code_space_used_); |
131 deserializer.set_reservation(MAP_SPACE, context_map_space_used_); | 131 deserializer.set_reservation(MAP_SPACE, context_map_space_used_); |
132 deserializer.set_reservation(CELL_SPACE, context_cell_space_used_); | 132 deserializer.set_reservation(CELL_SPACE, context_cell_space_used_); |
133 deserializer.set_reservation(PROPERTY_CELL_SPACE, | 133 deserializer.set_reservation(PROPERTY_CELL_SPACE, |
134 context_property_cell_space_used_); | 134 context_property_cell_space_used_); |
135 deserializer.DeserializePartial(&root); | 135 deserializer.DeserializePartial(isolate, &root); |
136 CHECK(root->IsContext()); | 136 CHECK(root->IsContext()); |
137 return Handle<Context>(Context::cast(root)); | 137 return Handle<Context>(Context::cast(root)); |
138 } | 138 } |
139 | 139 |
140 } } // namespace v8::internal | 140 } } // namespace v8::internal |
OLD | NEW |