| 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 DeleteArray(str); | 53 DeleteArray(str); |
| 54 return true; | 54 return true; |
| 55 } else if (size_ > 0) { | 55 } else if (size_ > 0) { |
| 56 Deserialize(raw_data_, raw_size_); | 56 Deserialize(raw_data_, raw_size_); |
| 57 return true; | 57 return true; |
| 58 } | 58 } |
| 59 return false; | 59 return false; |
| 60 } | 60 } |
| 61 | 61 |
| 62 | 62 |
| 63 bool Snapshot::HaveASnapshotToStartFrom() { |
| 64 return size_ != 0; |
| 65 } |
| 66 |
| 67 |
| 63 Handle<Context> Snapshot::NewContextFromSnapshot() { | 68 Handle<Context> Snapshot::NewContextFromSnapshot() { |
| 64 if (context_size_ == 0) { | 69 if (context_size_ == 0) { |
| 65 return Handle<Context>(); | 70 return Handle<Context>(); |
| 66 } | 71 } |
| 67 HEAP->ReserveSpace(new_space_used_, | 72 HEAP->ReserveSpace(new_space_used_, |
| 68 pointer_space_used_, | 73 pointer_space_used_, |
| 69 data_space_used_, | 74 data_space_used_, |
| 70 code_space_used_, | 75 code_space_used_, |
| 71 map_space_used_, | 76 map_space_used_, |
| 72 cell_space_used_, | 77 cell_space_used_, |
| 73 large_space_used_); | 78 large_space_used_); |
| 74 SnapshotByteSource source(context_raw_data_, | 79 SnapshotByteSource source(context_raw_data_, |
| 75 context_raw_size_); | 80 context_raw_size_); |
| 76 Deserializer deserializer(&source); | 81 Deserializer deserializer(&source); |
| 77 Object* root; | 82 Object* root; |
| 78 deserializer.DeserializePartial(&root); | 83 deserializer.DeserializePartial(&root); |
| 79 CHECK(root->IsContext()); | 84 CHECK(root->IsContext()); |
| 80 return Handle<Context>(Context::cast(root)); | 85 return Handle<Context>(Context::cast(root)); |
| 81 } | 86 } |
| 82 | 87 |
| 83 } } // namespace v8::internal | 88 } } // namespace v8::internal |
| OLD | NEW |