Index: src/scopes.h |
diff --git a/src/scopes.h b/src/scopes.h |
index f6f543107f739b1575711a72cc2bd887649ce70c..7be166a12278429463021097f6fa9ab1b03537e9 100644 |
--- a/src/scopes.h |
+++ b/src/scopes.h |
@@ -22,14 +22,14 @@ class VariableMap: public ZoneHashMap { |
virtual ~VariableMap(); |
Variable* Declare(Scope* scope, |
- Handle<String> name, |
+ const AstString* name, |
VariableMode mode, |
bool is_valid_lhs, |
Variable::Kind kind, |
InitializationFlag initialization_flag, |
Interface* interface = Interface::NewValue()); |
- Variable* Lookup(Handle<String> name); |
+ Variable* Lookup(const AstString* name); |
Zone* zone() const { return zone_; } |
@@ -74,7 +74,8 @@ class Scope: public ZoneObject { |
// --------------------------------------------------------------------------- |
// Construction |
- Scope(Scope* outer_scope, ScopeType scope_type, Zone* zone); |
+ Scope(Scope* outer_scope, ScopeType scope_type, |
+ AstStringTable* string_table, Zone* zone); |
// Compute top scope and allocate variables. For lazy compilation the top |
// scope only contains the single lazily compiled function, so this |
@@ -85,7 +86,7 @@ class Scope: public ZoneObject { |
Zone* zone); |
// The scope name is only used for printing/debugging. |
- void SetScopeName(Handle<String> scope_name) { scope_name_ = scope_name; } |
+ void SetScopeName(const AstString* scope_name) { scope_name_ = scope_name; } |
void Initialize(); |
@@ -100,18 +101,18 @@ class Scope: public ZoneObject { |
// Declarations |
// Lookup a variable in this scope. Returns the variable or NULL if not found. |
- Variable* LookupLocal(Handle<String> name); |
+ Variable* LookupLocal(const AstString* name); |
// This lookup corresponds to a lookup in the "intermediate" scope sitting |
// between this scope and the outer scope. (ECMA-262, 3rd., requires that |
// the name of named function literal is kept in an intermediate scope |
// in between this scope and the next outer scope.) |
- Variable* LookupFunctionVar(Handle<String> name, |
+ Variable* LookupFunctionVar(const AstString* name, |
AstNodeFactory<AstNullVisitor>* factory); |
// Lookup a variable in this scope or outer scopes. |
// Returns the variable or NULL if not found. |
- Variable* Lookup(Handle<String> name); |
+ Variable* Lookup(const AstString* name); |
// Declare the function variable for a function literal. This variable |
// is in an intermediate scope between this function scope and the the |
@@ -124,11 +125,11 @@ class Scope: public ZoneObject { |
// Declare a parameter in this scope. When there are duplicated |
// parameters the rightmost one 'wins'. However, the implementation |
// expects all parameters to be declared and from left to right. |
- void DeclareParameter(Handle<String> name, VariableMode mode); |
+ void DeclareParameter(const AstString* name, VariableMode mode); |
// Declare a local variable in this scope. If the variable has been |
// declared before, the previously declared variable is returned. |
- Variable* DeclareLocal(Handle<String> name, |
+ Variable* DeclareLocal(const AstString* name, |
VariableMode mode, |
InitializationFlag init_flag, |
Interface* interface = Interface::NewValue()); |
@@ -137,12 +138,12 @@ class Scope: public ZoneObject { |
// global scope. The variable was introduced (possibly from an inner |
// scope) by a reference to an unresolved variable with no intervening |
// with statements or eval calls. |
- Variable* DeclareDynamicGlobal(Handle<String> name); |
+ Variable* DeclareDynamicGlobal(const AstString* name); |
// Create a new unresolved variable. |
template<class Visitor> |
VariableProxy* NewUnresolved(AstNodeFactory<Visitor>* factory, |
- Handle<String> name, |
+ const AstString* name, |
Interface* interface = Interface::NewValue(), |
int position = RelocInfo::kNoPosition) { |
// Note that we must not share the unresolved variables with |
@@ -167,13 +168,13 @@ class Scope: public ZoneObject { |
// for printing and cannot be used to find the variable. In particular, |
// the only way to get hold of the temporary is by keeping the Variable* |
// around. |
- Variable* NewInternal(Handle<String> name); |
+ Variable* NewInternal(const AstString* name); |
// Creates a new temporary variable in this scope. The name is only used |
// for printing and cannot be used to find the variable. In particular, |
// the only way to get hold of the temporary is by keeping the Variable* |
// around. The name should not clash with a legitimate variable names. |
- Variable* NewTemporary(Handle<String> name); |
+ Variable* NewTemporary(const AstString* name); |
// Adds the specific declaration node to the list of declarations in |
// this scope. The declarations are processed as part of entering |
@@ -390,7 +391,7 @@ class Scope: public ZoneObject { |
// --------------------------------------------------------------------------- |
// Strict mode support. |
- bool IsDeclared(Handle<String> name) { |
+ bool IsDeclared(const AstString* name) { |
// During formal parameter list parsing the scope only contains |
// two variables inserted at initialization: "this" and "arguments". |
// "this" is an invalid parameter name and "arguments" is invalid parameter |
@@ -421,7 +422,7 @@ class Scope: public ZoneObject { |
ScopeType scope_type_; |
// Debugging support. |
- Handle<String> scope_name_; |
+ const AstString* scope_name_; |
// The variables declared in this scope: |
// |
@@ -497,7 +498,7 @@ class Scope: public ZoneObject { |
// Create a non-local variable with a given name. |
// These variables are looked up dynamically at runtime. |
- Variable* NonLocal(Handle<String> name, VariableMode mode); |
+ Variable* NonLocal(const AstString* name, VariableMode mode); |
// Variable resolution. |
// Possible results of a recursive variable lookup telling if and how a |
@@ -548,7 +549,7 @@ class Scope: public ZoneObject { |
// Lookup a variable reference given by name recursively starting with this |
// scope. If the code is executed because of a call to 'eval', the context |
// parameter should be set to the calling context of 'eval'. |
- Variable* LookupRecursive(Handle<String> name, |
+ Variable* LookupRecursive(const AstString* name, |
BindingKind* binding_kind, |
AstNodeFactory<AstNullVisitor>* factory); |
MUST_USE_RESULT |
@@ -592,10 +593,12 @@ class Scope: public ZoneObject { |
private: |
// Construct a scope based on the scope info. |
Scope(Scope* inner_scope, ScopeType type, Handle<ScopeInfo> scope_info, |
- Zone* zone); |
+ AstStringTable* string_table, Zone* zone); |
// Construct a catch scope with a binding for the name. |
- Scope(Scope* inner_scope, Handle<String> catch_variable_name, Zone* zone); |
+ Scope(Scope* inner_scope, |
+ const AstString* catch_variable_name, |
+ AstStringTable* string_table, Zone* zone); |
void AddInnerScope(Scope* inner_scope) { |
if (inner_scope != NULL) { |
@@ -608,6 +611,7 @@ class Scope: public ZoneObject { |
Scope* outer_scope, |
Handle<ScopeInfo> scope_info); |
+ AstStringTable* string_table_; |
Zone* zone_; |
}; |