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

Unified Diff: src/contexts.cc

Issue 1281883002: Group lexical context variables for faster look up. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: added comments and TODOs Created 5 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/contexts.h ('k') | src/objects.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/contexts.cc
diff --git a/src/contexts.cc b/src/contexts.cc
index 9f39aecd542ca24dbbad3bf7baf1109e853494ba..6bd4fcef11053c6285e02b1a98adda3e4afaf20a 100644
--- a/src/contexts.cc
+++ b/src/contexts.cc
@@ -56,6 +56,19 @@ bool ScriptContextTable::Lookup(Handle<ScriptContextTable> table,
}
+bool ScriptContextTable::LookupLexical(Handle<ScriptContextTable> table,
+ Handle<String> name) {
+ for (int i = 0; i < table->used(); i++) {
+ Handle<Context> context = GetContext(table, i);
+ DCHECK(context->IsScriptContext());
+ Handle<ScopeInfo> scope_info(ScopeInfo::cast(context->extension()));
+ int slot_index = ScopeInfo::LexicalContextSlotIndex(scope_info, name);
+ if (slot_index >= 0) return true;
+ }
+ return false;
+}
+
+
Context* Context::declaration_context() {
Context* current = this;
while (!current->IsFunctionContext() && !current->IsNativeContext() &&
« no previous file with comments | « src/contexts.h ('k') | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698