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