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 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 int result = i::FlagList::SetFlagsFromCommandLine(&argc, argv, true); | 152 int result = i::FlagList::SetFlagsFromCommandLine(&argc, argv, true); |
153 if (result > 0 || argc != 2 || i::FLAG_h) { | 153 if (result > 0 || argc != 2 || i::FLAG_h) { |
154 ::printf("Usage: %s [flag] ... outfile\n", argv[0]); | 154 ::printf("Usage: %s [flag] ... outfile\n", argv[0]); |
155 i::FlagList::PrintHelp(); | 155 i::FlagList::PrintHelp(); |
156 return !i::FLAG_h; | 156 return !i::FLAG_h; |
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 = 5; | 162 const int kExtensionCount = 1; |
163 const char* extension_list[kExtensionCount] = { "v8/print", | 163 const char* extension_list[kExtensionCount] = { "v8/gc" }; |
164 "v8/load", | |
165 "v8/quit", | |
166 "v8/version", | |
167 "v8/gc" }; | |
168 v8::ExtensionConfiguration extensions(kExtensionCount, extension_list); | 164 v8::ExtensionConfiguration extensions(kExtensionCount, extension_list); |
169 v8::Context::New(&extensions); | 165 v8::Context::New(&extensions); |
170 | 166 |
171 // Make sure all builtin scripts are cached. | 167 // Make sure all builtin scripts are cached. |
172 { HandleScope scope; | 168 { HandleScope scope; |
173 for (int i = 0; i < i::Natives::GetBuiltinsCount(); i++) { | 169 for (int i = 0; i < i::Natives::GetBuiltinsCount(); i++) { |
174 i::Bootstrapper::NativesSourceLookup(i); | 170 i::Bootstrapper::NativesSourceLookup(i); |
175 } | 171 } |
176 } | 172 } |
177 // Get rid of unreferenced scripts with a global GC. | 173 // Get rid of unreferenced scripts with a global GC. |
178 i::Heap::CollectAllGarbage(); | 174 i::Heap::CollectAllGarbage(); |
179 i::Serializer ser; | 175 i::Serializer ser; |
180 ser.Serialize(); | 176 ser.Serialize(); |
181 char* str; | 177 char* str; |
182 int len; | 178 int len; |
183 ser.Finalize(&str, &len); | 179 ser.Finalize(&str, &len); |
184 | 180 |
185 WriteInternalSnapshotToFile(argv[1], str, len); | 181 WriteInternalSnapshotToFile(argv[1], str, len); |
186 | 182 |
187 i::DeleteArray(str); | 183 i::DeleteArray(str); |
188 | 184 |
189 return 0; | 185 return 0; |
190 } | 186 } |
OLD | NEW |