OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/api.h" | 5 #include "src/api.h" |
6 | 6 |
7 #include <string.h> // For memcpy, strlen. | 7 #include <string.h> // For memcpy, strlen. |
8 #ifdef V8_USE_ADDRESS_SANITIZER | 8 #ifdef V8_USE_ADDRESS_SANITIZER |
9 #include <sanitizer/asan_interface.h> | 9 #include <sanitizer/asan_interface.h> |
10 #endif // V8_USE_ADDRESS_SANITIZER | 10 #endif // V8_USE_ADDRESS_SANITIZER |
(...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
494 ArrayBufferAllocator allocator; | 494 ArrayBufferAllocator allocator; |
495 i::Isolate* internal_isolate = new i::Isolate(true); | 495 i::Isolate* internal_isolate = new i::Isolate(true); |
496 internal_isolate->set_array_buffer_allocator(&allocator); | 496 internal_isolate->set_array_buffer_allocator(&allocator); |
497 internal_isolate->set_snapshot_blob(&cold_snapshot_blob); | 497 internal_isolate->set_snapshot_blob(&cold_snapshot_blob); |
498 Isolate* isolate = reinterpret_cast<Isolate*>(internal_isolate); | 498 Isolate* isolate = reinterpret_cast<Isolate*>(internal_isolate); |
499 | 499 |
500 { | 500 { |
501 Isolate::Scope isolate_scope(isolate); | 501 Isolate::Scope isolate_scope(isolate); |
502 i::Snapshot::Initialize(internal_isolate); | 502 i::Snapshot::Initialize(internal_isolate); |
503 Persistent<Context> context; | 503 Persistent<Context> context; |
| 504 bool success; |
504 { | 505 { |
505 HandleScope handle_scope(isolate); | 506 HandleScope handle_scope(isolate); |
506 Local<Context> warmup_context = Context::New(isolate); | 507 Local<Context> new_context = Context::New(isolate); |
507 if (RunExtraCode(isolate, warmup_context, warmup_source, "<warm-up>")) { | 508 success = RunExtraCode(isolate, new_context, warmup_source, "<warm-up>"); |
508 Local<Context> fresh_context = Context::New(isolate); | 509 } |
509 context.Reset(isolate, fresh_context); | 510 if (success) { |
510 } | 511 HandleScope handle_scope(isolate); |
| 512 isolate->ContextDisposedNotification(false); |
| 513 Local<Context> new_context = Context::New(isolate); |
| 514 context.Reset(isolate, new_context); |
511 } | 515 } |
512 | 516 |
513 i::Snapshot::Metadata metadata; | 517 i::Snapshot::Metadata metadata; |
514 metadata.set_embeds_script(i::Snapshot::EmbedsScript(internal_isolate)); | 518 metadata.set_embeds_script(i::Snapshot::EmbedsScript(internal_isolate)); |
515 | 519 |
516 result = SerializeIsolateAndContext( | 520 result = SerializeIsolateAndContext( |
517 isolate, &context, metadata, i::StartupSerializer::KEEP_FUNCTION_CODE); | 521 isolate, &context, metadata, i::StartupSerializer::KEEP_FUNCTION_CODE); |
518 DCHECK(context.IsEmpty()); | 522 DCHECK(context.IsEmpty()); |
519 } | 523 } |
520 isolate->Dispose(); | 524 isolate->Dispose(); |
(...skipping 8232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8753 Address callback_address = | 8757 Address callback_address = |
8754 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 8758 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
8755 VMState<EXTERNAL> state(isolate); | 8759 VMState<EXTERNAL> state(isolate); |
8756 ExternalCallbackScope call_scope(isolate, callback_address); | 8760 ExternalCallbackScope call_scope(isolate, callback_address); |
8757 callback(info); | 8761 callback(info); |
8758 } | 8762 } |
8759 | 8763 |
8760 | 8764 |
8761 } // namespace internal | 8765 } // namespace internal |
8762 } // namespace v8 | 8766 } // namespace v8 |
OLD | NEW |