summaryrefslogtreecommitdiff
path: root/deps/v8/src/scopes.h
diff options
context:
space:
mode:
authorRyan <ry@tinyclouds.org>2009-06-08 18:34:06 +0200
committerRyan <ry@tinyclouds.org>2009-06-08 18:34:06 +0200
commit696f02455792b368249bf9b013dde637b5ec31fd (patch)
tree95b2dbd6c2537df9df52f6627aac36fcf05f6a7a /deps/v8/src/scopes.h
parentf6a7fe26574defaa807a13248102ebe0f23270af (diff)
downloadnode-new-696f02455792b368249bf9b013dde637b5ec31fd.tar.gz
Upgrade to v8 1.2.7
Diffstat (limited to 'deps/v8/src/scopes.h')
-rw-r--r--deps/v8/src/scopes.h23
1 files changed, 20 insertions, 3 deletions
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<Variable*> params_;
// variables that must be looked up dynamically
- ZoneList<Variable*> nonlocals_;
+ DynamicScopePart* dynamics_;
// unresolved variables referred to from this scope
ZoneList<VariableProxy*> unresolved_;
// declarations