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

Side by Side Diff: src/mksnapshot.cc

Issue 15994003: remove most remaining V8_ALLOW_ACCESS_TO* defines (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: addressed comments Created 7 years, 6 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/d8.cc ('k') | src/runtime.cc » ('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 14 matching lines...) Expand all
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 27
28 #include <errno.h> 28 #include <errno.h>
29 #include <stdio.h> 29 #include <stdio.h>
30 #ifdef COMPRESS_STARTUP_DATA_BZ2 30 #ifdef COMPRESS_STARTUP_DATA_BZ2
31 #include <bzlib.h> 31 #include <bzlib.h>
32 #endif 32 #endif
33 #include <signal.h> 33 #include <signal.h>
34 34
35 // TODO(dcarney): remove
36 #define V8_ALLOW_ACCESS_TO_PERSISTENT_ARROW
37 #define V8_ALLOW_ACCESS_TO_PERSISTENT_IMPLICIT
38
39 #include "v8.h" 35 #include "v8.h"
40 36
41 #include "bootstrapper.h" 37 #include "bootstrapper.h"
42 #include "flags.h" 38 #include "flags.h"
43 #include "natives.h" 39 #include "natives.h"
44 #include "platform.h" 40 #include "platform.h"
45 #include "serialize.h" 41 #include "serialize.h"
46 #include "list.h" 42 #include "list.h"
47 43
48 using namespace v8; 44 using namespace v8;
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 HandleScope handle_scope(isolate); 330 HandleScope handle_scope(isolate);
335 context.Reset(isolate, Context::New(isolate)); 331 context.Reset(isolate, Context::New(isolate));
336 } 332 }
337 333
338 if (context.IsEmpty()) { 334 if (context.IsEmpty()) {
339 fprintf(stderr, 335 fprintf(stderr,
340 "\nException thrown while compiling natives - see above.\n\n"); 336 "\nException thrown while compiling natives - see above.\n\n");
341 exit(1); 337 exit(1);
342 } 338 }
343 if (i::FLAG_extra_code != NULL) { 339 if (i::FLAG_extra_code != NULL) {
344 context->Enter();
345 // Capture 100 frames if anything happens. 340 // Capture 100 frames if anything happens.
346 V8::SetCaptureStackTraceForUncaughtExceptions(true, 100); 341 V8::SetCaptureStackTraceForUncaughtExceptions(true, 100);
347 HandleScope scope(isolate); 342 HandleScope scope(isolate);
343 v8::Context::Scope(v8::Local<v8::Context>::New(isolate, context));
348 const char* name = i::FLAG_extra_code; 344 const char* name = i::FLAG_extra_code;
349 FILE* file = i::OS::FOpen(name, "rb"); 345 FILE* file = i::OS::FOpen(name, "rb");
350 if (file == NULL) { 346 if (file == NULL) {
351 fprintf(stderr, "Failed to open '%s': errno %d\n", name, errno); 347 fprintf(stderr, "Failed to open '%s': errno %d\n", name, errno);
352 exit(1); 348 exit(1);
353 } 349 }
354 350
355 fseek(file, 0, SEEK_END); 351 fseek(file, 0, SEEK_END);
356 int size = ftell(file); 352 int size = ftell(file);
357 rewind(file); 353 rewind(file);
(...skipping 16 matching lines...) Expand all
374 fprintf(stderr, "Failure compiling '%s'\n", name); 370 fprintf(stderr, "Failure compiling '%s'\n", name);
375 DumpException(try_catch.Message()); 371 DumpException(try_catch.Message());
376 exit(1); 372 exit(1);
377 } 373 }
378 script->Run(); 374 script->Run();
379 if (try_catch.HasCaught()) { 375 if (try_catch.HasCaught()) {
380 fprintf(stderr, "Failure running '%s'\n", name); 376 fprintf(stderr, "Failure running '%s'\n", name);
381 DumpException(try_catch.Message()); 377 DumpException(try_catch.Message());
382 exit(1); 378 exit(1);
383 } 379 }
384 context->Exit();
385 } 380 }
386 // Make sure all builtin scripts are cached. 381 // Make sure all builtin scripts are cached.
387 { HandleScope scope(isolate); 382 { HandleScope scope(isolate);
388 for (int i = 0; i < i::Natives::GetBuiltinsCount(); i++) { 383 for (int i = 0; i < i::Natives::GetBuiltinsCount(); i++) {
389 i::Isolate::Current()->bootstrapper()->NativesSourceLookup(i); 384 i::Isolate::Current()->bootstrapper()->NativesSourceLookup(i);
390 } 385 }
391 } 386 }
392 // If we don't do this then we end up with a stray root pointing at the 387 // If we don't do this then we end up with a stray root pointing at the
393 // context even after we have disposed of the context. 388 // context even after we have disposed of the context.
394 HEAP->CollectAllGarbage(i::Heap::kNoGCFlags, "mksnapshot"); 389 HEAP->CollectAllGarbage(i::Heap::kNoGCFlags, "mksnapshot");
395 i::Object* raw_context = *(v8::Utils::OpenHandle(*context)); 390 i::Object* raw_context = *(v8::Utils::OpenHandle(*context));
396 context.Dispose(context->GetIsolate()); 391 context.Dispose(isolate);
397 CppByteSink sink(argv[1]); 392 CppByteSink sink(argv[1]);
398 // This results in a somewhat smaller snapshot, probably because it gets rid 393 // This results in a somewhat smaller snapshot, probably because it gets rid
399 // of some things that are cached between garbage collections. 394 // of some things that are cached between garbage collections.
400 i::StartupSerializer ser(&sink); 395 i::StartupSerializer ser(&sink);
401 ser.SerializeStrongReferences(); 396 ser.SerializeStrongReferences();
402 397
403 i::PartialSerializer partial_ser(&ser, sink.partial_sink()); 398 i::PartialSerializer partial_ser(&ser, sink.partial_sink());
404 partial_ser.Serialize(&raw_context); 399 partial_ser.Serialize(&raw_context);
405 400
406 ser.SerializeWeakReferences(); 401 ser.SerializeWeakReferences();
(...skipping 19 matching lines...) Expand all
426 sink.WriteSpaceUsed( 421 sink.WriteSpaceUsed(
427 "", 422 "",
428 ser.CurrentAllocationAddress(i::NEW_SPACE), 423 ser.CurrentAllocationAddress(i::NEW_SPACE),
429 ser.CurrentAllocationAddress(i::OLD_POINTER_SPACE), 424 ser.CurrentAllocationAddress(i::OLD_POINTER_SPACE),
430 ser.CurrentAllocationAddress(i::OLD_DATA_SPACE), 425 ser.CurrentAllocationAddress(i::OLD_DATA_SPACE),
431 ser.CurrentAllocationAddress(i::CODE_SPACE), 426 ser.CurrentAllocationAddress(i::CODE_SPACE),
432 ser.CurrentAllocationAddress(i::MAP_SPACE), 427 ser.CurrentAllocationAddress(i::MAP_SPACE),
433 ser.CurrentAllocationAddress(i::CELL_SPACE)); 428 ser.CurrentAllocationAddress(i::CELL_SPACE));
434 return 0; 429 return 0;
435 } 430 }
OLDNEW
« no previous file with comments | « src/d8.cc ('k') | src/runtime.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698