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

Unified Diff: src/scopes.h

Issue 314603004: Parser: Delay internalizing strings and values. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: rebased Created 6 years, 6 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 | « src/scopeinfo.cc ('k') | src/scopes.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/scopes.h
diff --git a/src/scopes.h b/src/scopes.h
index 4486921d6a2b0f79097f112b07fe755454306c56..a5c7cdc798f788bccbacd6ee57451f346571d300 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,
+ AstValueFactory* value_factory, 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);
+ AstValueFactory* value_factory, 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,
+ AstValueFactory* value_factory, 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);
+ AstValueFactory* ast_value_factory_;
Zone* zone_;
};
« no previous file with comments | « src/scopeinfo.cc ('k') | src/scopes.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698