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

Side by Side Diff: src/mksnapshot.cc

Issue 12716010: Added a version of the v8::HandleScope constructor with an Isolate and use that consistently. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fixed rest Created 7 years, 9 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
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 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
311 exit(1); 311 exit(1);
312 } 312 }
313 #endif 313 #endif
314 i::Serializer::Enable(); 314 i::Serializer::Enable();
315 Persistent<Context> context = v8::Context::New(); 315 Persistent<Context> context = v8::Context::New();
316 if (context.IsEmpty()) { 316 if (context.IsEmpty()) {
317 fprintf(stderr, 317 fprintf(stderr,
318 "\nException thrown while compiling natives - see above.\n\n"); 318 "\nException thrown while compiling natives - see above.\n\n");
319 exit(1); 319 exit(1);
320 } 320 }
321 Isolate* isolate = context->GetIsolate();
321 if (i::FLAG_extra_code != NULL) { 322 if (i::FLAG_extra_code != NULL) {
322 context->Enter(); 323 context->Enter();
323 // Capture 100 frames if anything happens. 324 // Capture 100 frames if anything happens.
324 V8::SetCaptureStackTraceForUncaughtExceptions(true, 100); 325 V8::SetCaptureStackTraceForUncaughtExceptions(true, 100);
325 HandleScope scope; 326 HandleScope scope(isolate);
326 const char* name = i::FLAG_extra_code; 327 const char* name = i::FLAG_extra_code;
327 FILE* file = i::OS::FOpen(name, "rb"); 328 FILE* file = i::OS::FOpen(name, "rb");
328 if (file == NULL) { 329 if (file == NULL) {
329 fprintf(stderr, "Failed to open '%s': errno %d\n", name, errno); 330 fprintf(stderr, "Failed to open '%s': errno %d\n", name, errno);
330 exit(1); 331 exit(1);
331 } 332 }
332 333
333 fseek(file, 0, SEEK_END); 334 fseek(file, 0, SEEK_END);
334 int size = ftell(file); 335 int size = ftell(file);
335 rewind(file); 336 rewind(file);
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
368 int to = message->GetEndColumn(); 369 int to = message->GetEndColumn();
369 int i; 370 int i;
370 for (i = 0; i < from; i++) fprintf(stderr, " "); 371 for (i = 0; i < from; i++) fprintf(stderr, " ");
371 for ( ; i <= to; i++) fprintf(stderr, "^"); 372 for ( ; i <= to; i++) fprintf(stderr, "^");
372 fprintf(stderr, "\n"); 373 fprintf(stderr, "\n");
373 exit(1); 374 exit(1);
374 } 375 }
375 context->Exit(); 376 context->Exit();
376 } 377 }
377 // Make sure all builtin scripts are cached. 378 // Make sure all builtin scripts are cached.
378 { HandleScope scope; 379 { HandleScope scope(isolate);
379 for (int i = 0; i < i::Natives::GetBuiltinsCount(); i++) { 380 for (int i = 0; i < i::Natives::GetBuiltinsCount(); i++) {
380 i::Isolate::Current()->bootstrapper()->NativesSourceLookup(i); 381 i::Isolate::Current()->bootstrapper()->NativesSourceLookup(i);
381 } 382 }
382 } 383 }
383 // If we don't do this then we end up with a stray root pointing at the 384 // If we don't do this then we end up with a stray root pointing at the
384 // context even after we have disposed of the context. 385 // context even after we have disposed of the context.
385 HEAP->CollectAllGarbage(i::Heap::kNoGCFlags, "mksnapshot"); 386 HEAP->CollectAllGarbage(i::Heap::kNoGCFlags, "mksnapshot");
386 i::Object* raw_context = *(v8::Utils::OpenHandle(*context)); 387 i::Object* raw_context = *(v8::Utils::OpenHandle(*context));
387 context.Dispose(context->GetIsolate()); 388 context.Dispose(context->GetIsolate());
388 CppByteSink sink(argv[1]); 389 CppByteSink sink(argv[1]);
(...skipping 28 matching lines...) Expand all
417 sink.WriteSpaceUsed( 418 sink.WriteSpaceUsed(
418 "", 419 "",
419 ser.CurrentAllocationAddress(i::NEW_SPACE), 420 ser.CurrentAllocationAddress(i::NEW_SPACE),
420 ser.CurrentAllocationAddress(i::OLD_POINTER_SPACE), 421 ser.CurrentAllocationAddress(i::OLD_POINTER_SPACE),
421 ser.CurrentAllocationAddress(i::OLD_DATA_SPACE), 422 ser.CurrentAllocationAddress(i::OLD_DATA_SPACE),
422 ser.CurrentAllocationAddress(i::CODE_SPACE), 423 ser.CurrentAllocationAddress(i::CODE_SPACE),
423 ser.CurrentAllocationAddress(i::MAP_SPACE), 424 ser.CurrentAllocationAddress(i::MAP_SPACE),
424 ser.CurrentAllocationAddress(i::CELL_SPACE)); 425 ser.CurrentAllocationAddress(i::CELL_SPACE));
425 return 0; 426 return 0;
426 } 427 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698