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

Unified Diff: src/ast/scopes.cc

Issue 2233673003: Remove CONST_LEGACY VariableMode (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
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
Index: src/ast/scopes.cc
diff --git a/src/ast/scopes.cc b/src/ast/scopes.cc
index c49d60400a168ea1167b1114e86da003cbe47764..8808449be2a1a0da4b0eff767e0b1b339299ec60 100644
--- a/src/ast/scopes.cc
+++ b/src/ast/scopes.cc
@@ -335,11 +335,9 @@ void Scope::DeserializeScopeInfo(Isolate* isolate,
if (scope_info_->HasFunctionName()) {
Handle<String> name_handle(scope_info_->FunctionName(), isolate);
const AstRawString* name = ast_value_factory->GetString(name_handle);
- VariableMode mode;
- int index = scope_info_->FunctionContextSlotIndex(*name_handle, &mode);
+ int index = scope_info_->FunctionContextSlotIndex(*name_handle);
if (index >= 0) {
Variable* result = AsDeclarationScope()->DeclareFunctionVar(name);
- DCHECK_EQ(mode, result->mode());
result->AllocateTo(VariableLocation::CONTEXT, index);
}
}
@@ -428,9 +426,11 @@ void DeclarationScope::DeclareDefaultFunctionVariables(
Variable* DeclarationScope::DeclareFunctionVar(const AstRawString* name) {
DCHECK(is_function_scope());
DCHECK_NULL(function_);
- VariableMode mode = is_strict(language_mode()) ? CONST : CONST_LEGACY;
- function_ = new (zone())
- Variable(this, name, mode, Variable::NORMAL, kCreatedInitialized);
+ Variable::Kind kind = is_sloppy(language_mode())
+ ? Variable::SLOPPY_FUNCTION_NAME
+ : Variable::NORMAL;
+ function_ =
+ new (zone()) Variable(this, name, CONST, kind, kCreatedInitialized);
return function_;
}
@@ -605,11 +605,9 @@ Variable* DeclarationScope::LookupFunctionVar(const AstRawString* name) {
return function_;
} else if (!scope_info_.is_null()) {
// If we are backed by a scope info, try to lookup the variable there.
- VariableMode mode;
- int index = scope_info_->FunctionContextSlotIndex(*(name->string()), &mode);
+ int index = scope_info_->FunctionContextSlotIndex(*(name->string()));
if (index < 0) return nullptr;
Variable* var = DeclareFunctionVar(name);
- DCHECK_EQ(mode, var->mode());
var->AllocateTo(VariableLocation::CONTEXT, index);
return var;
} else {
« no previous file with comments | « src/ast/scopeinfo.cc ('k') | src/ast/variables.h » ('j') | src/compiler/ast-graph-builder.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698