Index: src/contexts.cc |
diff --git a/src/contexts.cc b/src/contexts.cc |
index dc4c0bd2c6f659775d734db0f6187eb80ebf2c16..7549d205182731b525d69674db7bed8e0e3cdd31 100644 |
--- a/src/contexts.cc |
+++ b/src/contexts.cc |
@@ -79,6 +79,15 @@ Context* Context::declaration_context() { |
return current; |
} |
+Context* Context::closure_context() { |
+ Context* current = this; |
+ while (!current->IsFunctionContext() && !current->IsScriptContext() && |
+ !current->IsNativeContext()) { |
+ current = current->previous(); |
+ DCHECK(current->closure() == closure()); |
+ } |
+ return current; |
+} |
JSObject* Context::extension_object() { |
DCHECK(IsNativeContext() || IsFunctionContext() || IsBlockContext()); |