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

Unified Diff: src/runtime/runtime-scopes.cc

Issue 1290053002: Revert of Group lexical context variables for faster look up. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 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/objects.h ('k') | src/scopeinfo.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/runtime/runtime-scopes.cc
diff --git a/src/runtime/runtime-scopes.cc b/src/runtime/runtime-scopes.cc
index 8b1b90ee2bf0ae4b2bdccee2f405a7b24407ca20..ff7e783393081cbe731a8d5f265a5b0fa852b773 100644
--- a/src/runtime/runtime-scopes.cc
+++ b/src/runtime/runtime-scopes.cc
@@ -36,10 +36,9 @@
bool is_const, bool is_function) {
Handle<ScriptContextTable> script_contexts(
global->native_context()->script_context_table());
- // We use LookupLexical to limit lookup to lexical variables. As long as
- // lexical variables are not used extensively, this is a performance win.
- // TODO(yangguo): reconsider this shortcut.
- if (ScriptContextTable::LookupLexical(script_contexts, name)) {
+ ScriptContextTable::LookupResult lookup;
+ if (ScriptContextTable::Lookup(script_contexts, name, &lookup) &&
+ IsLexicalVariableMode(lookup.mode)) {
return ThrowRedeclarationError(isolate, name);
}
@@ -625,13 +624,9 @@
for (int var = 0; var < scope_info->ContextLocalCount(); var++) {
Handle<String> name(scope_info->ContextLocalName(var));
VariableMode mode = scope_info->ContextLocalMode(var);
- if (IsLexicalVariableMode(mode)) {
- ScriptContextTable::LookupResult lookup;
- if (ScriptContextTable::Lookup(script_context, name, &lookup)) {
- return ThrowRedeclarationError(isolate, name);
- }
- } else {
- if (ScriptContextTable::LookupLexical(script_context, name)) {
+ ScriptContextTable::LookupResult lookup;
+ if (ScriptContextTable::Lookup(script_context, name, &lookup)) {
+ if (IsLexicalVariableMode(mode) || IsLexicalVariableMode(lookup.mode)) {
return ThrowRedeclarationError(isolate, name);
}
}
« no previous file with comments | « src/objects.h ('k') | src/scopeinfo.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698