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

Unified Diff: src/api.cc

Issue 2328283002: Revert of [modules] Basic support of exports (Closed)
Patch Set: 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/ast/ast.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/api.cc
diff --git a/src/api.cc b/src/api.cc
index 0e2c6d1af919b781220bf1948aa99a21766c48ab..8eb0f2d55c51f475f0d923400a0e40ef64d3ba0f 100644
--- a/src/api.cc
+++ b/src/api.cc
@@ -1846,22 +1846,11 @@
i::TimerEventScope<i::TimerEventExecute> timer_scope(isolate);
TRACE_EVENT_CALL_STATS_SCOPED(isolate, "v8", "V8.Execute");
auto fun = i::Handle<i::JSFunction>::cast(Utils::OpenHandle(this));
-
- i::Handle<i::Object> receiver;
+ i::Handle<i::Object> receiver = isolate->global_proxy();
Local<Value> result;
-
- if (fun->shared()->scope_info()->scope_type() == i::MODULE_SCOPE) {
- receiver = isolate->factory()->undefined_value();
- i::Handle<i::Object> argv[] = {
- handle(isolate->native_context()->current_module())};
- has_pending_exception = !ToLocal<Value>(
- i::Execution::Call(isolate, fun, receiver, 1, argv), &result);
- } else {
- receiver = isolate->global_proxy();
- has_pending_exception = !ToLocal<Value>(
- i::Execution::Call(isolate, fun, receiver, 0, nullptr), &result);
- }
-
+ has_pending_exception =
+ !ToLocal<Value>(i::Execution::Call(isolate, fun, receiver, 0, NULL),
+ &result);
RETURN_ON_FAILED_EXECUTION(Value);
RETURN_ESCAPED(result);
}
@@ -2002,34 +1991,7 @@
Local<UnboundScript> generic;
if (!maybe.ToLocal(&generic)) return MaybeLocal<Script>();
v8::Context::Scope scope(context);
- auto result = generic->BindToCurrentContext();
-
- i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
- i::Handle<i::JSModule> module = i_isolate->factory()->NewJSModule();
- // TODO(neis): Storing the module into the native context is a temporary hack
- // to pass it to the Script::Run function. This will be removed once we
- // support modules in the API.
- i_isolate->native_context()->set_current_module(*module);
-
- i::Handle<i::SharedFunctionInfo> shared =
- i::Handle<i::SharedFunctionInfo>::cast(Utils::OpenHandle(*generic));
- i::Handle<i::FixedArray> regular_exports =
- i::handle(shared->scope_info()->ModuleDescriptorInfo()->regular_exports(),
- i_isolate);
- // TODO(neis): This will create multiple cells for the same local variable if
- // exported under multiple names, which is wrong but cannot be observed at the
- // moment. This will be fixed by doing the full-fledged linking here once we
- // get there.
- for (int i = 0; i < regular_exports->length(); ++i) {
- i::Handle<i::ModuleInfoEntry> entry =
- i::handle(i::ModuleInfoEntry::cast(regular_exports->get(i)), i_isolate);
- DCHECK(entry->import_name()->IsUndefined(i_isolate));
- i::Handle<i::String> export_name =
- handle(i::String::cast(entry->export_name()), i_isolate);
- i::JSModule::CreateExport(module, export_name);
- }
-
- return result;
+ return generic->BindToCurrentContext();
}
« no previous file with comments | « no previous file | src/ast/ast.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698