OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
297 // the result is the JSObject extension context or the global object, | 297 // the result is the JSObject extension context or the global object, |
298 // and the name is the property name, and the property exists. | 298 // and the name is the property name, and the property exists. |
299 // attributes != ABSENT. | 299 // attributes != ABSENT. |
300 // | 300 // |
301 // 4) index_ < 0 && result.is_null(): | 301 // 4) index_ < 0 && result.is_null(): |
302 // there was no context found with the corresponding property. | 302 // there was no context found with the corresponding property. |
303 // attributes == ABSENT. | 303 // attributes == ABSENT. |
304 Handle<Object> Lookup(Handle<String> name, ContextLookupFlags flags, | 304 Handle<Object> Lookup(Handle<String> name, ContextLookupFlags flags, |
305 int* index_, PropertyAttributes* attributes); | 305 int* index_, PropertyAttributes* attributes); |
306 | 306 |
| 307 // Determine if a local variable with the given name exists in a |
| 308 // context. Do not consider context extension objects. This is |
| 309 // used for compiling code using eval. If the context surrounding |
| 310 // the eval call does not have a local variable with this name and |
| 311 // does not contain a with statement the property is global unless |
| 312 // it is shadowed by a property in an extension object introduced by |
| 313 // eval. |
| 314 bool GlobalIfNotShadowedByEval(Handle<String> name); |
| 315 |
307 // Code generation support. | 316 // Code generation support. |
308 static int SlotOffset(int index) { | 317 static int SlotOffset(int index) { |
309 return kHeaderSize + index * kPointerSize - kHeapObjectTag; | 318 return kHeaderSize + index * kPointerSize - kHeapObjectTag; |
310 } | 319 } |
311 | 320 |
312 private: | 321 private: |
313 // Unchecked access to the slots. | 322 // Unchecked access to the slots. |
314 Object* unchecked_previous() { return get(PREVIOUS_INDEX); } | 323 Object* unchecked_previous() { return get(PREVIOUS_INDEX); } |
315 Object* unchecked_extension() { return get(EXTENSION_INDEX); } | 324 Object* unchecked_extension() { return get(EXTENSION_INDEX); } |
316 | 325 |
317 #ifdef DEBUG | 326 #ifdef DEBUG |
318 // Bootstrapping-aware type checks. | 327 // Bootstrapping-aware type checks. |
319 static bool IsBootstrappingOrContext(Object* object); | 328 static bool IsBootstrappingOrContext(Object* object); |
320 static bool IsBootstrappingOrGlobalObject(Object* object); | 329 static bool IsBootstrappingOrGlobalObject(Object* object); |
321 #endif | 330 #endif |
322 }; | 331 }; |
323 | 332 |
324 } } // namespace v8::internal | 333 } } // namespace v8::internal |
325 | 334 |
326 #endif // V8_CONTEXTS_H_ | 335 #endif // V8_CONTEXTS_H_ |
OLD | NEW |