Index: src/variables.h |
diff --git a/src/variables.h b/src/variables.h |
index 218eefae08e08a0cd937a14e1d158c5b878d1a0c..deebc5f80c83b5a63afd37bc63d2b896e1890c8c 100644 |
--- a/src/variables.h |
+++ b/src/variables.h |
@@ -22,33 +22,6 @@ class Variable: public ZoneObject { |
public: |
enum Kind { NORMAL, FUNCTION, CLASS, THIS, ARGUMENTS }; |
- enum Location { |
- // Before and during variable allocation, a variable whose location is |
- // not yet determined. After allocation, a variable looked up as a |
- // property on the global object (and possibly absent). name() is the |
- // variable name, index() is invalid. |
- UNALLOCATED, |
- |
- // A slot in the parameter section on the stack. index() is the |
- // parameter index, counting left-to-right. The receiver is index -1; |
- // the first parameter is index 0. |
- PARAMETER, |
- |
- // A slot in the local section on the stack. index() is the variable |
- // index in the stack frame, starting at 0. |
- LOCAL, |
- |
- // An indexed slot in a heap context. index() is the variable index in |
- // the context object on the heap, starting at 0. scope() is the |
- // corresponding scope. |
- CONTEXT, |
- |
- // A named slot in a heap context. name() is the variable name in the |
- // context object on the heap, with lookup starting at the current |
- // context. index() is invalid. |
- LOOKUP |
- }; |
- |
Variable(Scope* scope, const AstRawString* name, VariableMode mode, Kind kind, |
InitializationFlag initialization_flag, |
MaybeAssignedFlag maybe_assigned_flag = kNotAssigned); |
@@ -86,13 +59,20 @@ class Variable: public ZoneObject { |
return !is_this() && name().is_identical_to(n); |
} |
- bool IsUnallocated() const { return location_ == UNALLOCATED; } |
- bool IsParameter() const { return location_ == PARAMETER; } |
- bool IsStackLocal() const { return location_ == LOCAL; } |
+ bool IsUnallocated() const { |
+ return location_ == VariableLocation::UNALLOCATED; |
+ } |
+ bool IsParameter() const { return location_ == VariableLocation::PARAMETER; } |
+ bool IsStackLocal() const { return location_ == VariableLocation::LOCAL; } |
bool IsStackAllocated() const { return IsParameter() || IsStackLocal(); } |
- bool IsContextSlot() const { return location_ == CONTEXT; } |
- bool IsLookupSlot() const { return location_ == LOOKUP; } |
+ bool IsContextSlot() const { return location_ == VariableLocation::CONTEXT; } |
+ bool IsGlobalSlot() const { return location_ == VariableLocation::GLOBAL; } |
+ bool IsUnallocatedOrGlobalSlot() const { |
+ return IsUnallocated() || IsGlobalSlot(); |
+ } |
+ bool IsLookupSlot() const { return location_ == VariableLocation::LOOKUP; } |
bool IsGlobalObjectProperty() const; |
+ bool IsStaticGlobalObjectProperty() const; |
bool is_dynamic() const { return IsDynamicVariableMode(mode_); } |
bool is_const_mode() const { return IsImmutableVariableMode(mode_); } |
@@ -134,13 +114,13 @@ class Variable: public ZoneObject { |
local_if_not_shadowed_ = local; |
} |
- Location location() const { return location_; } |
+ VariableLocation location() const { return location_; } |
int index() const { return index_; } |
InitializationFlag initialization_flag() const { |
return initialization_flag_; |
} |
- void AllocateTo(Location location, int index) { |
+ void AllocateTo(VariableLocation location, int index) { |
location_ = location; |
index_ = index; |
} |
@@ -171,7 +151,7 @@ class Variable: public ZoneObject { |
const AstRawString* name_; |
VariableMode mode_; |
Kind kind_; |
- Location location_; |
+ VariableLocation location_; |
int index_; |
int initializer_position_; |
// Tracks whether the variable is bound to a VariableProxy which is in strong |