OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_CONTEXTS_H_ | 5 #ifndef V8_CONTEXTS_H_ |
6 #define V8_CONTEXTS_H_ | 6 #define V8_CONTEXTS_H_ |
7 | 7 |
8 #include "src/heap/heap.h" | 8 #include "src/heap/heap.h" |
9 #include "src/objects.h" | 9 #include "src/objects.h" |
10 | 10 |
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
291 // contexts inside a function. It provides access to the | 291 // contexts inside a function. It provides access to the |
292 // incoming context (i.e., the outer context, which may | 292 // incoming context (i.e., the outer context, which may |
293 // or may not become the current function's context), and | 293 // or may not become the current function's context), and |
294 // it provides access to the functions code and thus it's | 294 // it provides access to the functions code and thus it's |
295 // scope information, which in turn contains the names of | 295 // scope information, which in turn contains the names of |
296 // statically allocated context slots. The names are needed | 296 // statically allocated context slots. The names are needed |
297 // for dynamic lookups in the presence of 'with' or 'eval'. | 297 // for dynamic lookups in the presence of 'with' or 'eval'. |
298 // | 298 // |
299 // [ previous ] A pointer to the previous context. | 299 // [ previous ] A pointer to the previous context. |
300 // | 300 // |
301 // [ extension ] A pointer to an extension JSObject, or "the hole". Used to | 301 // [ extension ] A pointer to a ContextExtension object, or "the hole". Used |
302 // implement 'with' statements and dynamic declarations | 302 // to implement 'with' statements and dynamic declarations |
303 // (through 'eval'). The object in a 'with' statement is | 303 // (through 'eval'). The object in a 'with' statement is |
304 // stored in the extension slot of a 'with' context. | 304 // stored in the extension slot of a 'with' context. |
305 // Dynamically declared variables/functions are also added | 305 // Dynamically declared variables/functions are also added |
306 // to lazily allocated extension object. Context::Lookup | 306 // to lazily allocated extension object. Context::Lookup |
307 // searches the extension object for properties. | 307 // searches the extension object for properties. |
308 // For script and block contexts, contains the respective | 308 // For script and block contexts, contains the respective |
309 // ScopeInfo. For block contexts representing sloppy declaration | 309 // ScopeInfo. For block contexts representing sloppy declaration |
310 // block scopes, it may also be a struct being a | 310 // block scopes, it may also be a struct being a |
311 // SloppyBlockWithEvalContextExtension, pairing the ScopeInfo | 311 // ContextExtension, pairing the ScopeInfo with an extension |
312 // with an extension object. | 312 // object. |
313 // | 313 // |
314 // [ native_context ] A pointer to the native context. | 314 // [ native_context ] A pointer to the native context. |
315 // | 315 // |
316 // In addition, function contexts may have statically allocated context slots | 316 // In addition, function contexts may have statically allocated context slots |
317 // to store local variables/functions that are accessed from inner functions | 317 // to store local variables/functions that are accessed from inner functions |
318 // (via static context addresses) or through 'eval' (dynamic context lookups). | 318 // (via static context addresses) or through 'eval' (dynamic context lookups). |
319 // The native context contains additional slots for fast access to native | 319 // The native context contains additional slots for fast access to native |
320 // properties. | 320 // properties. |
321 // | 321 // |
322 // Finally, with Harmony scoping, the JSFunction representing a top level | 322 // Finally, with Harmony scoping, the JSFunction representing a top level |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
527 #endif | 527 #endif |
528 | 528 |
529 STATIC_ASSERT(kHeaderSize == Internals::kContextHeaderSize); | 529 STATIC_ASSERT(kHeaderSize == Internals::kContextHeaderSize); |
530 STATIC_ASSERT(EMBEDDER_DATA_INDEX == Internals::kContextEmbedderDataIndex); | 530 STATIC_ASSERT(EMBEDDER_DATA_INDEX == Internals::kContextEmbedderDataIndex); |
531 }; | 531 }; |
532 | 532 |
533 } // namespace internal | 533 } // namespace internal |
534 } // namespace v8 | 534 } // namespace v8 |
535 | 535 |
536 #endif // V8_CONTEXTS_H_ | 536 #endif // V8_CONTEXTS_H_ |
OLD | NEW |