Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(53)

Unified Diff: src/ast/scopeinfo.cc

Issue 2287783003: Revert of Always deserialize scope infos for parsing (Closed)
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/ast/context-slot-cache.cc ('k') | src/ast/scopes.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
« no previous file with comments | « src/ast/context-slot-cache.cc ('k') | src/ast/scopes.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698