| 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 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 // ScopeInfo. | 219 // ScopeInfo. |
| 220 // For module contexts, points back to the respective JSModule. | 220 // For module contexts, points back to the respective JSModule. |
| 221 // | 221 // |
| 222 // [ global_object ] A pointer to the global object. Provided for quick | 222 // [ global_object ] A pointer to the global object. Provided for quick |
| 223 // access to the global object from inside the code (since | 223 // access to the global object from inside the code (since |
| 224 // we always have a context pointer). | 224 // we always have a context pointer). |
| 225 // | 225 // |
| 226 // In addition, function contexts may have statically allocated context slots | 226 // In addition, function contexts may have statically allocated context slots |
| 227 // to store local variables/functions that are accessed from inner functions | 227 // to store local variables/functions that are accessed from inner functions |
| 228 // (via static context addresses) or through 'eval' (dynamic context lookups). | 228 // (via static context addresses) or through 'eval' (dynamic context lookups). |
| 229 // Finally, the native context contains additional slots for fast access to | 229 // The native context contains additional slots for fast access to native |
| 230 // native properties. | 230 // properties. |
| 231 // |
| 232 // Finally, with Harmony scoping, the JSFunction representing a top level |
| 233 // script will have the GlobalContext rather than a FunctionContext. |
| 231 | 234 |
| 232 class Context: public FixedArray { | 235 class Context: public FixedArray { |
| 233 public: | 236 public: |
| 234 // Conversions. | 237 // Conversions. |
| 235 static Context* cast(Object* context) { | 238 static Context* cast(Object* context) { |
| 236 ASSERT(context->IsContext()); | 239 ASSERT(context->IsContext()); |
| 237 return reinterpret_cast<Context*>(context); | 240 return reinterpret_cast<Context*>(context); |
| 238 } | 241 } |
| 239 | 242 |
| 240 // The default context slot layout; indices are FixedArray slot indices. | 243 // The default context slot layout; indices are FixedArray slot indices. |
| (...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 521 static bool IsBootstrappingOrGlobalObject(Isolate* isolate, Object* object); | 524 static bool IsBootstrappingOrGlobalObject(Isolate* isolate, Object* object); |
| 522 #endif | 525 #endif |
| 523 | 526 |
| 524 STATIC_CHECK(kHeaderSize == Internals::kContextHeaderSize); | 527 STATIC_CHECK(kHeaderSize == Internals::kContextHeaderSize); |
| 525 STATIC_CHECK(EMBEDDER_DATA_INDEX == Internals::kContextEmbedderDataIndex); | 528 STATIC_CHECK(EMBEDDER_DATA_INDEX == Internals::kContextEmbedderDataIndex); |
| 526 }; | 529 }; |
| 527 | 530 |
| 528 } } // namespace v8::internal | 531 } } // namespace v8::internal |
| 529 | 532 |
| 530 #endif // V8_CONTEXTS_H_ | 533 #endif // V8_CONTEXTS_H_ |
| OLD | NEW |