| Index: src/scopes.h
|
| ===================================================================
|
| --- src/scopes.h (revision 1937)
|
| +++ src/scopes.h (working copy)
|
| @@ -35,7 +35,6 @@
|
|
|
|
|
| // A hash map to support fast local variable declaration and lookup.
|
| -
|
| class LocalsMap: public HashMap {
|
| public:
|
| LocalsMap();
|
| @@ -53,6 +52,23 @@
|
| };
|
|
|
|
|
| +// The dynamic scope part holds hash maps for the variables that will
|
| +// be looked up dynamically from within eval and with scopes. The objects
|
| +// are allocated on-demand from Scope::NonLocal to avoid wasting memory
|
| +// and setup time for scopes that don't need them.
|
| +class DynamicScopePart : public ZoneObject {
|
| + public:
|
| + LocalsMap* GetMap(Variable::Mode mode) {
|
| + int index = mode - Variable::DYNAMIC;
|
| + ASSERT(index >= 0 && index < 3);
|
| + return &maps_[index];
|
| + }
|
| +
|
| + private:
|
| + LocalsMap maps_[3];
|
| +};
|
| +
|
| +
|
| // Global invariants after AST construction: Each reference (i.e. identifier)
|
| // to a JavaScript variable (including global properties) is represented by a
|
| // VariableProxy node. Immediately after AST construction and before variable
|
| @@ -278,9 +294,7 @@
|
| // parameter list in source order
|
| ZoneList<Variable*> params_;
|
| // variables that must be looked up dynamically
|
| - LocalsMap dynamics_;
|
| - LocalsMap dynamics_local_;
|
| - LocalsMap dynamics_global_;
|
| + DynamicScopePart* dynamics_;
|
| // unresolved variables referred to from this scope
|
| ZoneList<VariableProxy*> unresolved_;
|
| // declarations
|
|
|