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

Unified Diff: src/variables.h

Issue 20419: Optimize loads from variables that might be shadowed by variables... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 years, 10 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/scopes.cc ('k') | src/variables.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/variables.h
===================================================================
--- src/variables.h (revision 1289)
+++ src/variables.h (working copy)
@@ -113,13 +113,27 @@
enum Mode {
// User declared variables:
VAR, // declared via 'var', and 'function' declarations
+
CONST, // declared via 'const' declarations
// Variables introduced by the compiler:
- DYNAMIC, // always require dynamic lookup (we don't know the declaration)
- INTERNAL, // like VAR, but not user-visible (may or may not be in a
- // context)
- TEMPORARY // temporary variables (not user-visible), never in a context
+ DYNAMIC, // always require dynamic lookup (we don't know
+ // the declaration)
+
+ DYNAMIC_GLOBAL, // requires dynamic lookup, but we know that the
+ // variable is global unless it has been shadowed
+ // by an eval-introduced variable
+
+ DYNAMIC_LOCAL, // requires dynamic lookup, but we know that the
+ // variable is local and where it is unless it
+ // has been shadowed by an eval-introduced
+ // variable
+
+ INTERNAL, // like VAR, but not user-visible (may or may not
+ // be in a context)
+
+ TEMPORARY // temporary variables (not user-visible), never
+ // in a context
};
// Printing support
@@ -150,9 +164,24 @@
return !is_this() && name().is_identical_to(n);
}
+ bool is_dynamic() const {
+ return (mode_ == DYNAMIC ||
+ mode_ == DYNAMIC_GLOBAL ||
+ mode_ == DYNAMIC_LOCAL);
+ }
+
bool is_global() const;
bool is_this() const { return is_this_; }
+ Variable* local_if_not_shadowed() const {
+ ASSERT(mode_ == DYNAMIC_LOCAL && local_if_not_shadowed_ != NULL);
+ return local_if_not_shadowed_;
+ }
+
+ void set_local_if_not_shadowed(Variable* local) {
+ local_if_not_shadowed_ = local;
+ }
+
Expression* rewrite() const { return rewrite_; }
Slot* slot() const;
@@ -168,6 +197,8 @@
bool is_valid_LHS_;
bool is_this_;
+ Variable* local_if_not_shadowed_;
+
// Usage info.
bool is_accessed_from_inner_scope_; // set by variable resolver
UseCount var_uses_; // uses of the variable value
« no previous file with comments | « src/scopes.cc ('k') | src/variables.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698