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

Side by Side Diff: src/variables.h

Issue 7778013: NewGC: Merge bleeding edge up to 9009. (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/gc/
Patch Set: Created 9 years, 3 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/v8threads.cc ('k') | src/variables.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 28 matching lines...) Expand all
39 // after binding and variable allocation. 39 // after binding and variable allocation.
40 40
41 class Variable: public ZoneObject { 41 class Variable: public ZoneObject {
42 public: 42 public:
43 enum Mode { 43 enum Mode {
44 // User declared variables: 44 // User declared variables:
45 VAR, // declared via 'var', and 'function' declarations 45 VAR, // declared via 'var', and 'function' declarations
46 46
47 CONST, // declared via 'const' declarations 47 CONST, // declared via 'const' declarations
48 48
49 LET, // declared via 'let' declarations
50
49 // Variables introduced by the compiler: 51 // Variables introduced by the compiler:
50 DYNAMIC, // always require dynamic lookup (we don't know 52 DYNAMIC, // always require dynamic lookup (we don't know
51 // the declaration) 53 // the declaration)
52 54
53 DYNAMIC_GLOBAL, // requires dynamic lookup, but we know that the 55 DYNAMIC_GLOBAL, // requires dynamic lookup, but we know that the
54 // variable is global unless it has been shadowed 56 // variable is global unless it has been shadowed
55 // by an eval-introduced variable 57 // by an eval-introduced variable
56 58
57 DYNAMIC_LOCAL, // requires dynamic lookup, but we know that the 59 DYNAMIC_LOCAL, // requires dynamic lookup, but we know that the
58 // variable is local and where it is unless it 60 // variable is local and where it is unless it
(...skipping 29 matching lines...) Expand all
88 bool IsValidLeftHandSide() { return is_valid_LHS_; } 90 bool IsValidLeftHandSide() { return is_valid_LHS_; }
89 91
90 // The source code for an eval() call may refer to a variable that is 92 // The source code for an eval() call may refer to a variable that is
91 // in an outer scope about which we don't know anything (it may not 93 // in an outer scope about which we don't know anything (it may not
92 // be the global scope). scope() is NULL in that case. Currently the 94 // be the global scope). scope() is NULL in that case. Currently the
93 // scope is only used to follow the context chain length. 95 // scope is only used to follow the context chain length.
94 Scope* scope() const { return scope_; } 96 Scope* scope() const { return scope_; }
95 97
96 Handle<String> name() const { return name_; } 98 Handle<String> name() const { return name_; }
97 Mode mode() const { return mode_; } 99 Mode mode() const { return mode_; }
98 bool is_accessed_from_inner_scope() const { 100 bool is_accessed_from_inner_function_scope() const {
99 return is_accessed_from_inner_scope_; 101 return is_accessed_from_inner_function_scope_;
100 } 102 }
101 void MarkAsAccessedFromInnerScope() { 103 void MarkAsAccessedFromInnerFunctionScope() {
102 is_accessed_from_inner_scope_ = true; 104 ASSERT(mode_ != TEMPORARY);
105 is_accessed_from_inner_function_scope_ = true;
103 } 106 }
104 bool is_used() { return is_used_; } 107 bool is_used() { return is_used_; }
105 void set_is_used(bool flag) { is_used_ = flag; } 108 void set_is_used(bool flag) { is_used_ = flag; }
106 109
107 bool IsVariable(Handle<String> n) const { 110 bool IsVariable(Handle<String> n) const {
108 return !is_this() && name().is_identical_to(n); 111 return !is_this() && name().is_identical_to(n);
109 } 112 }
110 113
111 bool IsStackAllocated() const; 114 bool IsStackAllocated() const;
112 bool IsParameter() const; // Includes 'this'. 115 bool IsParameter() const; // Includes 'this'.
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 152
150 Variable* local_if_not_shadowed_; 153 Variable* local_if_not_shadowed_;
151 154
152 // Code generation. 155 // Code generation.
153 Slot* rewrite_; 156 Slot* rewrite_;
154 157
155 // Valid as a LHS? (const and this are not valid LHS, for example) 158 // Valid as a LHS? (const and this are not valid LHS, for example)
156 bool is_valid_LHS_; 159 bool is_valid_LHS_;
157 160
158 // Usage info. 161 // Usage info.
159 bool is_accessed_from_inner_scope_; // set by variable resolver 162 bool is_accessed_from_inner_function_scope_; // set by variable resolver
160 bool is_used_; 163 bool is_used_;
161 }; 164 };
162 165
163 166
164 } } // namespace v8::internal 167 } } // namespace v8::internal
165 168
166 #endif // V8_VARIABLES_H_ 169 #endif // V8_VARIABLES_H_
OLDNEW
« no previous file with comments | « src/v8threads.cc ('k') | src/variables.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698