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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 bool success; | 95 bool success; |
96 { | 96 { |
97 SnapshotByteSource source(str, len); | 97 SnapshotByteSource source(str, len); |
98 Deserializer deserializer(&source); | 98 Deserializer deserializer(&source); |
99 ReserveSpaceForSnapshot(&deserializer, snapshot_file); | 99 ReserveSpaceForSnapshot(&deserializer, snapshot_file); |
100 success = V8::Initialize(&deserializer); | 100 success = V8::Initialize(&deserializer); |
101 } | 101 } |
102 DeleteArray(str); | 102 DeleteArray(str); |
103 return success; | 103 return success; |
104 } else if (size_ > 0) { | 104 } else if (size_ > 0) { |
| 105 ElapsedTimer timer; |
| 106 if (FLAG_profile_deserialization) { |
| 107 timer.Start(); |
| 108 } |
105 SnapshotByteSource source(raw_data_, raw_size_); | 109 SnapshotByteSource source(raw_data_, raw_size_); |
106 Deserializer deserializer(&source); | 110 Deserializer deserializer(&source); |
107 ReserveSpaceForLinkedInSnapshot(&deserializer); | 111 ReserveSpaceForLinkedInSnapshot(&deserializer); |
108 return V8::Initialize(&deserializer); | 112 bool success = V8::Initialize(&deserializer); |
| 113 if (FLAG_profile_deserialization) { |
| 114 double ms = timer.Elapsed().InMillisecondsF(); |
| 115 PrintF("[Snapshot loading and deserialization took %0.3f ms]\n", ms); |
| 116 } |
| 117 return success; |
109 } | 118 } |
110 return false; | 119 return false; |
111 } | 120 } |
112 | 121 |
113 | 122 |
114 bool Snapshot::HaveASnapshotToStartFrom() { | 123 bool Snapshot::HaveASnapshotToStartFrom() { |
115 return size_ != 0; | 124 return size_ != 0; |
116 } | 125 } |
117 | 126 |
118 | 127 |
(...skipping 12 matching lines...) Expand all Loading... |
131 deserializer.set_reservation(MAP_SPACE, context_map_space_used_); | 140 deserializer.set_reservation(MAP_SPACE, context_map_space_used_); |
132 deserializer.set_reservation(CELL_SPACE, context_cell_space_used_); | 141 deserializer.set_reservation(CELL_SPACE, context_cell_space_used_); |
133 deserializer.set_reservation(PROPERTY_CELL_SPACE, | 142 deserializer.set_reservation(PROPERTY_CELL_SPACE, |
134 context_property_cell_space_used_); | 143 context_property_cell_space_used_); |
135 deserializer.DeserializePartial(isolate, &root); | 144 deserializer.DeserializePartial(isolate, &root); |
136 CHECK(root->IsContext()); | 145 CHECK(root->IsContext()); |
137 return Handle<Context>(Context::cast(root)); | 146 return Handle<Context>(Context::cast(root)); |
138 } | 147 } |
139 | 148 |
140 } } // namespace v8::internal | 149 } } // namespace v8::internal |
OLD | NEW |