| 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 493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 504 | 504 |
| 505 SnapshotCreator::SnapshotCreator(intptr_t* external_references, | 505 SnapshotCreator::SnapshotCreator(intptr_t* external_references, |
| 506 StartupData* existing_snapshot) { | 506 StartupData* existing_snapshot) { |
| 507 i::Isolate* internal_isolate = new i::Isolate(true); | 507 i::Isolate* internal_isolate = new i::Isolate(true); |
| 508 Isolate* isolate = reinterpret_cast<Isolate*>(internal_isolate); | 508 Isolate* isolate = reinterpret_cast<Isolate*>(internal_isolate); |
| 509 SnapshotCreatorData* data = new SnapshotCreatorData(isolate); | 509 SnapshotCreatorData* data = new SnapshotCreatorData(isolate); |
| 510 data->isolate_ = isolate; | 510 data->isolate_ = isolate; |
| 511 internal_isolate->set_array_buffer_allocator(&data->allocator_); | 511 internal_isolate->set_array_buffer_allocator(&data->allocator_); |
| 512 internal_isolate->set_api_external_references(external_references); | 512 internal_isolate->set_api_external_references(external_references); |
| 513 isolate->Enter(); | 513 isolate->Enter(); |
| 514 if (existing_snapshot) { | 514 const StartupData* blob = existing_snapshot |
| 515 internal_isolate->set_snapshot_blob(existing_snapshot); | 515 ? existing_snapshot |
| 516 : i::Snapshot::DefaultSnapshotBlob(); |
| 517 if (blob && blob->raw_size > 0) { |
| 518 internal_isolate->set_snapshot_blob(blob); |
| 516 i::Snapshot::Initialize(internal_isolate); | 519 i::Snapshot::Initialize(internal_isolate); |
| 517 } else { | 520 } else { |
| 518 internal_isolate->Init(nullptr); | 521 internal_isolate->Init(nullptr); |
| 519 } | 522 } |
| 520 data_ = data; | 523 data_ = data; |
| 521 } | 524 } |
| 522 | 525 |
| 523 SnapshotCreator::~SnapshotCreator() { | 526 SnapshotCreator::~SnapshotCreator() { |
| 524 SnapshotCreatorData* data = SnapshotCreatorData::cast(data_); | 527 SnapshotCreatorData* data = SnapshotCreatorData::cast(data_); |
| 525 DCHECK(data->created_); | 528 DCHECK(data->created_); |
| (...skipping 9731 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10257 Address callback_address = | 10260 Address callback_address = |
| 10258 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 10261 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
| 10259 VMState<EXTERNAL> state(isolate); | 10262 VMState<EXTERNAL> state(isolate); |
| 10260 ExternalCallbackScope call_scope(isolate, callback_address); | 10263 ExternalCallbackScope call_scope(isolate, callback_address); |
| 10261 callback(info); | 10264 callback(info); |
| 10262 } | 10265 } |
| 10263 | 10266 |
| 10264 | 10267 |
| 10265 } // namespace internal | 10268 } // namespace internal |
| 10266 } // namespace v8 | 10269 } // namespace v8 |
| OLD | NEW |