Index: src/runtime.cc |
diff --git a/src/runtime.cc b/src/runtime.cc |
index 74f3e43ada4e995fd26ba6c038a1ac008598db16..07951dd78f4ed49a3e2589e7ba979663348597f2 100644 |
--- a/src/runtime.cc |
+++ b/src/runtime.cc |
@@ -8843,19 +8843,25 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_PushBlockContext) { |
} |
+RUNTIME_FUNCTION(MaybeObject*, Runtime_IsJSModule) { |
+ ASSERT(args.length() == 1); |
+ Object* obj = args[0]; |
+ return isolate->heap()->ToBoolean(obj->IsJSModule()); |
+} |
+ |
+ |
RUNTIME_FUNCTION(MaybeObject*, Runtime_PushModuleContext) { |
NoHandleAllocation ha; |
- ASSERT(args.length() == 2); |
- CONVERT_ARG_CHECKED(ScopeInfo, scope_info, 0); |
- CONVERT_ARG_HANDLE_CHECKED(JSModule, instance, 1); |
+ ASSERT(args.length() == 1); |
+ CONVERT_ARG_HANDLE_CHECKED(JSModule, instance, 0); |
- Context* context; |
- MaybeObject* maybe_context = |
- isolate->heap()->AllocateModuleContext(isolate->context(), |
- scope_info); |
- if (!maybe_context->To(&context)) return maybe_context; |
- // Also initialize the context slot of the instance object. |
- instance->set_context(context); |
+ Context* context = Context::cast(instance->context()); |
+ Context* previous = isolate->context(); |
+ ASSERT(context->IsModuleContext()); |
+ // Initialize the context links. |
+ context->set_previous(previous); |
+ context->set_closure(previous->closure()); |
+ context->set_global(previous->global()); |
isolate->set_context(context); |
return context; |