| 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 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 // valid information about its location. | 222 // valid information about its location. |
| 223 // If it returns false, `result` is untouched. | 223 // If it returns false, `result` is untouched. |
| 224 MUST_USE_RESULT | 224 MUST_USE_RESULT |
| 225 static bool Lookup(Handle<GlobalContextTable> table, Handle<String> name, | 225 static bool Lookup(Handle<GlobalContextTable> table, Handle<String> name, |
| 226 LookupResult* result); | 226 LookupResult* result); |
| 227 | 227 |
| 228 MUST_USE_RESULT | 228 MUST_USE_RESULT |
| 229 static Handle<GlobalContextTable> Extend(Handle<GlobalContextTable> table, | 229 static Handle<GlobalContextTable> Extend(Handle<GlobalContextTable> table, |
| 230 Handle<Context> global_context); | 230 Handle<Context> global_context); |
| 231 | 231 |
| 232 static int GetContextOffset(int context_index) { |
| 233 return kFirstContextOffset + context_index * kPointerSize; |
| 234 } |
| 235 |
| 232 private: | 236 private: |
| 233 static const int kUsedSlot = 0; | 237 static const int kUsedSlot = 0; |
| 238 static const int kFirstContextOffset = |
| 239 FixedArray::kHeaderSize + (kUsedSlot + 1) * kPointerSize; |
| 234 | 240 |
| 235 DISALLOW_IMPLICIT_CONSTRUCTORS(GlobalContextTable); | 241 DISALLOW_IMPLICIT_CONSTRUCTORS(GlobalContextTable); |
| 236 }; | 242 }; |
| 237 | 243 |
| 238 // JSFunctions are pairs (context, function code), sometimes also called | 244 // JSFunctions are pairs (context, function code), sometimes also called |
| 239 // closures. A Context object is used to represent function contexts and | 245 // closures. A Context object is used to represent function contexts and |
| 240 // dynamically pushed 'with' contexts (or 'scopes' in ECMA-262 speak). | 246 // dynamically pushed 'with' contexts (or 'scopes' in ECMA-262 speak). |
| 241 // | 247 // |
| 242 // At runtime, the contexts build a stack in parallel to the execution | 248 // At runtime, the contexts build a stack in parallel to the execution |
| 243 // stack, with the top-most context being the current context. All contexts | 249 // stack, with the top-most context being the current context. All contexts |
| (...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 605 static bool IsBootstrappingOrGlobalObject(Isolate* isolate, Object* object); | 611 static bool IsBootstrappingOrGlobalObject(Isolate* isolate, Object* object); |
| 606 #endif | 612 #endif |
| 607 | 613 |
| 608 STATIC_ASSERT(kHeaderSize == Internals::kContextHeaderSize); | 614 STATIC_ASSERT(kHeaderSize == Internals::kContextHeaderSize); |
| 609 STATIC_ASSERT(EMBEDDER_DATA_INDEX == Internals::kContextEmbedderDataIndex); | 615 STATIC_ASSERT(EMBEDDER_DATA_INDEX == Internals::kContextEmbedderDataIndex); |
| 610 }; | 616 }; |
| 611 | 617 |
| 612 } } // namespace v8::internal | 618 } } // namespace v8::internal |
| 613 | 619 |
| 614 #endif // V8_CONTEXTS_H_ | 620 #endif // V8_CONTEXTS_H_ |
| OLD | NEW |