Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(273)

Side by Side Diff: src/api.cc

Issue 2405313002: [modules] Store Module metadata in per-Context EmbedderData (Closed)
Patch Set: Formatting Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « include/v8.h ('k') | src/d8.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1883 matching lines...) Expand 10 before | Expand all | Expand 10 after
1894 Local<String> Module::GetModuleRequest(int i) const { 1894 Local<String> Module::GetModuleRequest(int i) const {
1895 CHECK_GE(i, 0); 1895 CHECK_GE(i, 0);
1896 i::Handle<i::Module> self = Utils::OpenHandle(this); 1896 i::Handle<i::Module> self = Utils::OpenHandle(this);
1897 i::Isolate* isolate = self->GetIsolate(); 1897 i::Isolate* isolate = self->GetIsolate();
1898 i::Handle<i::FixedArray> module_requests(self->info()->module_requests(), 1898 i::Handle<i::FixedArray> module_requests(self->info()->module_requests(),
1899 isolate); 1899 isolate);
1900 CHECK_LT(i, module_requests->length()); 1900 CHECK_LT(i, module_requests->length());
1901 return ToApiHandle<String>(i::handle(module_requests->get(i), isolate)); 1901 return ToApiHandle<String>(i::handle(module_requests->get(i), isolate));
1902 } 1902 }
1903 1903
1904 void Module::SetEmbedderData(Local<Value> data) { 1904 int Module::GetIdentityHash() const { return Utils::OpenHandle(this)->hash(); }
1905 Utils::OpenHandle(this)->set_embedder_data(*Utils::OpenHandle(*data));
1906 }
1907
1908 Local<Value> Module::GetEmbedderData() const {
1909 auto self = Utils::OpenHandle(this);
1910 return ToApiHandle<Value>(
1911 i::handle(self->embedder_data(), self->GetIsolate()));
1912 }
1913 1905
1914 bool Module::Instantiate(Local<Context> context, 1906 bool Module::Instantiate(Local<Context> context,
1915 Module::ResolveCallback callback, 1907 Module::ResolveCallback callback) {
1916 Local<Value> callback_data) {
1917 PREPARE_FOR_EXECUTION_BOOL(context, Module, Instantiate); 1908 PREPARE_FOR_EXECUTION_BOOL(context, Module, Instantiate);
1918 has_pending_exception = !i::Module::Instantiate( 1909 has_pending_exception =
1919 Utils::OpenHandle(this), context, callback, callback_data); 1910 !i::Module::Instantiate(Utils::OpenHandle(this), context, callback);
1920 RETURN_ON_FAILED_EXECUTION_BOOL(); 1911 RETURN_ON_FAILED_EXECUTION_BOOL();
1921 return true; 1912 return true;
1922 } 1913 }
1923 1914
1924 MaybeLocal<Value> Module::Evaluate(Local<Context> context) { 1915 MaybeLocal<Value> Module::Evaluate(Local<Context> context) {
1925 PREPARE_FOR_EXECUTION_WITH_CONTEXT_IN_RUNTIME_CALL_STATS_SCOPE( 1916 PREPARE_FOR_EXECUTION_WITH_CONTEXT_IN_RUNTIME_CALL_STATS_SCOPE(
1926 "v8", "V8.Execute", context, Module, Evaluate, MaybeLocal<Value>(), 1917 "v8", "V8.Execute", context, Module, Evaluate, MaybeLocal<Value>(),
1927 InternalEscapableScope, true); 1918 InternalEscapableScope, true);
1928 i::HistogramTimerScope execute_timer(isolate->counters()->execute(), true); 1919 i::HistogramTimerScope execute_timer(isolate->counters()->execute(), true);
1929 i::AggregatingHistogramTimerScope timer(isolate->counters()->compile_lazy()); 1920 i::AggregatingHistogramTimerScope timer(isolate->counters()->compile_lazy());
(...skipping 7488 matching lines...) Expand 10 before | Expand all | Expand 10 after
9418 Address callback_address = 9409 Address callback_address =
9419 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); 9410 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback));
9420 VMState<EXTERNAL> state(isolate); 9411 VMState<EXTERNAL> state(isolate);
9421 ExternalCallbackScope call_scope(isolate, callback_address); 9412 ExternalCallbackScope call_scope(isolate, callback_address);
9422 callback(info); 9413 callback(info);
9423 } 9414 }
9424 9415
9425 9416
9426 } // namespace internal 9417 } // namespace internal
9427 } // namespace v8 9418 } // namespace v8
OLDNEW
« no previous file with comments | « include/v8.h ('k') | src/d8.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698