Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(180)

Side by Side Diff: src/mksnapshot.cc

Issue 240193002: Serializer enable/disable flags need thread safety. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Code comment response. Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/mips/assembler-mips.cc ('k') | src/serialize.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 23 matching lines...) Expand all
34 34
35 #include "v8.h" 35 #include "v8.h"
36 36
37 #include "bootstrapper.h" 37 #include "bootstrapper.h"
38 #include "flags.h" 38 #include "flags.h"
39 #include "natives.h" 39 #include "natives.h"
40 #include "platform.h" 40 #include "platform.h"
41 #include "serialize.h" 41 #include "serialize.h"
42 #include "list.h" 42 #include "list.h"
43 43
44 #if V8_TARGET_ARCH_ARM
45 #include "arm/assembler-arm-inl.h"
46 #endif
47
44 using namespace v8; 48 using namespace v8;
45 49
46 50
47 class Compressor { 51 class Compressor {
48 public: 52 public:
49 virtual ~Compressor() {} 53 virtual ~Compressor() {}
50 virtual bool Compress(i::Vector<char> input) = 0; 54 virtual bool Compress(i::Vector<char> input) = 0;
51 virtual i::Vector<char>* output() = 0; 55 virtual i::Vector<char>* output() = 0;
52 }; 56 };
53 57
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 } 269 }
266 270
267 271
268 int main(int argc, char** argv) { 272 int main(int argc, char** argv) {
269 V8::InitializeICU(); 273 V8::InitializeICU();
270 i::Isolate::SetCrashIfDefaultIsolateInitialized(); 274 i::Isolate::SetCrashIfDefaultIsolateInitialized();
271 275
272 // By default, log code create information in the snapshot. 276 // By default, log code create information in the snapshot.
273 i::FLAG_log_code = true; 277 i::FLAG_log_code = true;
274 278
279 #if V8_TARGET_ARCH_ARM
280 // Printing flags on ARM requires knowing if we intend to enable
281 // the serializer or not.
282 v8::internal::CpuFeatures::SetHintCreatingSnapshot();
283 #endif
284
275 // Print the usage if an error occurs when parsing the command line 285 // Print the usage if an error occurs when parsing the command line
276 // flags or if the help flag is set. 286 // flags or if the help flag is set.
277 int result = i::FlagList::SetFlagsFromCommandLine(&argc, argv, true); 287 int result = i::FlagList::SetFlagsFromCommandLine(&argc, argv, true);
278 if (result > 0 || argc != 2 || i::FLAG_help) { 288 if (result > 0 || argc != 2 || i::FLAG_help) {
279 ::printf("Usage: %s [flag] ... outfile\n", argv[0]); 289 ::printf("Usage: %s [flag] ... outfile\n", argv[0]);
280 i::FlagList::PrintHelp(); 290 i::FlagList::PrintHelp();
281 return !i::FLAG_help; 291 return !i::FLAG_help;
282 } 292 }
283 #ifdef COMPRESS_STARTUP_DATA_BZ2 293 #ifdef COMPRESS_STARTUP_DATA_BZ2
284 BZip2Decompressor natives_decompressor; 294 BZip2Decompressor natives_decompressor;
285 int bz2_result = natives_decompressor.Decompress(); 295 int bz2_result = natives_decompressor.Decompress();
286 if (bz2_result != BZ_OK) { 296 if (bz2_result != BZ_OK) {
287 fprintf(stderr, "bzip error code: %d\n", bz2_result); 297 fprintf(stderr, "bzip error code: %d\n", bz2_result);
288 exit(1); 298 exit(1);
289 } 299 }
290 #endif 300 #endif
291 i::FLAG_logfile_per_isolate = false; 301 i::FLAG_logfile_per_isolate = false;
292 302
293 Isolate* isolate = v8::Isolate::New(); 303 Isolate* isolate = v8::Isolate::New();
294 isolate->Enter(); 304 isolate->Enter();
295 i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate); 305 i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate);
296 i::Serializer::Enable(internal_isolate); 306 i::Serializer::RequestEnable(internal_isolate);
297 Persistent<Context> context; 307 Persistent<Context> context;
298 { 308 {
299 HandleScope handle_scope(isolate); 309 HandleScope handle_scope(isolate);
300 context.Reset(isolate, Context::New(isolate)); 310 context.Reset(isolate, Context::New(isolate));
301 } 311 }
302 312
303 if (context.IsEmpty()) { 313 if (context.IsEmpty()) {
304 fprintf(stderr, 314 fprintf(stderr,
305 "\nException thrown while compiling natives - see above.\n\n"); 315 "\nException thrown while compiling natives - see above.\n\n");
306 exit(1); 316 exit(1);
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 ser.CurrentAllocationAddress(i::OLD_DATA_SPACE), 407 ser.CurrentAllocationAddress(i::OLD_DATA_SPACE),
398 ser.CurrentAllocationAddress(i::CODE_SPACE), 408 ser.CurrentAllocationAddress(i::CODE_SPACE),
399 ser.CurrentAllocationAddress(i::MAP_SPACE), 409 ser.CurrentAllocationAddress(i::MAP_SPACE),
400 ser.CurrentAllocationAddress(i::CELL_SPACE), 410 ser.CurrentAllocationAddress(i::CELL_SPACE),
401 ser.CurrentAllocationAddress(i::PROPERTY_CELL_SPACE)); 411 ser.CurrentAllocationAddress(i::PROPERTY_CELL_SPACE));
402 isolate->Exit(); 412 isolate->Exit();
403 isolate->Dispose(); 413 isolate->Dispose();
404 V8::Dispose(); 414 V8::Dispose();
405 return 0; 415 return 0;
406 } 416 }
OLDNEW
« no previous file with comments | « src/mips/assembler-mips.cc ('k') | src/serialize.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698