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 { |
1904 Utils::OpenHandle(this)->set_embedder_data(*Utils::OpenHandle(*data)); | 1904 return static_cast<int>(Utils::OpenHandle(this)->Hash()); |
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 } | 1905 } |
1912 | 1906 |
1913 bool Module::Instantiate(Local<Context> context, | 1907 bool Module::Instantiate(Local<Context> context, |
1914 Module::ResolveCallback callback, | 1908 Module::ResolveCallback callback) { |
1915 Local<Value> callback_data) { | |
1916 PREPARE_FOR_EXECUTION_BOOL(context, Module, Instantiate); | 1909 PREPARE_FOR_EXECUTION_BOOL(context, Module, Instantiate); |
1917 has_pending_exception = !i::Module::Instantiate( | 1910 has_pending_exception = |
1918 Utils::OpenHandle(this), context, callback, callback_data); | 1911 !i::Module::Instantiate(Utils::OpenHandle(this), context, callback); |
1919 RETURN_ON_FAILED_EXECUTION_BOOL(); | 1912 RETURN_ON_FAILED_EXECUTION_BOOL(); |
1920 return true; | 1913 return true; |
1921 } | 1914 } |
1922 | 1915 |
1923 MaybeLocal<Value> Module::Evaluate(Local<Context> context) { | 1916 MaybeLocal<Value> Module::Evaluate(Local<Context> context) { |
1924 PREPARE_FOR_EXECUTION_WITH_CONTEXT_IN_RUNTIME_CALL_STATS_SCOPE( | 1917 PREPARE_FOR_EXECUTION_WITH_CONTEXT_IN_RUNTIME_CALL_STATS_SCOPE( |
1925 "v8", "V8.Execute", context, Module, Evaluate, MaybeLocal<Value>(), | 1918 "v8", "V8.Execute", context, Module, Evaluate, MaybeLocal<Value>(), |
1926 InternalEscapableScope, true); | 1919 InternalEscapableScope, true); |
1927 i::HistogramTimerScope execute_timer(isolate->counters()->execute(), true); | 1920 i::HistogramTimerScope execute_timer(isolate->counters()->execute(), true); |
1928 i::AggregatingHistogramTimerScope timer(isolate->counters()->compile_lazy()); | 1921 i::AggregatingHistogramTimerScope timer(isolate->counters()->compile_lazy()); |
(...skipping 7446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9375 Address callback_address = | 9368 Address callback_address = |
9376 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 9369 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
9377 VMState<EXTERNAL> state(isolate); | 9370 VMState<EXTERNAL> state(isolate); |
9378 ExternalCallbackScope call_scope(isolate, callback_address); | 9371 ExternalCallbackScope call_scope(isolate, callback_address); |
9379 callback(info); | 9372 callback(info); |
9380 } | 9373 } |
9381 | 9374 |
9382 | 9375 |
9383 } // namespace internal | 9376 } // namespace internal |
9384 } // namespace v8 | 9377 } // namespace v8 |
OLD | NEW |