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

Unified Diff: src/ast/scopes.cc

Issue 2281393002: Parameters are always context-allocated if accessible, so drop additional parameter lookup (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Also kill names_seen from DeserializeScopeInfo which was only there for parameters 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ast/scopes.cc
diff --git a/src/ast/scopes.cc b/src/ast/scopes.cc
index a0b23234166506e9ca328677d6056071d55dce64..129cbceaf5bef5c1104efa1332481c23582f7ce3 100644
--- a/src/ast/scopes.cc
+++ b/src/ast/scopes.cc
@@ -340,14 +340,12 @@ void Scope::DeserializeScopeInfo(Isolate* isolate,
DCHECK(ThreadId::Current().Equals(isolate->thread_id()));
- std::set<const AstRawString*> names_seen;
// Internalize context local & globals variables.
for (int var = 0; var < scope_info_->ContextLocalCount() +
scope_info_->ContextGlobalCount();
++var) {
Handle<String> name_handle(scope_info_->ContextLocalName(var), isolate);
const AstRawString* name = ast_value_factory->GetString(name_handle);
- if (!names_seen.insert(name).second) continue;
int index = Context::MIN_CONTEXT_SLOTS + var;
VariableMode mode = scope_info_->ContextLocalMode(var);
InitializationFlag init_flag = scope_info_->ContextLocalInitFlag(var);
@@ -366,26 +364,6 @@ void Scope::DeserializeScopeInfo(Isolate* isolate,
result->AllocateTo(location, index);
}
- // We must read parameters from the end since for multiply declared
- // parameters the value of the last declaration of that parameter is used
- // inside a function (and thus we need to look at the last index). Was bug#
- // 1110337.
- for (int index = scope_info_->ParameterCount() - 1; index >= 0; --index) {
- Handle<String> name_handle(scope_info_->ParameterName(index), isolate);
- const AstRawString* name = ast_value_factory->GetString(name_handle);
- if (!names_seen.insert(name).second) continue;
-
- VariableMode mode = DYNAMIC;
- InitializationFlag init_flag = kCreatedInitialized;
- MaybeAssignedFlag maybe_assigned_flag = kMaybeAssigned;
- VariableLocation location = VariableLocation::LOOKUP;
- Variable::Kind kind = Variable::NORMAL;
-
- Variable* result = variables_.Declare(zone(), this, name, mode, kind,
- init_flag, maybe_assigned_flag);
- result->AllocateTo(location, index);
- }
-
// Internalize function proxy for this scope.
if (scope_info_->HasFunctionName()) {
Handle<String> name_handle(scope_info_->FunctionName(), isolate);
@@ -616,7 +594,7 @@ Variable* Scope::LookupInScopeInfo(const AstRawString* name) {
// it's ok to get the Handle<String> here.
// If we have a serialized scope info, we might find the variable there.
// There should be no local slot with the given name.
- DCHECK(scope_info_->StackSlotIndex(*name_handle) < 0);
+ DCHECK_LT(scope_info_->StackSlotIndex(*name_handle), 0);
VariableMode mode;
InitializationFlag init_flag;
@@ -631,18 +609,6 @@ Variable* Scope::LookupInScopeInfo(const AstRawString* name) {
&init_flag, &maybe_assigned_flag);
DCHECK(index < 0 || (is_script_scope() && mode == VAR));
}
- if (index < 0) {
- location = VariableLocation::LOOKUP;
- index = scope_info_->ParameterIndex(*name_handle);
- if (index >= 0) {
- mode = DYNAMIC;
- init_flag = kCreatedInitialized;
- // Be conservative and flag parameters as maybe assigned. Better
- // information would require ScopeInfo to serialize the maybe_assigned bit
- // also for parameters.
- maybe_assigned_flag = kMaybeAssigned;
- }
- }
if (index < 0 && scope_type() == MODULE_SCOPE) {
location = VariableLocation::MODULE;
index = -1; // TODO(neis): Find module variables in scope info.
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698