Commit e34dfe04 authored by marja's avatar marja Committed by Commit bot

Include only stuff you need, part 9: variables.h

TBR=bmeurer@chromium.org
BUG=v8:5294

Review-Url: https://codereview.chromium.org/2324783002
Cr-Commit-Position: refs/heads/master@{#39304}
parent 4266d33e
......@@ -172,10 +172,10 @@ VariableProxy::VariableProxy(Variable* var, int start_position,
}
VariableProxy::VariableProxy(const AstRawString* name,
Variable::Kind variable_kind, int start_position,
VariableKind variable_kind, int start_position,
int end_position)
: Expression(start_position, kVariableProxy),
bit_field_(IsThisField::encode(variable_kind == Variable::THIS) |
bit_field_(IsThisField::encode(variable_kind == THIS_VARIABLE) |
IsAssignedField::encode(false) |
IsResolvedField::encode(false)),
end_position_(end_position),
......
......@@ -1654,7 +1654,7 @@ class VariableProxy final : public Expression {
friend class AstNodeFactory;
VariableProxy(Variable* var, int start_position, int end_position);
VariableProxy(const AstRawString* name, Variable::Kind variable_kind,
VariableProxy(const AstRawString* name, VariableKind variable_kind,
int start_position, int end_position);
explicit VariableProxy(const VariableProxy* copy_from);
......@@ -3247,7 +3247,7 @@ class AstNodeFactory final BASE_EMBEDDED {
}
VariableProxy* NewVariableProxy(const AstRawString* name,
Variable::Kind variable_kind,
VariableKind variable_kind,
int start_position = kNoSourcePosition,
int end_position = kNoSourcePosition) {
DCHECK_NOT_NULL(name);
......
......@@ -8,6 +8,13 @@
#include "src/ast/scopes.h"
#include "src/bootstrapper.h"
// FIXME(mstarzinger, marja): This is weird, but required because of the missing
// (disallowed) include: src/factory.h -> src/objects-inl.h
#include "src/objects-inl.h"
// FIXME(mstarzinger, marja): This is weird, but required because of the missing
// (disallowed) include: src/type-feedback-vector.h ->
// src/type-feedback-vector-inl.h
#include "src/type-feedback-vector-inl.h"
namespace v8 {
namespace internal {
......
......@@ -7,7 +7,6 @@
#include "src/allocation.h"
#include "src/ast/modules.h"
#include "src/ast/variables.h"
namespace v8 {
namespace internal {
......
......@@ -9,6 +9,7 @@
#include "src/ast/ast-value-factory.h"
#include "src/ast/scopes.h"
#include "src/base/platform/platform.h"
#include "src/globals.h"
namespace v8 {
namespace internal {
......@@ -603,8 +604,8 @@ void AstPrinter::PrintLiteralWithModeIndented(const char* info,
PrintLiteralIndented(info, value, true);
} else {
EmbeddedVector<char, 256> buf;
int pos = SNPrintF(buf, "%s (mode = %s", info,
Variable::Mode2String(var->mode()));
int pos =
SNPrintF(buf, "%s (mode = %s", info, VariableMode2String(var->mode()));
SNPrintF(buf + pos, ")");
PrintLiteralIndented(buf.start(), value, true);
}
......
......@@ -6,6 +6,7 @@
#include "src/ast/context-slot-cache.h"
#include "src/ast/scopes.h"
#include "src/ast/variables.h"
#include "src/bootstrapper.h"
namespace v8 {
......
......@@ -29,7 +29,7 @@ VariableMap::VariableMap(Zone* zone)
Variable* VariableMap::Declare(Zone* zone, Scope* scope,
const AstRawString* name, VariableMode mode,
Variable::Kind kind,
VariableKind kind,
InitializationFlag initialization_flag,
MaybeAssignedFlag maybe_assigned_flag,
bool* added) {
......@@ -135,7 +135,7 @@ DeclarationScope::DeclarationScope(Zone* zone,
// Make sure that if we don't find the global 'this', it won't be declared as
// a regular dynamic global by predeclaring it with the right variable kind.
DeclareDynamicGlobal(ast_value_factory->this_string(), Variable::THIS);
DeclareDynamicGlobal(ast_value_factory->this_string(), THIS_VARIABLE);
}
DeclarationScope::DeclarationScope(Zone* zone, Scope* outer_scope,
......@@ -235,7 +235,7 @@ Scope::Scope(Zone* zone, const AstRawString* catch_variable_name,
// scope_info, as the parser expects that a catch scope always has the catch
// variable as first and only variable.
Variable* variable = Declare(zone, this, catch_variable_name, VAR,
Variable::NORMAL, kCreatedInitialized);
NORMAL_VARIABLE, kCreatedInitialized);
AllocateHeapSlot(variable);
}
......@@ -420,9 +420,9 @@ void Scope::DeserializeScopeInfo(Isolate* isolate,
MaybeAssignedFlag maybe_assigned_flag =
scope_info_->ContextLocalMaybeAssignedFlag(var);
VariableLocation location = VariableLocation::CONTEXT;
Variable::Kind kind = Variable::NORMAL;
VariableKind kind = NORMAL_VARIABLE;
if (index == scope_info_->ReceiverContextSlotIndex()) {
kind = Variable::THIS;
kind = THIS_VARIABLE;
}
Variable* result = variables_.Declare(zone(), this, name, mode, kind,
......@@ -593,7 +593,7 @@ void DeclarationScope::DeclareThis(AstValueFactory* ast_value_factory) {
bool subclass_constructor = IsSubclassConstructor(function_kind_);
Variable* var = Declare(
zone(), this, ast_value_factory->this_string(),
subclass_constructor ? CONST : VAR, Variable::THIS,
subclass_constructor ? CONST : VAR, THIS_VARIABLE,
subclass_constructor ? kNeedsInitialization : kCreatedInitialized);
receiver_ = var;
}
......@@ -614,7 +614,7 @@ void DeclarationScope::DeclareArguments(AstValueFactory* ast_value_factory) {
// allocated during variable allocation.
if (arg_variable == nullptr) {
arguments_ = Declare(zone(), this, ast_value_factory->arguments_string(),
VAR, Variable::ARGUMENTS, kCreatedInitialized);
VAR, ARGUMENTS_VARIABLE, kCreatedInitialized);
} else {
arguments_ = arg_variable;
}
......@@ -626,22 +626,21 @@ void DeclarationScope::DeclareDefaultFunctionVariables(
DCHECK(!is_arrow_scope());
new_target_ = Declare(zone(), this, ast_value_factory->new_target_string(),
CONST, Variable::NORMAL, kCreatedInitialized);
CONST, NORMAL_VARIABLE, kCreatedInitialized);
if (IsConciseMethod(function_kind_) || IsClassConstructor(function_kind_) ||
IsAccessorFunction(function_kind_)) {
this_function_ =
Declare(zone(), this, ast_value_factory->this_function_string(), CONST,
Variable::NORMAL, kCreatedInitialized);
NORMAL_VARIABLE, kCreatedInitialized);
}
}
Variable* DeclarationScope::DeclareFunctionVar(const AstRawString* name) {
DCHECK(is_function_scope());
DCHECK_NULL(function_);
Variable::Kind kind = is_sloppy(language_mode())
? Variable::SLOPPY_FUNCTION_NAME
: Variable::NORMAL;
VariableKind kind = is_sloppy(language_mode()) ? SLOPPY_FUNCTION_NAME_VARIABLE
: NORMAL_VARIABLE;
function_ =
new (zone()) Variable(this, name, CONST, kind, kCreatedInitialized);
return function_;
......@@ -786,13 +785,13 @@ Variable* Scope::LookupInScopeInfo(const AstRawString* name) {
}
if (index < 0) return nullptr; // Nowhere found.
Variable::Kind kind = Variable::NORMAL;
VariableKind kind = NORMAL_VARIABLE;
if (location == VariableLocation::CONTEXT &&
index == scope_info_->ReceiverContextSlotIndex()) {
kind = Variable::THIS;
kind = THIS_VARIABLE;
}
// TODO(marja, rossberg): Correctly declare FUNCTION, CLASS, NEW_TARGET, and
// ARGUMENTS bindings as their corresponding Variable::Kind.
// ARGUMENTS bindings as their corresponding VariableKind.
Variable* var = variables_.Declare(zone(), this, name, mode, kind, init_flag,
maybe_assigned_flag);
......@@ -837,8 +836,8 @@ Variable* DeclarationScope::DeclareParameter(
if (mode == TEMPORARY) {
var = NewTemporary(name);
} else {
var = Declare(zone(), this, name, mode, Variable::NORMAL,
kCreatedInitialized);
var =
Declare(zone(), this, name, mode, NORMAL_VARIABLE, kCreatedInitialized);
// TODO(wingo): Avoid O(n^2) check.
*is_duplicate = IsDeclaredParameter(name);
}
......@@ -854,7 +853,7 @@ Variable* DeclarationScope::DeclareParameter(
}
Variable* Scope::DeclareLocal(const AstRawString* name, VariableMode mode,
InitializationFlag init_flag, Variable::Kind kind,
InitializationFlag init_flag, VariableKind kind,
MaybeAssignedFlag maybe_assigned_flag) {
DCHECK(!already_resolved_);
// This function handles VAR, LET, and CONST modes. DYNAMIC variables are
......@@ -893,7 +892,7 @@ Variable* Scope::DeclareVariable(
// with this new binding by doing the following:
// The proxy is bound to a lookup variable to force a dynamic declaration
// using the DeclareEvalVar or DeclareEvalFunction runtime functions.
Variable::Kind kind = Variable::NORMAL;
VariableKind kind = NORMAL_VARIABLE;
// TODO(sigurds) figure out if kNotAssigned is OK here
var = new (zone()) Variable(this, name, mode, kind, init, kNotAssigned);
var->AllocateTo(VariableLocation::LOOKUP, -1);
......@@ -902,9 +901,9 @@ Variable* Scope::DeclareVariable(
var = LookupLocal(name);
if (var == NULL) {
// Declare the name.
Variable::Kind kind = Variable::NORMAL;
VariableKind kind = NORMAL_VARIABLE;
if (is_function_declaration) {
kind = Variable::FUNCTION;
kind = FUNCTION_VARIABLE;
}
var = DeclareLocal(name, mode, init, kind, kNotAssigned);
} else if (IsLexicalVariableMode(mode) ||
......@@ -972,7 +971,7 @@ Variable* Scope::DeclareVariable(
VariableProxy* Scope::NewUnresolved(AstNodeFactory* factory,
const AstRawString* name,
int start_position, int end_position,
Variable::Kind kind) {
VariableKind kind) {
// Note that we must not share the unresolved variables with
// the same name because they may be removed selectively via
// RemoveUnresolved().
......@@ -993,7 +992,7 @@ void Scope::AddUnresolved(VariableProxy* proxy) {
}
Variable* DeclarationScope::DeclareDynamicGlobal(const AstRawString* name,
Variable::Kind kind) {
VariableKind kind) {
DCHECK(is_script_scope());
return variables_.Declare(zone(), this, name, DYNAMIC_GLOBAL, kind,
kCreatedInitialized);
......@@ -1022,11 +1021,8 @@ bool Scope::RemoveUnresolved(VariableProxy* var) {
Variable* Scope::NewTemporary(const AstRawString* name) {
DeclarationScope* scope = GetClosureScope();
Variable* var = new(zone()) Variable(scope,
name,
TEMPORARY,
Variable::NORMAL,
kCreatedInitialized);
Variable* var = new (zone())
Variable(scope, name, TEMPORARY, NORMAL_VARIABLE, kCreatedInitialized);
scope->AddLocal(var);
return var;
}
......@@ -1276,7 +1272,7 @@ static void PrintLocation(Variable* var) {
static void PrintVar(int indent, Variable* var) {
if (var->is_used() || !var->IsUnallocated()) {
Indent(indent, Variable::Mode2String(var->mode()));
Indent(indent, VariableMode2String(var->mode()));
PrintF(" ");
if (var->raw_name()->IsEmpty())
PrintF(".%p", reinterpret_cast<void*>(var));
......@@ -1423,7 +1419,7 @@ void Scope::CheckZones() {
Variable* Scope::NonLocal(const AstRawString* name, VariableMode mode) {
// Declare a new non-local.
DCHECK(IsDynamicVariableMode(mode));
Variable* var = variables_.Declare(zone(), NULL, name, mode, Variable::NORMAL,
Variable* var = variables_.Declare(zone(), NULL, name, mode, NORMAL_VARIABLE,
kCreatedInitialized);
// Allocate it by giving it a dynamic lookup.
var->AllocateTo(VariableLocation::LOOKUP, -1);
......@@ -1468,7 +1464,7 @@ Variable* Scope::LookupRecursive(VariableProxy* proxy, bool declare_free,
DCHECK(is_script_scope());
// No binding has been found. Declare a variable on the global object.
return AsDeclarationScope()->DeclareDynamicGlobal(proxy->raw_name(),
Variable::NORMAL);
NORMAL_VARIABLE);
}
DCHECK(!is_script_scope());
......
......@@ -5,9 +5,9 @@
#ifndef V8_AST_SCOPES_H_
#define V8_AST_SCOPES_H_
#include "src/ast/variables.h"
#include "src/base/hashmap.h"
#include "src/globals.h"
#include "src/objects.h"
#include "src/zone.h"
namespace v8 {
......@@ -19,6 +19,7 @@ class AstRawString;
class Declaration;
class ParseInfo;
class SloppyBlockFunctionStatement;
class StringSet;
class VariableProxy;
// A hash map to support fast variable declaration and lookup.
......@@ -27,7 +28,7 @@ class VariableMap: public ZoneHashMap {
explicit VariableMap(Zone* zone);
Variable* Declare(Zone* zone, Scope* scope, const AstRawString* name,
VariableMode mode, Variable::Kind kind,
VariableMode mode, VariableKind kind,
InitializationFlag initialization_flag,
MaybeAssignedFlag maybe_assigned_flag = kNotAssigned,
bool* added = nullptr);
......@@ -140,7 +141,7 @@ class Scope: public ZoneObject {
// Declare a local variable in this scope. If the variable has been
// declared before, the previously declared variable is returned.
Variable* DeclareLocal(const AstRawString* name, VariableMode mode,
InitializationFlag init_flag, Variable::Kind kind,
InitializationFlag init_flag, VariableKind kind,
MaybeAssignedFlag maybe_assigned_flag = kNotAssigned);
Variable* DeclareVariable(Declaration* declaration, VariableMode mode,
......@@ -159,7 +160,7 @@ class Scope: public ZoneObject {
const AstRawString* name,
int start_position = kNoSourcePosition,
int end_position = kNoSourcePosition,
Variable::Kind kind = Variable::NORMAL);
VariableKind kind = NORMAL_VARIABLE);
void AddUnresolved(VariableProxy* proxy);
......@@ -415,7 +416,7 @@ class Scope: public ZoneObject {
private:
Variable* Declare(Zone* zone, Scope* scope, const AstRawString* name,
VariableMode mode, Variable::Kind kind,
VariableMode mode, VariableKind kind,
InitializationFlag initialization_flag,
MaybeAssignedFlag maybe_assigned_flag = kNotAssigned) {
bool added;
......@@ -649,7 +650,7 @@ class DeclarationScope : public Scope {
// scope) by a reference to an unresolved variable with no intervening
// with statements or eval calls.
Variable* DeclareDynamicGlobal(const AstRawString* name,
Variable::Kind variable_kind);
VariableKind variable_kind);
// The variable corresponding to the 'this' value.
Variable* receiver() {
......
......@@ -13,22 +13,8 @@ namespace internal {
// ----------------------------------------------------------------------------
// Implementation Variable.
const char* Variable::Mode2String(VariableMode mode) {
switch (mode) {
case VAR: return "VAR";
case LET: return "LET";
case CONST: return "CONST";
case DYNAMIC: return "DYNAMIC";
case DYNAMIC_GLOBAL: return "DYNAMIC_GLOBAL";
case DYNAMIC_LOCAL: return "DYNAMIC_LOCAL";
case TEMPORARY: return "TEMPORARY";
}
UNREACHABLE();
return NULL;
}
Variable::Variable(Scope* scope, const AstRawString* name, VariableMode mode,
Kind kind, InitializationFlag initialization_flag,
VariableKind kind, InitializationFlag initialization_flag,
MaybeAssignedFlag maybe_assigned_flag)
: scope_(scope),
name_(name),
......@@ -40,7 +26,7 @@ Variable::Variable(Scope* scope, const AstRawString* name, VariableMode mode,
VariableModeField::encode(mode) | IsUsedField::encode(false) |
ForceContextAllocationField::encode(false) |
LocationField::encode(VariableLocation::UNALLOCATED) |
KindField::encode(kind)) {
VariableKindField::encode(kind)) {
// Var declared variables never need initialization.
DCHECK(!(mode == VAR && initialization_flag == kNeedsInitialization));
}
......
......@@ -6,6 +6,7 @@
#define V8_AST_VARIABLES_H_
#include "src/ast/ast-value-factory.h"
#include "src/globals.h"
#include "src/zone.h"
namespace v8 {
......@@ -17,22 +18,10 @@ namespace internal {
// after binding and variable allocation.
class Variable final : public ZoneObject {
public:
enum Kind : uint8_t {
NORMAL,
FUNCTION,
THIS,
ARGUMENTS,
SLOPPY_FUNCTION_NAME,
kLastKind = SLOPPY_FUNCTION_NAME
};
Variable(Scope* scope, const AstRawString* name, VariableMode mode, Kind kind,
InitializationFlag initialization_flag,
Variable(Scope* scope, const AstRawString* name, VariableMode mode,
VariableKind kind, InitializationFlag initialization_flag,
MaybeAssignedFlag maybe_assigned_flag = kNotAssigned);
// Printing support
static const char* Mode2String(VariableMode mode);
// The source code for an eval() call may refer to a variable that is
// in an outer scope about which we don't know anything (it may not
// be the script scope). scope() is NULL in that case. Currently the
......@@ -84,14 +73,14 @@ class Variable final : public ZoneObject {
return initialization_flag() == kNeedsInitialization;
}
bool throw_on_const_assignment(LanguageMode language_mode) const {
return kind() != SLOPPY_FUNCTION_NAME || is_strict(language_mode);
return kind() != SLOPPY_FUNCTION_NAME_VARIABLE || is_strict(language_mode);
}
bool is_function() const { return kind() == FUNCTION; }
bool is_this() const { return kind() == THIS; }
bool is_arguments() const { return kind() == ARGUMENTS; }
bool is_function() const { return kind() == FUNCTION_VARIABLE; }
bool is_this() const { return kind() == THIS_VARIABLE; }
bool is_arguments() const { return kind() == ARGUMENTS_VARIABLE; }
bool is_sloppy_function_name() const {
return kind() == SLOPPY_FUNCTION_NAME;
return kind() == SLOPPY_FUNCTION_NAME_VARIABLE;
}
Variable* local_if_not_shadowed() const {
......@@ -106,7 +95,7 @@ class Variable final : public ZoneObject {
VariableLocation location() const {
return LocationField::decode(bit_field_);
}
Kind kind() const { return KindField::decode(bit_field_); }
VariableKind kind() const { return VariableKindField::decode(bit_field_); }
InitializationFlag initialization_flag() const {
return InitializationFlagField::decode(bit_field_);
}
......@@ -140,9 +129,10 @@ class Variable final : public ZoneObject {
uint16_t bit_field_;
class VariableModeField : public BitField16<VariableMode, 0, 3> {};
class KindField : public BitField16<Kind, VariableModeField::kNext, 3> {};
class VariableKindField
: public BitField16<VariableKind, VariableModeField::kNext, 3> {};
class LocationField
: public BitField16<VariableLocation, KindField::kNext, 3> {};
: public BitField16<VariableLocation, VariableKindField::kNext, 3> {};
class ForceContextAllocationField
: public BitField16<bool, LocationField::kNext, 1> {};
class IsUsedField
......
......@@ -18,6 +18,7 @@
#include "src/compiler/loop-analysis.h"
#include "src/compiler/node-marker.h"
#include "src/compiler/node.h"
#include "src/objects-inl.h"
namespace v8 {
namespace internal {
......
......@@ -6,6 +6,7 @@
#include "src/ast/compile-time-value.h"
#include "src/ast/scopes.h"
#include "src/ast/variables.h"
#include "src/frames-inl.h"
#include "src/frames.h"
#include "src/ostreams.h"
......@@ -771,6 +772,14 @@ void AstTyper::VisitRewritableExpression(RewritableExpression* expr) {
Visit(expr->expression());
}
int AstTyper::variable_index(Variable* var) {
// Stack locals have the range [0 .. l]
// Parameters have the range [-1 .. p]
// We map this to [-p-2 .. -1, 0 .. l]
return var->IsStackLocal()
? stack_local_index(var->index())
: var->IsParameter() ? parameter_index(var->index()) : kNoVar;
}
void AstTyper::VisitDeclarations(ZoneList<Declaration*>* decls) {
for (int i = 0; i < decls->length(); ++i) {
......
......@@ -67,13 +67,7 @@ class AstTyper final : public AstVisitor<AstTyper> {
int parameter_index(int index) { return -index - 2; }
int stack_local_index(int index) { return index; }
int variable_index(Variable* var) {
// Stack locals have the range [0 .. l]
// Parameters have the range [-1 .. p]
// We map this to [-p-2 .. -1, 0 .. l]
return var->IsStackLocal() ? stack_local_index(var->index()) :
var->IsParameter() ? parameter_index(var->index()) : kNoVar;
}
int variable_index(Variable* var);
void VisitDeclarations(ZoneList<Declaration*>* declarations);
void VisitStatements(ZoneList<Statement*>* statements);
......
......@@ -915,6 +915,39 @@ enum VariableMode : uint8_t {
kLastVariableMode = DYNAMIC_LOCAL
};
// Printing support
#ifdef DEBUG
inline const char* VariableMode2String(VariableMode mode) {
switch (mode) {
case VAR:
return "VAR";
case LET:
return "LET";
case CONST:
return "CONST";
case DYNAMIC:
return "DYNAMIC";
case DYNAMIC_GLOBAL:
return "DYNAMIC_GLOBAL";
case DYNAMIC_LOCAL:
return "DYNAMIC_LOCAL";
case TEMPORARY:
return "TEMPORARY";
}
UNREACHABLE();
return NULL;
}
#endif
enum VariableKind : uint8_t {
NORMAL_VARIABLE,
FUNCTION_VARIABLE,
THIS_VARIABLE,
ARGUMENTS_VARIABLE,
SLOPPY_FUNCTION_NAME_VARIABLE,
kLastKind = SLOPPY_FUNCTION_NAME_VARIABLE
};
inline bool IsDynamicVariableMode(VariableMode mode) {
return mode >= DYNAMIC && mode <= DYNAMIC_LOCAL;
}
......
......@@ -1408,7 +1408,7 @@ Statement* Parser::ParseExportDeclaration(bool* ok) {
}
VariableProxy* Parser::NewUnresolved(const AstRawString* name, int begin_pos,
int end_pos, Variable::Kind kind) {
int end_pos, VariableKind kind) {
return scope()->NewUnresolved(factory(), name, begin_pos, end_pos, kind);
}
......@@ -2147,7 +2147,7 @@ TryStatement* Parser::ParseTryStatement(bool* ok) {
ValidateBindingPattern(CHECK_OK);
}
catch_variable = catch_scope->DeclareLocal(
name, VAR, kCreatedInitialized, Variable::NORMAL);
name, VAR, kCreatedInitialized, NORMAL_VARIABLE);
Expect(Token::RPAREN, CHECK_OK);
......@@ -3816,7 +3816,7 @@ Block* Parser::BuildRejectPromiseOnException(Block* inner_block, bool* ok) {
catch_scope->set_is_hidden();
Variable* catch_variable =
catch_scope->DeclareLocal(ast_value_factory()->dot_catch_string(), VAR,
kCreatedInitialized, Variable::NORMAL);
kCreatedInitialized, NORMAL_VARIABLE);
Block* catch_block = factory()->NewBlock(nullptr, 1, true, kNoSourcePosition);
Expression* promise_reject = BuildRejectPromise(
......@@ -5433,9 +5433,8 @@ Expression* Parser::RewriteYieldStar(Expression* generator,
Scope* catch_scope = NewScope(CATCH_SCOPE);
catch_scope->set_is_hidden();
const AstRawString* name = ast_value_factory()->dot_catch_string();
Variable* catch_variable =
catch_scope->DeclareLocal(name, VAR, kCreatedInitialized,
Variable::NORMAL);
Variable* catch_variable = catch_scope->DeclareLocal(
name, VAR, kCreatedInitialized, NORMAL_VARIABLE);
try_catch = factory()->NewTryCatchStatementForDesugaring(
try_block, catch_scope, catch_variable, catch_block, nopos);
......@@ -5722,7 +5721,7 @@ void Parser::FinalizeIteratorUse(Variable* completion, Expression* condition,
Scope* catch_scope = NewScopeWithParent(scope(), CATCH_SCOPE);
Variable* catch_variable =
catch_scope->DeclareLocal(ast_value_factory()->dot_catch_string(), VAR,
kCreatedInitialized, Variable::NORMAL);
kCreatedInitialized, NORMAL_VARIABLE);
catch_scope->set_is_hidden();
Statement* rethrow;
......@@ -5828,7 +5827,7 @@ void Parser::BuildIteratorCloseForCompletion(ZoneList<Statement*>* statements,
Scope* catch_scope = NewScope(CATCH_SCOPE);
Variable* catch_variable =
catch_scope->DeclareLocal(ast_value_factory()->dot_catch_string(), VAR,
kCreatedInitialized, Variable::NORMAL);
kCreatedInitialized, NORMAL_VARIABLE);
catch_scope->set_is_hidden();
try_call_return = factory()->NewTryCatchStatement(
......
......@@ -454,7 +454,7 @@ class Parser : public ParserBase<Parser> {
VariableProxy* NewUnresolved(const AstRawString* name, int begin_pos,
int end_pos = kNoSourcePosition,
Variable::Kind kind = Variable::NORMAL);
VariableKind kind = NORMAL_VARIABLE);
VariableProxy* NewUnresolved(const AstRawString* name);
Variable* Declare(Declaration* declaration,
DeclarationDescriptor::Kind declaration_kind,
......@@ -896,7 +896,7 @@ class Parser : public ParserBase<Parser> {
V8_INLINE Expression* ThisExpression(int pos = kNoSourcePosition) {
return NewUnresolved(ast_value_factory()->this_string(), pos, pos + 4,
Variable::THIS);
THIS_VARIABLE);
}
Expression* NewSuperPropertyReference(int pos);
......
......@@ -278,10 +278,10 @@ class AsmTyperHarnessBuilder {
auto* name_ast_string = ast_value_factory_.GetOneByteString(var_name.name_);
return var_name.mode_ == DYNAMIC_GLOBAL
? outer_scope_->DeclareDynamicGlobal(name_ast_string,
Variable::NORMAL)
NORMAL_VARIABLE)
: module_->scope()->DeclareLocal(name_ast_string, VAR,
kCreatedInitialized,
Variable::NORMAL);
NORMAL_VARIABLE);
}
bool ValidateAllStatements(FunctionDeclaration* fun_decl) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment