@@ -96,7 +96,7 @@ Handle<Object> Context::Lookup(Handle<String> name, ContextLookupFlags flags,
9696 PrintF (" \n " );
9797 }
9898
99- // check extension/with object
99+ // Check extension/with/global object.
100100 if (context->has_extension ()) {
101101 Handle<JSObject> extension = Handle<JSObject>(context->extension (),
102102 isolate);
@@ -119,7 +119,8 @@ Handle<Object> Context::Lookup(Handle<String> name, ContextLookupFlags flags,
119119 }
120120 }
121121
122- if (context->is_function_context ()) {
122+ // Only functions can have locals, parameters, and a function name.
123+ if (context->IsFunctionContext ()) {
123124 // we have context-local slots
124125
125126 // check non-parameter locals in context
@@ -189,9 +190,8 @@ Handle<Object> Context::Lookup(Handle<String> name, ContextLookupFlags flags,
189190 // proceed with enclosing context
190191 if (context->IsGlobalContext ()) {
191192 follow_context_chain = false ;
192- } else if (context->is_function_context ()) {
193- context = Handle<Context>(Context::cast (context->closure ()->context ()),
194- isolate);
193+ } else if (context->IsFunctionContext ()) {
194+ context = Handle<Context>(context->closure ()->context (), isolate);
195195 } else {
196196 context = Handle<Context>(context->previous (), isolate);
197197 }
@@ -212,11 +212,12 @@ bool Context::GlobalIfNotShadowedByEval(Handle<String> name) {
212212 // before the global context and check that there are no context
213213 // extension objects (conservative check for with statements).
214214 while (!context->IsGlobalContext ()) {
215- // Check if the context is a potentially a with context.
215+ // Check if the context is a catch or with context, or has called
216+ // non-strict eval.
216217 if (context->has_extension ()) return false ;
217218
218219 // Not a with context so it must be a function context.
219- ASSERT (context->is_function_context ());
220+ ASSERT (context->IsFunctionContext ());
220221
221222 // Check non-parameter locals.
222223 Handle<SerializedScopeInfo> scope_info (
0 commit comments