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 8325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8336 } | 8336 } |
8337 | 8337 |
8338 if (params.add_histogram_sample_callback) { | 8338 if (params.add_histogram_sample_callback) { |
8339 v8_isolate->SetAddHistogramSampleFunction( | 8339 v8_isolate->SetAddHistogramSampleFunction( |
8340 params.add_histogram_sample_callback); | 8340 params.add_histogram_sample_callback); |
8341 } | 8341 } |
8342 | 8342 |
8343 isolate->set_api_external_references(params.external_references); | 8343 isolate->set_api_external_references(params.external_references); |
8344 isolate->set_allow_atomics_wait(params.allow_atomics_wait); | 8344 isolate->set_allow_atomics_wait(params.allow_atomics_wait); |
8345 | 8345 |
8346 if (params.host_import_module_dynamically_callback_ != nullptr) { | |
8347 isolate->SetHostImportModuleDynamicallyCallback( | |
8348 params.host_import_module_dynamically_callback_); | |
8349 } | |
8350 | |
8351 SetResourceConstraints(isolate, params.constraints); | 8346 SetResourceConstraints(isolate, params.constraints); |
8352 // TODO(jochen): Once we got rid of Isolate::Current(), we can remove this. | 8347 // TODO(jochen): Once we got rid of Isolate::Current(), we can remove this. |
8353 Isolate::Scope isolate_scope(v8_isolate); | 8348 Isolate::Scope isolate_scope(v8_isolate); |
8354 if (params.entry_hook || !i::Snapshot::Initialize(isolate)) { | 8349 if (params.entry_hook || !i::Snapshot::Initialize(isolate)) { |
8355 isolate->Init(NULL); | 8350 isolate->Init(NULL); |
8356 } | 8351 } |
8357 return v8_isolate; | 8352 return v8_isolate; |
8358 } | 8353 } |
8359 | 8354 |
8360 | 8355 |
(...skipping 29 matching lines...) Expand all Loading... |
8390 isolate->Exit(); | 8385 isolate->Exit(); |
8391 } | 8386 } |
8392 | 8387 |
8393 | 8388 |
8394 void Isolate::SetAbortOnUncaughtExceptionCallback( | 8389 void Isolate::SetAbortOnUncaughtExceptionCallback( |
8395 AbortOnUncaughtExceptionCallback callback) { | 8390 AbortOnUncaughtExceptionCallback callback) { |
8396 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); | 8391 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); |
8397 isolate->SetAbortOnUncaughtExceptionCallback(callback); | 8392 isolate->SetAbortOnUncaughtExceptionCallback(callback); |
8398 } | 8393 } |
8399 | 8394 |
| 8395 void Isolate::SetHostImportModuleDynamicallyCallback( |
| 8396 HostImportModuleDynamicallyCallback callback) { |
| 8397 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); |
| 8398 isolate->SetHostImportModuleDynamicallyCallback(callback); |
| 8399 } |
8400 | 8400 |
8401 Isolate::DisallowJavascriptExecutionScope::DisallowJavascriptExecutionScope( | 8401 Isolate::DisallowJavascriptExecutionScope::DisallowJavascriptExecutionScope( |
8402 Isolate* isolate, | 8402 Isolate* isolate, |
8403 Isolate::DisallowJavascriptExecutionScope::OnFailure on_failure) | 8403 Isolate::DisallowJavascriptExecutionScope::OnFailure on_failure) |
8404 : on_failure_(on_failure) { | 8404 : on_failure_(on_failure) { |
8405 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); | 8405 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); |
8406 if (on_failure_ == CRASH_ON_FAILURE) { | 8406 if (on_failure_ == CRASH_ON_FAILURE) { |
8407 internal_ = reinterpret_cast<void*>( | 8407 internal_ = reinterpret_cast<void*>( |
8408 new i::DisallowJavascriptExecution(i_isolate)); | 8408 new i::DisallowJavascriptExecution(i_isolate)); |
8409 } else { | 8409 } else { |
(...skipping 2073 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10483 Address callback_address = | 10483 Address callback_address = |
10484 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 10484 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
10485 VMState<EXTERNAL> state(isolate); | 10485 VMState<EXTERNAL> state(isolate); |
10486 ExternalCallbackScope call_scope(isolate, callback_address); | 10486 ExternalCallbackScope call_scope(isolate, callback_address); |
10487 callback(info); | 10487 callback(info); |
10488 } | 10488 } |
10489 | 10489 |
10490 | 10490 |
10491 } // namespace internal | 10491 } // namespace internal |
10492 } // namespace v8 | 10492 } // namespace v8 |
OLD | NEW |