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

Side by Side Diff: src/api.cc

Issue 2361593002: [modules] Do path resolution relative to each module file in d8 (Closed)
Patch Set: Review comments Created 4 years, 3 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.cc » ('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 1897 matching lines...) Expand 10 before | Expand all | Expand 10 after
1908 shared = i::handle(i::SharedFunctionInfo::cast(self->code()), isolate); 1908 shared = i::handle(i::SharedFunctionInfo::cast(self->code()), isolate);
1909 } else { 1909 } else {
1910 shared = i::handle(i::JSFunction::cast(self->code())->shared(), isolate); 1910 shared = i::handle(i::JSFunction::cast(self->code())->shared(), isolate);
1911 } 1911 }
1912 i::Handle<i::FixedArray> module_requests( 1912 i::Handle<i::FixedArray> module_requests(
1913 shared->scope_info()->ModuleDescriptorInfo()->module_requests(), isolate); 1913 shared->scope_info()->ModuleDescriptorInfo()->module_requests(), isolate);
1914 CHECK_LT(i, module_requests->length()); 1914 CHECK_LT(i, module_requests->length());
1915 return ToApiHandle<String>(i::handle(module_requests->get(i), isolate)); 1915 return ToApiHandle<String>(i::handle(module_requests->get(i), isolate));
1916 } 1916 }
1917 1917
1918 void Module::SetEmbedderData(Local<Value> data) {
1919 Utils::OpenHandle(this)->set_embedder_data(*Utils::OpenHandle(*data));
1920 }
1921
1922 Local<Value> Module::GetEmbedderData() const {
1923 auto self = Utils::OpenHandle(this);
1924 return ToApiHandle<Value>(
1925 i::handle(self->embedder_data(), self->GetIsolate()));
1926 }
1927
1918 bool Module::Instantiate(Local<Context> v8_context, 1928 bool Module::Instantiate(Local<Context> v8_context,
1919 Module::ResolveCallback callback, 1929 Module::ResolveCallback callback,
1920 Local<Value> callback_data) { 1930 Local<Value> callback_data) {
1921 i::Handle<i::Module> self = Utils::OpenHandle(this); 1931 i::Handle<i::Module> self = Utils::OpenHandle(this);
1922 i::Isolate* isolate = self->GetIsolate(); 1932 i::Isolate* isolate = self->GetIsolate();
1923 1933
1924 // Already instantiated. 1934 // Already instantiated.
1925 if (self->code()->IsJSFunction()) return true; 1935 if (self->code()->IsJSFunction()) return true;
1926 1936
1927 i::Handle<i::SharedFunctionInfo> shared( 1937 i::Handle<i::SharedFunctionInfo> shared(
(...skipping 7492 matching lines...) Expand 10 before | Expand all | Expand 10 after
9420 Address callback_address = 9430 Address callback_address =
9421 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); 9431 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback));
9422 VMState<EXTERNAL> state(isolate); 9432 VMState<EXTERNAL> state(isolate);
9423 ExternalCallbackScope call_scope(isolate, callback_address); 9433 ExternalCallbackScope call_scope(isolate, callback_address);
9424 callback(info); 9434 callback(info);
9425 } 9435 }
9426 9436
9427 9437
9428 } // namespace internal 9438 } // namespace internal
9429 } // namespace v8 9439 } // namespace v8
OLDNEW
« no previous file with comments | « include/v8.h ('k') | src/d8.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698