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 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
340 StartupData V8::CreateSnapshotDataBlob(const char* custom_source) { | 340 StartupData V8::CreateSnapshotDataBlob(const char* custom_source) { |
341 i::Isolate* internal_isolate = new i::Isolate(true); | 341 i::Isolate* internal_isolate = new i::Isolate(true); |
342 ArrayBufferAllocator allocator; | 342 ArrayBufferAllocator allocator; |
343 internal_isolate->set_array_buffer_allocator(&allocator); | 343 internal_isolate->set_array_buffer_allocator(&allocator); |
344 Isolate* isolate = reinterpret_cast<Isolate*>(internal_isolate); | 344 Isolate* isolate = reinterpret_cast<Isolate*>(internal_isolate); |
345 StartupData result = {NULL, 0}; | 345 StartupData result = {NULL, 0}; |
346 { | 346 { |
347 base::ElapsedTimer timer; | 347 base::ElapsedTimer timer; |
348 timer.Start(); | 348 timer.Start(); |
349 Isolate::Scope isolate_scope(isolate); | 349 Isolate::Scope isolate_scope(isolate); |
| 350 internal_isolate->set_creating_default_snapshot(true); |
350 internal_isolate->Init(NULL); | 351 internal_isolate->Init(NULL); |
351 Persistent<Context> context; | 352 Persistent<Context> context; |
352 i::Snapshot::Metadata metadata; | 353 i::Snapshot::Metadata metadata; |
353 { | 354 { |
354 HandleScope handle_scope(isolate); | 355 HandleScope handle_scope(isolate); |
355 Handle<Context> new_context = Context::New(isolate); | 356 Handle<Context> new_context = Context::New(isolate); |
| 357 internal_isolate->set_creating_default_snapshot(false); |
356 context.Reset(isolate, new_context); | 358 context.Reset(isolate, new_context); |
357 if (custom_source != NULL) { | 359 if (custom_source != NULL) { |
358 metadata.set_embeds_script(true); | 360 metadata.set_embeds_script(true); |
359 Context::Scope context_scope(new_context); | 361 Context::Scope context_scope(new_context); |
360 if (!RunExtraCode(isolate, custom_source)) context.Reset(); | 362 if (!RunExtraCode(isolate, custom_source)) context.Reset(); |
361 } | 363 } |
362 } | 364 } |
363 if (!context.IsEmpty()) { | 365 if (!context.IsEmpty()) { |
364 // Make sure all builtin scripts are cached. | 366 // Make sure all builtin scripts are cached. |
365 { | 367 { |
(...skipping 7713 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8079 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); | 8081 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); |
8080 Address callback_address = | 8082 Address callback_address = |
8081 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 8083 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
8082 VMState<EXTERNAL> state(isolate); | 8084 VMState<EXTERNAL> state(isolate); |
8083 ExternalCallbackScope call_scope(isolate, callback_address); | 8085 ExternalCallbackScope call_scope(isolate, callback_address); |
8084 callback(info); | 8086 callback(info); |
8085 } | 8087 } |
8086 | 8088 |
8087 | 8089 |
8088 } } // namespace v8::internal | 8090 } } // namespace v8::internal |
OLD | NEW |