| 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 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 343 // (through 'eval'). The object in a 'with' statement is | 343 // (through 'eval'). The object in a 'with' statement is |
| 344 // stored in the extension slot of a 'with' context. | 344 // stored in the extension slot of a 'with' context. |
| 345 // Dynamically declared variables/functions are also added | 345 // Dynamically declared variables/functions are also added |
| 346 // to lazily allocated extension object. Context::Lookup | 346 // to lazily allocated extension object. Context::Lookup |
| 347 // searches the extension object for properties. | 347 // searches the extension object for properties. |
| 348 // For script and block contexts, contains the respective | 348 // For script and block contexts, contains the respective |
| 349 // ScopeInfo. For block contexts representing sloppy declaration | 349 // ScopeInfo. For block contexts representing sloppy declaration |
| 350 // block scopes, it may also be a struct being a | 350 // block scopes, it may also be a struct being a |
| 351 // SloppyBlockWithEvalContextExtension, pairing the ScopeInfo | 351 // SloppyBlockWithEvalContextExtension, pairing the ScopeInfo |
| 352 // with an extension object. | 352 // with an extension object. |
| 353 // For module contexts, points back to the respective JSModule. | |
| 354 // | 353 // |
| 355 // [ global_object ] A pointer to the global object. Provided for quick | 354 // [ global_object ] A pointer to the global object. Provided for quick |
| 356 // access to the global object from inside the code (since | 355 // access to the global object from inside the code (since |
| 357 // we always have a context pointer). | 356 // we always have a context pointer). |
| 358 // | 357 // |
| 359 // In addition, function contexts may have statically allocated context slots | 358 // In addition, function contexts may have statically allocated context slots |
| 360 // to store local variables/functions that are accessed from inner functions | 359 // to store local variables/functions that are accessed from inner functions |
| 361 // (via static context addresses) or through 'eval' (dynamic context lookups). | 360 // (via static context addresses) or through 'eval' (dynamic context lookups). |
| 362 // The native context contains additional slots for fast access to native | 361 // The native context contains additional slots for fast access to native |
| 363 // properties. | 362 // properties. |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 423 inline Object* next_context_link(); | 422 inline Object* next_context_link(); |
| 424 | 423 |
| 425 inline bool has_extension(); | 424 inline bool has_extension(); |
| 426 inline HeapObject* extension(); | 425 inline HeapObject* extension(); |
| 427 inline void set_extension(HeapObject* object); | 426 inline void set_extension(HeapObject* object); |
| 428 JSObject* extension_object(); | 427 JSObject* extension_object(); |
| 429 JSReceiver* extension_receiver(); | 428 JSReceiver* extension_receiver(); |
| 430 ScopeInfo* scope_info(); | 429 ScopeInfo* scope_info(); |
| 431 String* catch_name(); | 430 String* catch_name(); |
| 432 | 431 |
| 433 inline JSModule* module(); | |
| 434 inline void set_module(JSModule* module); | |
| 435 | |
| 436 // Get the context where var declarations will be hoisted to, which | 432 // Get the context where var declarations will be hoisted to, which |
| 437 // may be the context itself. | 433 // may be the context itself. |
| 438 Context* declaration_context(); | 434 Context* declaration_context(); |
| 439 bool is_declaration_context(); | 435 bool is_declaration_context(); |
| 440 | 436 |
| 441 // Get the next closure's context on the context chain. | 437 // Get the next closure's context on the context chain. |
| 442 Context* closure_context(); | 438 Context* closure_context(); |
| 443 | 439 |
| 444 // Returns a JSGlobalProxy object or null. | 440 // Returns a JSGlobalProxy object or null. |
| 445 JSObject* global_proxy(); | 441 JSObject* global_proxy(); |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 576 #endif | 572 #endif |
| 577 | 573 |
| 578 STATIC_ASSERT(kHeaderSize == Internals::kContextHeaderSize); | 574 STATIC_ASSERT(kHeaderSize == Internals::kContextHeaderSize); |
| 579 STATIC_ASSERT(EMBEDDER_DATA_INDEX == Internals::kContextEmbedderDataIndex); | 575 STATIC_ASSERT(EMBEDDER_DATA_INDEX == Internals::kContextEmbedderDataIndex); |
| 580 }; | 576 }; |
| 581 | 577 |
| 582 } // namespace internal | 578 } // namespace internal |
| 583 } // namespace v8 | 579 } // namespace v8 |
| 584 | 580 |
| 585 #endif // V8_CONTEXTS_H_ | 581 #endif // V8_CONTEXTS_H_ |
| OLD | NEW |