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 1882 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1893 Local<String> Module::GetModuleRequest(int i) const { | 1893 Local<String> Module::GetModuleRequest(int i) const { |
1894 CHECK_GE(i, 0); | 1894 CHECK_GE(i, 0); |
1895 i::Handle<i::Module> self = Utils::OpenHandle(this); | 1895 i::Handle<i::Module> self = Utils::OpenHandle(this); |
1896 i::Isolate* isolate = self->GetIsolate(); | 1896 i::Isolate* isolate = self->GetIsolate(); |
1897 i::Handle<i::FixedArray> module_requests(self->info()->module_requests(), | 1897 i::Handle<i::FixedArray> module_requests(self->info()->module_requests(), |
1898 isolate); | 1898 isolate); |
1899 CHECK_LT(i, module_requests->length()); | 1899 CHECK_LT(i, module_requests->length()); |
1900 return ToApiHandle<String>(i::handle(module_requests->get(i), isolate)); | 1900 return ToApiHandle<String>(i::handle(module_requests->get(i), isolate)); |
1901 } | 1901 } |
1902 | 1902 |
1903 void Module::SetEmbedderData(Local<Value> data) { | 1903 int Module::GetIdentityHash() const { return Utils::OpenHandle(this)->hash(); } |
1904 Utils::OpenHandle(this)->set_embedder_data(*Utils::OpenHandle(*data)); | |
1905 } | |
1906 | |
1907 Local<Value> Module::GetEmbedderData() const { | |
1908 auto self = Utils::OpenHandle(this); | |
1909 return ToApiHandle<Value>( | |
1910 i::handle(self->embedder_data(), self->GetIsolate())); | |
1911 } | |
1912 | 1904 |
1913 bool Module::Instantiate(Local<Context> context, | 1905 bool Module::Instantiate(Local<Context> context, |
1914 Module::ResolveCallback callback, | 1906 Module::ResolveCallback callback) { |
1915 Local<Value> callback_data) { | |
1916 PREPARE_FOR_EXECUTION_BOOL(context, Module, Instantiate); | 1907 PREPARE_FOR_EXECUTION_BOOL(context, Module, Instantiate); |
1917 has_pending_exception = !i::Module::Instantiate( | 1908 has_pending_exception = |
1918 Utils::OpenHandle(this), context, callback, callback_data); | 1909 !i::Module::Instantiate(Utils::OpenHandle(this), context, callback); |
1919 RETURN_ON_FAILED_EXECUTION_BOOL(); | 1910 RETURN_ON_FAILED_EXECUTION_BOOL(); |
1920 return true; | 1911 return true; |
1921 } | 1912 } |
1922 | 1913 |
1923 MaybeLocal<Value> Module::Evaluate(Local<Context> context) { | 1914 MaybeLocal<Value> Module::Evaluate(Local<Context> context) { |
1924 PREPARE_FOR_EXECUTION_WITH_CONTEXT_IN_RUNTIME_CALL_STATS_SCOPE( | 1915 PREPARE_FOR_EXECUTION_WITH_CONTEXT_IN_RUNTIME_CALL_STATS_SCOPE( |
1925 "v8", "V8.Execute", context, Module, Evaluate, MaybeLocal<Value>(), | 1916 "v8", "V8.Execute", context, Module, Evaluate, MaybeLocal<Value>(), |
1926 InternalEscapableScope, true); | 1917 InternalEscapableScope, true); |
1927 i::HistogramTimerScope execute_timer(isolate->counters()->execute(), true); | 1918 i::HistogramTimerScope execute_timer(isolate->counters()->execute(), true); |
1928 i::AggregatingHistogramTimerScope timer(isolate->counters()->compile_lazy()); | 1919 i::AggregatingHistogramTimerScope timer(isolate->counters()->compile_lazy()); |
(...skipping 7487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9416 Address callback_address = | 9407 Address callback_address = |
9417 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 9408 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
9418 VMState<EXTERNAL> state(isolate); | 9409 VMState<EXTERNAL> state(isolate); |
9419 ExternalCallbackScope call_scope(isolate, callback_address); | 9410 ExternalCallbackScope call_scope(isolate, callback_address); |
9420 callback(info); | 9411 callback(info); |
9421 } | 9412 } |
9422 | 9413 |
9423 | 9414 |
9424 } // namespace internal | 9415 } // namespace internal |
9425 } // namespace v8 | 9416 } // namespace v8 |
OLD | NEW |