Chromium Code Reviews| Index: src/contexts.cc |
| diff --git a/src/contexts.cc b/src/contexts.cc |
| index 515a6b53ac109f5a617cb51565470bb090bc0610..1a76e11367c2cedef83479bb31377f3f17f2cccf 100644 |
| --- a/src/contexts.cc |
| +++ b/src/contexts.cc |
| @@ -61,6 +61,7 @@ bool Context::is_declaration_context() { |
| IsModuleContext()) { |
| return true; |
| } |
| + if (IsEvalContext()) return closure()->shared()->language_mode() == STRICT; |
| if (!IsBlockContext()) return false; |
| Object* ext = extension(); |
| // If we have the special extension, we immediately know it must be a |
| @@ -74,7 +75,6 @@ Context* Context::declaration_context() { |
| Context* current = this; |
| while (!current->is_declaration_context()) { |
| current = current->previous(); |
| - DCHECK(current->closure() == closure()); |
| } |
| return current; |
| } |
| @@ -82,7 +82,8 @@ Context* Context::declaration_context() { |
| Context* Context::closure_context() { |
| Context* current = this; |
| while (!current->IsFunctionContext() && !current->IsScriptContext() && |
| - !current->IsModuleContext() && !current->IsNativeContext()) { |
| + !current->IsModuleContext() && !current->IsNativeContext() && |
| + !current->IsEvalContext()) { |
| current = current->previous(); |
| DCHECK(current->closure() == closure()); |
| } |
| @@ -90,7 +91,8 @@ Context* Context::closure_context() { |
| } |
| JSObject* Context::extension_object() { |
| - DCHECK(IsNativeContext() || IsFunctionContext() || IsBlockContext()); |
| + DCHECK(IsNativeContext() || IsFunctionContext() || IsBlockContext() || |
| + IsEvalContext()); |
| HeapObject* object = extension(); |
| if (object->IsTheHole(GetIsolate())) return nullptr; |
| if (IsBlockContext()) { |
| @@ -103,7 +105,7 @@ JSObject* Context::extension_object() { |
| } |
| JSReceiver* Context::extension_receiver() { |
| - DCHECK(IsNativeContext() || IsWithContext() || |
| + DCHECK(IsNativeContext() || IsWithContext() || IsEvalContext() || |
| IsFunctionContext() || IsBlockContext()); |
| return IsWithContext() ? JSReceiver::cast( |
| ContextExtension::cast(extension())->extension()) |
| @@ -112,7 +114,7 @@ JSReceiver* Context::extension_receiver() { |
| ScopeInfo* Context::scope_info() { |
| DCHECK(!IsNativeContext()); |
| - if (IsFunctionContext() || IsModuleContext()) { |
| + if (IsFunctionContext() || IsModuleContext() || IsEvalContext()) { |
| return closure()->shared()->scope_info(); |
| } |
| HeapObject* object = extension(); |
| @@ -225,7 +227,8 @@ Handle<Object> Context::Lookup(Handle<String> name, ContextLookupFlags flags, |
| // 1. Check global objects, subjects of with, and extension objects. |
| if ((context->IsNativeContext() || |
| (context->IsWithContext() && ((flags & SKIP_WITH_CONTEXT) == 0)) || |
| - context->IsFunctionContext() || context->IsBlockContext()) && |
| + context->IsFunctionContext() || context->IsEvalContext() || |
|
adamk
2016/12/14 12:23:31
I don't think you should need IsEvalContext() here
Dan Ehrenberg
2016/12/14 22:53:30
Done.
|
| + context->IsBlockContext()) && |
| context->extension_receiver() != nullptr) { |
| Handle<JSReceiver> object(context->extension_receiver()); |
| @@ -301,12 +304,10 @@ Handle<Object> Context::Lookup(Handle<String> name, ContextLookupFlags flags, |
| // 2. Check the context proper if it has slots. |
| if (context->IsFunctionContext() || context->IsBlockContext() || |
| - context->IsScriptContext()) { |
| + context->IsScriptContext() || context->IsEvalContext()) { |
| // Use serialized scope information of functions and blocks to search |
| // for the context index. |
| - Handle<ScopeInfo> scope_info(context->IsFunctionContext() |
| - ? context->closure()->shared()->scope_info() |
| - : context->scope_info()); |
| + Handle<ScopeInfo> scope_info(context->scope_info()); |
| VariableMode mode; |
| InitializationFlag flag; |
| MaybeAssignedFlag maybe_assigned_flag; |