| OLD | NEW | 
|---|
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 172 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 183 //                function contexts, and non-NULL for 'with' contexts. | 183 //                function contexts, and non-NULL for 'with' contexts. | 
| 184 //                Used to implement the 'with' statement. | 184 //                Used to implement the 'with' statement. | 
| 185 // | 185 // | 
| 186 // [ extension ]  A pointer to an extension JSObject, or NULL. Used to | 186 // [ extension ]  A pointer to an extension JSObject, or NULL. Used to | 
| 187 //                implement 'with' statements and dynamic declarations | 187 //                implement 'with' statements and dynamic declarations | 
| 188 //                (through 'eval'). The object in a 'with' statement is | 188 //                (through 'eval'). The object in a 'with' statement is | 
| 189 //                stored in the extension slot of a 'with' context. | 189 //                stored in the extension slot of a 'with' context. | 
| 190 //                Dynamically declared variables/functions are also added | 190 //                Dynamically declared variables/functions are also added | 
| 191 //                to lazily allocated extension object. Context::Lookup | 191 //                to lazily allocated extension object. Context::Lookup | 
| 192 //                searches the extension object for properties. | 192 //                searches the extension object for properties. | 
| 193 //                For block contexts, contains the respective ScopeInfo. | 193 //                For global and block contexts, contains the respective | 
|  | 194 //                ScopeInfo. | 
| 194 //                For module contexts, points back to the respective JSModule. | 195 //                For module contexts, points back to the respective JSModule. | 
| 195 // | 196 // | 
| 196 // [ global_object ]  A pointer to the global object. Provided for quick | 197 // [ global_object ]  A pointer to the global object. Provided for quick | 
| 197 //                access to the global object from inside the code (since | 198 //                access to the global object from inside the code (since | 
| 198 //                we always have a context pointer). | 199 //                we always have a context pointer). | 
| 199 // | 200 // | 
| 200 // In addition, function contexts may have statically allocated context slots | 201 // In addition, function contexts may have statically allocated context slots | 
| 201 // to store local variables/functions that are accessed from inner functions | 202 // to store local variables/functions that are accessed from inner functions | 
| 202 // (via static context addresses) or through 'eval' (dynamic context lookups). | 203 // (via static context addresses) or through 'eval' (dynamic context lookups). | 
| 203 // Finally, the native context contains additional slots for fast access to | 204 // Finally, the native context contains additional slots for fast access to | 
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 356     return map == map->GetHeap()->with_context_map(); | 357     return map == map->GetHeap()->with_context_map(); | 
| 357   } | 358   } | 
| 358   bool IsBlockContext() { | 359   bool IsBlockContext() { | 
| 359     Map* map = this->map(); | 360     Map* map = this->map(); | 
| 360     return map == map->GetHeap()->block_context_map(); | 361     return map == map->GetHeap()->block_context_map(); | 
| 361   } | 362   } | 
| 362   bool IsModuleContext() { | 363   bool IsModuleContext() { | 
| 363     Map* map = this->map(); | 364     Map* map = this->map(); | 
| 364     return map == map->GetHeap()->module_context_map(); | 365     return map == map->GetHeap()->module_context_map(); | 
| 365   } | 366   } | 
|  | 367   bool IsGlobalContext() { | 
|  | 368     Map* map = this->map(); | 
|  | 369     return map == map->GetHeap()->global_context_map(); | 
|  | 370   } | 
| 366 | 371 | 
| 367   // Tells whether the native context is marked with out of memory. | 372   // Tells whether the native context is marked with out of memory. | 
| 368   inline bool has_out_of_memory(); | 373   inline bool has_out_of_memory(); | 
| 369 | 374 | 
| 370   // Mark the native context with out of memory. | 375   // Mark the native context with out of memory. | 
| 371   inline void mark_out_of_memory(); | 376   inline void mark_out_of_memory(); | 
| 372 | 377 | 
| 373   // A native context hold a list of all functions which have been optimized. | 378   // A native context hold a list of all functions which have been optimized. | 
| 374   void AddOptimizedFunction(JSFunction* function); | 379   void AddOptimizedFunction(JSFunction* function); | 
| 375   void RemoveOptimizedFunction(JSFunction* function); | 380   void RemoveOptimizedFunction(JSFunction* function); | 
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 434 #ifdef DEBUG | 439 #ifdef DEBUG | 
| 435   // Bootstrapping-aware type checks. | 440   // Bootstrapping-aware type checks. | 
| 436   static bool IsBootstrappingOrValidParentContext(Object* object, Context* kid); | 441   static bool IsBootstrappingOrValidParentContext(Object* object, Context* kid); | 
| 437   static bool IsBootstrappingOrGlobalObject(Object* object); | 442   static bool IsBootstrappingOrGlobalObject(Object* object); | 
| 438 #endif | 443 #endif | 
| 439 }; | 444 }; | 
| 440 | 445 | 
| 441 } }  // namespace v8::internal | 446 } }  // namespace v8::internal | 
| 442 | 447 | 
| 443 #endif  // V8_CONTEXTS_H_ | 448 #endif  // V8_CONTEXTS_H_ | 
| OLD | NEW | 
|---|