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

Unified Diff: src/objects.cc

Issue 2379063002: Revert of [modules] Properly initialize declared variables. (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 | « src/objects.h ('k') | src/parsing/parser.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects.cc
diff --git a/src/objects.cc b/src/objects.cc
index e817e777f11669b4bdf7935708c4d216a6bbafad..6b7c17a68a2797f3fc4285b8bc2065148cd107ce 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -19906,7 +19906,7 @@
}
MaybeHandle<Object> Module::Evaluate(Handle<Module> module) {
- DCHECK(module->code()->IsJSFunction()); // Instantiated.
+ DCHECK(module->code()->IsJSFunction());
Isolate* isolate = module->GetIsolate();
@@ -19914,28 +19914,17 @@
if (module->evaluated()) return isolate->factory()->undefined_value();
module->set_evaluated(true);
- // Initialization.
+ Handle<FixedArray> requested_modules(module->requested_modules(), isolate);
+ for (int i = 0, length = requested_modules->length(); i < length; ++i) {
+ Handle<Module> import(Module::cast(requested_modules->get(i)), isolate);
+ RETURN_ON_EXCEPTION(isolate, Evaluate(import), Object);
+ }
+
Handle<JSFunction> function(JSFunction::cast(module->code()), isolate);
DCHECK_EQ(MODULE_SCOPE, function->shared()->scope_info()->scope_type());
Handle<Object> receiver = isolate->factory()->undefined_value();
Handle<Object> argv[] = {module};
- Handle<Object> generator;
- ASSIGN_RETURN_ON_EXCEPTION(
- isolate, generator,
- Execution::Call(isolate, function, receiver, arraysize(argv), argv),
- Object);
-
- // Recursion.
- Handle<FixedArray> requested_modules(module->requested_modules(), isolate);
- for (int i = 0, length = requested_modules->length(); i < length; ++i) {
- Handle<Module> import(Module::cast(requested_modules->get(i)), isolate);
- RETURN_ON_EXCEPTION(isolate, Evaluate(import), Object);
- }
-
- // Evaluation of module body.
- Handle<JSFunction> resume(
- isolate->native_context()->generator_next_internal(), isolate);
- return Execution::Call(isolate, resume, generator, 0, nullptr);
+ return Execution::Call(isolate, function, receiver, arraysize(argv), argv);
}
} // namespace internal
« no previous file with comments | « src/objects.h ('k') | src/parsing/parser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698