Index: src/contexts.cc |
diff --git a/src/contexts.cc b/src/contexts.cc |
index 76784bd704602b955924c6255c8883b013b1e624..494b8f21a1f358fe7fb5151d185d1b5b38fe18ad 100644 |
--- a/src/contexts.cc |
+++ b/src/contexts.cc |
@@ -304,10 +304,15 @@ void Context::ClearOptimizedFunctions() { |
#ifdef DEBUG |
-bool Context::IsBootstrappingOrContext(Object* object) { |
+bool Context::IsBootstrappingOrValidParentContext( |
+ Object* object, Context* child) { |
// During bootstrapping we allow all objects to pass as |
// contexts. This is necessary to fix circular dependencies. |
- return Isolate::Current()->bootstrapper()->IsActive() || object->IsContext(); |
+ if (Isolate::Current()->bootstrapper()->IsActive()) return true; |
+ if (!object->IsContext()) return false; |
+ Context* context = Context::cast(object); |
+ return context->IsGlobalContext() || context->IsModuleContext() || |
+ !child->IsModuleContext(); |
} |