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

Unified Diff: src/api.cc

Issue 2376693003: [modules] Move Evaluate from api.cc into internal Module implementation (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/objects.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 c9c5210fdfa2a05ba630c7b755e4487540423bfd..23f7cd787362461761816af1f90f961d1931c8bf 100644
--- a/src/api.cc
+++ b/src/api.cc
@@ -1937,29 +1937,8 @@ MaybeLocal<Value> Module::Evaluate(Local<Context> context) {
// It's an API error to call Evaluate before Instantiate.
CHECK(self->code()->IsJSFunction());
- // Each module can only be evaluated once.
- if (self->evaluated()) return Undefined(reinterpret_cast<Isolate*>(isolate));
- self->set_evaluated(true);
-
- i::Handle<i::FixedArray> requested_modules(self->requested_modules(),
- isolate);
- for (int i = 0, length = requested_modules->length(); i < length; ++i) {
- i::Handle<i::Module> import(i::Module::cast(requested_modules->get(i)),
- isolate);
- MaybeLocal<Value> maybe_result = Utils::ToLocal(import)->Evaluate(context);
- if (maybe_result.IsEmpty()) return maybe_result;
- }
-
- i::Handle<i::JSFunction> function(i::JSFunction::cast(self->code()), isolate);
- DCHECK_EQ(i::MODULE_SCOPE, function->shared()->scope_info()->scope_type());
- i::Handle<i::Object> receiver = isolate->factory()->undefined_value();
-
Local<Value> result;
- i::Handle<i::Object> argv[] = {self};
- has_pending_exception = !ToLocal<Value>(
- i::Execution::Call(isolate, function, receiver, arraysize(argv), argv),
- &result);
-
+ has_pending_exception = !ToLocal(i::Module::Evaluate(self), &result);
RETURN_ON_FAILED_EXECUTION(Value);
RETURN_ESCAPED(result);
}
« no previous file with comments | « no previous file | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698