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 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
321 } | 321 } |
322 #ifdef COMPRESS_STARTUP_DATA_BZ2 | 322 #ifdef COMPRESS_STARTUP_DATA_BZ2 |
323 BZip2Decompressor natives_decompressor; | 323 BZip2Decompressor natives_decompressor; |
324 int bz2_result = natives_decompressor.Decompress(); | 324 int bz2_result = natives_decompressor.Decompress(); |
325 if (bz2_result != BZ_OK) { | 325 if (bz2_result != BZ_OK) { |
326 fprintf(stderr, "bzip error code: %d\n", bz2_result); | 326 fprintf(stderr, "bzip error code: %d\n", bz2_result); |
327 exit(1); | 327 exit(1); |
328 } | 328 } |
329 #endif | 329 #endif |
330 i::Serializer::Enable(); | 330 i::Serializer::Enable(); |
331 Persistent<Context> context = v8::Context::New(); | 331 Isolate* isolate = Isolate::GetCurrent(); |
| 332 Persistent<Context> context; |
| 333 { |
| 334 HandleScope handle_scope(isolate); |
| 335 context.Reset(isolate, Context::New(isolate)); |
| 336 } |
| 337 |
332 if (context.IsEmpty()) { | 338 if (context.IsEmpty()) { |
333 fprintf(stderr, | 339 fprintf(stderr, |
334 "\nException thrown while compiling natives - see above.\n\n"); | 340 "\nException thrown while compiling natives - see above.\n\n"); |
335 exit(1); | 341 exit(1); |
336 } | 342 } |
337 Isolate* isolate = context->GetIsolate(); | |
338 if (i::FLAG_extra_code != NULL) { | 343 if (i::FLAG_extra_code != NULL) { |
339 context->Enter(); | 344 context->Enter(); |
340 // Capture 100 frames if anything happens. | 345 // Capture 100 frames if anything happens. |
341 V8::SetCaptureStackTraceForUncaughtExceptions(true, 100); | 346 V8::SetCaptureStackTraceForUncaughtExceptions(true, 100); |
342 HandleScope scope(isolate); | 347 HandleScope scope(isolate); |
343 const char* name = i::FLAG_extra_code; | 348 const char* name = i::FLAG_extra_code; |
344 FILE* file = i::OS::FOpen(name, "rb"); | 349 FILE* file = i::OS::FOpen(name, "rb"); |
345 if (file == NULL) { | 350 if (file == NULL) { |
346 fprintf(stderr, "Failed to open '%s': errno %d\n", name, errno); | 351 fprintf(stderr, "Failed to open '%s': errno %d\n", name, errno); |
347 exit(1); | 352 exit(1); |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
421 sink.WriteSpaceUsed( | 426 sink.WriteSpaceUsed( |
422 "", | 427 "", |
423 ser.CurrentAllocationAddress(i::NEW_SPACE), | 428 ser.CurrentAllocationAddress(i::NEW_SPACE), |
424 ser.CurrentAllocationAddress(i::OLD_POINTER_SPACE), | 429 ser.CurrentAllocationAddress(i::OLD_POINTER_SPACE), |
425 ser.CurrentAllocationAddress(i::OLD_DATA_SPACE), | 430 ser.CurrentAllocationAddress(i::OLD_DATA_SPACE), |
426 ser.CurrentAllocationAddress(i::CODE_SPACE), | 431 ser.CurrentAllocationAddress(i::CODE_SPACE), |
427 ser.CurrentAllocationAddress(i::MAP_SPACE), | 432 ser.CurrentAllocationAddress(i::MAP_SPACE), |
428 ser.CurrentAllocationAddress(i::CELL_SPACE)); | 433 ser.CurrentAllocationAddress(i::CELL_SPACE)); |
429 return 0; | 434 return 0; |
430 } | 435 } |
OLD | NEW |