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 1971 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1982 return false; | 1982 return false; |
1983 } | 1983 } |
1984 } | 1984 } |
1985 | 1985 |
1986 // Resolve imports. | 1986 // Resolve imports. |
1987 for (int i = 0, n = regular_imports->length(); i < n; ++i) { | 1987 for (int i = 0, n = regular_imports->length(); i < n; ++i) { |
1988 i::Handle<i::ModuleInfoEntry> entry( | 1988 i::Handle<i::ModuleInfoEntry> entry( |
1989 i::ModuleInfoEntry::cast(regular_imports->get(i)), isolate); | 1989 i::ModuleInfoEntry::cast(regular_imports->get(i)), isolate); |
1990 i::Handle<i::String> name(i::String::cast(entry->import_name()), isolate); | 1990 i::Handle<i::String> name(i::String::cast(entry->import_name()), isolate); |
1991 int module_request = i::Smi::cast(entry->module_request())->value(); | 1991 int module_request = i::Smi::cast(entry->module_request())->value(); |
1992 if (i::Module::ResolveImport(module, name, module_request).is_null()) { | 1992 if (i::Module::ResolveImport(module, name, module_request, true) |
| 1993 .is_null()) { |
1993 return false; | 1994 return false; |
1994 } | 1995 } |
1995 } | 1996 } |
1996 | 1997 |
1997 // Resolve indirect exports. | 1998 // Resolve indirect exports. |
1998 for (int i = 0, n = special_exports->length(); i < n; ++i) { | 1999 for (int i = 0, n = special_exports->length(); i < n; ++i) { |
1999 i::Handle<i::ModuleInfoEntry> entry( | 2000 i::Handle<i::ModuleInfoEntry> entry( |
2000 i::ModuleInfoEntry::cast(special_exports->get(i)), isolate); | 2001 i::ModuleInfoEntry::cast(special_exports->get(i)), isolate); |
2001 i::Handle<i::String> name(i::String::cast(entry->export_name()), isolate); | 2002 i::Handle<i::Object> name(entry->export_name(), isolate); |
2002 if (i::Module::ResolveExport(module, name).is_null()) { | 2003 if (name->IsUndefined(isolate)) continue; // Star export. |
| 2004 if (i::Module::ResolveExport(module, i::Handle<i::String>::cast(name), true) |
| 2005 .is_null()) { |
2003 return false; | 2006 return false; |
2004 } | 2007 } |
2005 } | 2008 } |
2006 | 2009 |
2007 return true; | 2010 return true; |
2008 } | 2011 } |
2009 | 2012 |
2010 bool Module::Instantiate(Local<Context> context, | 2013 bool Module::Instantiate(Local<Context> context, |
2011 Module::ResolveCallback callback, | 2014 Module::ResolveCallback callback, |
2012 Local<Value> callback_data) { | 2015 Local<Value> callback_data) { |
(...skipping 7470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9483 Address callback_address = | 9486 Address callback_address = |
9484 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 9487 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
9485 VMState<EXTERNAL> state(isolate); | 9488 VMState<EXTERNAL> state(isolate); |
9486 ExternalCallbackScope call_scope(isolate, callback_address); | 9489 ExternalCallbackScope call_scope(isolate, callback_address); |
9487 callback(info); | 9490 callback(info); |
9488 } | 9491 } |
9489 | 9492 |
9490 | 9493 |
9491 } // namespace internal | 9494 } // namespace internal |
9492 } // namespace v8 | 9495 } // namespace v8 |
OLD | NEW |