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 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 i::FlagList::PrintHelp(); | 155 i::FlagList::PrintHelp(); |
156 return !i::FLAG_help; | 156 return !i::FLAG_help; |
157 } | 157 } |
158 | 158 |
159 v8::V8::SetCounterFunction(counter_callback); | 159 v8::V8::SetCounterFunction(counter_callback); |
160 v8::HandleScope scope; | 160 v8::HandleScope scope; |
161 | 161 |
162 const int kExtensionCount = 1; | 162 const int kExtensionCount = 1; |
163 const char* extension_list[kExtensionCount] = { "v8/gc" }; | 163 const char* extension_list[kExtensionCount] = { "v8/gc" }; |
164 v8::ExtensionConfiguration extensions(kExtensionCount, extension_list); | 164 v8::ExtensionConfiguration extensions(kExtensionCount, extension_list); |
| 165 |
| 166 i::Serializer::Enable(); |
165 v8::Context::New(&extensions); | 167 v8::Context::New(&extensions); |
166 | 168 |
167 // Make sure all builtin scripts are cached. | 169 // Make sure all builtin scripts are cached. |
168 { HandleScope scope; | 170 { HandleScope scope; |
169 for (int i = 0; i < i::Natives::GetBuiltinsCount(); i++) { | 171 for (int i = 0; i < i::Natives::GetBuiltinsCount(); i++) { |
170 i::Bootstrapper::NativesSourceLookup(i); | 172 i::Bootstrapper::NativesSourceLookup(i); |
171 } | 173 } |
172 } | 174 } |
173 // Get rid of unreferenced scripts with a global GC. | 175 // Get rid of unreferenced scripts with a global GC. |
174 i::Heap::CollectAllGarbage(); | 176 i::Heap::CollectAllGarbage(); |
175 i::Serializer ser; | 177 i::Serializer ser; |
176 ser.Serialize(); | 178 ser.Serialize(); |
177 v8::internal::byte* bytes; | 179 v8::internal::byte* bytes; |
178 int len; | 180 int len; |
179 ser.Finalize(&bytes, &len); | 181 ser.Finalize(&bytes, &len); |
180 | 182 |
181 WriteInternalSnapshotToFile(argv[1], bytes, len); | 183 WriteInternalSnapshotToFile(argv[1], bytes, len); |
182 | 184 |
183 i::DeleteArray(bytes); | 185 i::DeleteArray(bytes); |
184 | 186 |
185 return 0; | 187 return 0; |
186 } | 188 } |
OLD | NEW |