OLD | NEW |
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 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 // function expressions, only), otherwise returns a value < 0. The name | 149 // function expressions, only), otherwise returns a value < 0. The name |
150 // must be a symbol (canonicalized). | 150 // must be a symbol (canonicalized). |
151 int FunctionContextSlotIndex(String* name); | 151 int FunctionContextSlotIndex(String* name); |
152 | 152 |
153 static Handle<SerializedScopeInfo> Create(Scope* scope); | 153 static Handle<SerializedScopeInfo> Create(Scope* scope); |
154 | 154 |
155 // Serializes empty scope info. | 155 // Serializes empty scope info. |
156 static SerializedScopeInfo* Empty(); | 156 static SerializedScopeInfo* Empty(); |
157 | 157 |
158 private: | 158 private: |
159 | |
160 inline Object** ContextEntriesAddr(); | 159 inline Object** ContextEntriesAddr(); |
161 | 160 |
162 inline Object** ParameterEntriesAddr(); | 161 inline Object** ParameterEntriesAddr(); |
163 | 162 |
164 inline Object** StackSlotEntriesAddr(); | 163 inline Object** StackSlotEntriesAddr(); |
165 }; | 164 }; |
166 | 165 |
167 | 166 |
168 // Cache for mapping (data, property name) into context slot index. | 167 // Cache for mapping (data, property name) into context slot index. |
169 // The cache contains both positive and negative results. | 168 // The cache contains both positive and negative results. |
(...skipping 10 matching lines...) Expand all Loading... |
180 // Update an element in the cache. | 179 // Update an element in the cache. |
181 void Update(Object* data, | 180 void Update(Object* data, |
182 String* name, | 181 String* name, |
183 Variable::Mode mode, | 182 Variable::Mode mode, |
184 int slot_index); | 183 int slot_index); |
185 | 184 |
186 // Clear the cache. | 185 // Clear the cache. |
187 void Clear(); | 186 void Clear(); |
188 | 187 |
189 static const int kNotFound = -2; | 188 static const int kNotFound = -2; |
| 189 |
190 private: | 190 private: |
191 ContextSlotCache() { | 191 ContextSlotCache() { |
192 for (int i = 0; i < kLength; ++i) { | 192 for (int i = 0; i < kLength; ++i) { |
193 keys_[i].data = NULL; | 193 keys_[i].data = NULL; |
194 keys_[i].name = NULL; | 194 keys_[i].name = NULL; |
195 values_[i] = kNotFound; | 195 values_[i] = kNotFound; |
196 } | 196 } |
197 } | 197 } |
198 | 198 |
199 inline static int Hash(Object* data, String* name); | 199 inline static int Hash(Object* data, String* name); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 uint32_t values_[kLength]; | 240 uint32_t values_[kLength]; |
241 | 241 |
242 friend class Isolate; | 242 friend class Isolate; |
243 DISALLOW_COPY_AND_ASSIGN(ContextSlotCache); | 243 DISALLOW_COPY_AND_ASSIGN(ContextSlotCache); |
244 }; | 244 }; |
245 | 245 |
246 | 246 |
247 } } // namespace v8::internal | 247 } } // namespace v8::internal |
248 | 248 |
249 #endif // V8_SCOPEINFO_H_ | 249 #endif // V8_SCOPEINFO_H_ |
OLD | NEW |