From 696f02455792b368249bf9b013dde637b5ec31fd Mon Sep 17 00:00:00 2001 From: Ryan Date: Mon, 8 Jun 2009 18:34:06 +0200 Subject: Upgrade to v8 1.2.7 --- deps/v8/src/scopes.h | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) (limited to 'deps/v8/src/scopes.h') diff --git a/deps/v8/src/scopes.h b/deps/v8/src/scopes.h index e78bd2a2c1..b2f61ef660 100644 --- a/deps/v8/src/scopes.h +++ b/deps/v8/src/scopes.h @@ -31,11 +31,11 @@ #include "ast.h" #include "hashmap.h" -namespace v8 { namespace internal { +namespace v8 { +namespace internal { // A hash map to support fast local variable declaration and lookup. - class LocalsMap: public HashMap { public: LocalsMap(); @@ -53,6 +53,23 @@ class LocalsMap: public HashMap { }; +// 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,7 +295,7 @@ class Scope: public ZoneObject { // parameter list in source order ZoneList params_; // variables that must be looked up dynamically - ZoneList nonlocals_; + DynamicScopePart* dynamics_; // unresolved variables referred to from this scope ZoneList unresolved_; // declarations -- cgit v1.2.1