| Index: src/ast/scopeinfo.cc
|
| diff --git a/src/ast/scopeinfo.cc b/src/ast/scopeinfo.cc
|
| index c5c771f595a92e65b981c58d4cd46c81e2f3605d..a9e824f415bae54881eb5dc84c3787905418756c 100644
|
| --- a/src/ast/scopeinfo.cc
|
| +++ b/src/ast/scopeinfo.cc
|
| @@ -4,6 +4,7 @@
|
|
|
| #include <stdlib.h>
|
|
|
| +#include "src/ast/context-slot-cache.h"
|
| #include "src/ast/scopes.h"
|
| #include "src/bootstrapper.h"
|
|
|
| @@ -478,6 +479,15 @@
|
| DCHECK_NOT_NULL(maybe_assigned_flag);
|
|
|
| if (scope_info->length() > 0) {
|
| + ContextSlotCache* context_slot_cache =
|
| + scope_info->GetIsolate()->context_slot_cache();
|
| + int result = context_slot_cache->Lookup(*scope_info, *name, mode, init_flag,
|
| + maybe_assigned_flag);
|
| + if (result != ContextSlotCache::kNotFound) {
|
| + DCHECK(result < scope_info->ContextLength());
|
| + return result;
|
| + }
|
| +
|
| int start = scope_info->ContextLocalNameEntriesIndex();
|
| int end = start + scope_info->ContextLocalCount();
|
| for (int i = start; i < end; ++i) {
|
| @@ -486,11 +496,17 @@
|
| *mode = scope_info->ContextLocalMode(var);
|
| *init_flag = scope_info->ContextLocalInitFlag(var);
|
| *maybe_assigned_flag = scope_info->ContextLocalMaybeAssignedFlag(var);
|
| - int result = Context::MIN_CONTEXT_SLOTS + var;
|
| + result = Context::MIN_CONTEXT_SLOTS + var;
|
| +
|
| + context_slot_cache->Update(scope_info, name, *mode, *init_flag,
|
| + *maybe_assigned_flag, result);
|
| DCHECK(result < scope_info->ContextLength());
|
| return result;
|
| }
|
| }
|
| + // Cache as not found. Mode, init flag and maybe assigned flag don't matter.
|
| + context_slot_cache->Update(scope_info, name, TEMPORARY,
|
| + kNeedsInitialization, kNotAssigned, -1);
|
| }
|
|
|
| return -1;
|
|
|