Index: src/contexts.h |
diff --git a/src/contexts.h b/src/contexts.h |
index dc77861b2578be34e1169ae932c50554adfbfa76..845d7ca660fcda6b37c84189464025eda2378d74 100644 |
--- a/src/contexts.h |
+++ b/src/contexts.h |
@@ -183,7 +183,39 @@ enum BindingFlags { |
V(SET_ITERATOR_MAP_INDEX, Map, set_iterator_map) \ |
V(ITERATOR_SYMBOL_INDEX, Symbol, iterator_symbol) \ |
V(UNSCOPABLES_SYMBOL_INDEX, Symbol, unscopables_symbol) \ |
- V(ARRAY_VALUES_ITERATOR_INDEX, JSFunction, array_values_iterator) |
+ V(ARRAY_VALUES_ITERATOR_INDEX, JSFunction, array_values_iterator) \ |
+ V(GLOBAL_CONTEXT_TABLE_INDEX, GlobalContextTable, global_context_table) |
+ |
+ |
+class GlobalContextTable : public FixedArray { |
+ public: |
+ // Conversions. |
+ static GlobalContextTable* cast(Object* context) { |
+ DCHECK(context->IsGlobalContextTable()); |
+ return reinterpret_cast<GlobalContextTable*>(context); |
+ } |
+ |
+ struct LookupResult { |
+ int context_index_; |
rossberg
2014/11/06 12:29:12
Nit: public data fields don't have a trailing "_".
Dmitry Lomov (no reviews)
2014/11/06 17:26:58
Done.
|
+ int slot_index_; |
+ VariableMode mode_; |
+ InitializationFlag init_flag_; |
+ MaybeAssignedFlag maybe_assigned_flag_; |
rossberg
2014/11/06 12:29:12
Do we actually need the two flags for the global c
Dmitry Lomov (no reviews)
2014/11/06 17:26:58
They are used in Context::Lookup.
|
+ }; |
+ |
+ int size() const { return length() - 1; } |
+ |
+ static Handle<Context> GetContext(Handle<GlobalContextTable> table, int i) { |
+ return Handle<Context>::cast(FixedArray::get(table, i)); |
+ } |
+ |
+ static bool Lookup(Handle<GlobalContextTable> table, Handle<String> name, |
+ LookupResult* result); |
+ |
+ // table may be null. |
+ static Handle<GlobalContextTable> Extend(Handle<GlobalContextTable> table, |
+ Handle<Context> global_context); |
+}; |
// JSFunctions are pairs (context, function code), sometimes also called |
// closures. A Context object is used to represent function contexts and |
@@ -360,6 +392,7 @@ class Context: public FixedArray { |
ITERATOR_SYMBOL_INDEX, |
UNSCOPABLES_SYMBOL_INDEX, |
ARRAY_VALUES_ITERATOR_INDEX, |
+ GLOBAL_CONTEXT_TABLE_INDEX, |
// Properties from here are treated as weak references by the full GC. |
// Scavenge treats them as strong references. |
@@ -555,7 +588,6 @@ class Context: public FixedArray { |
STATIC_ASSERT(kHeaderSize == Internals::kContextHeaderSize); |
STATIC_ASSERT(EMBEDDER_DATA_INDEX == Internals::kContextEmbedderDataIndex); |
}; |
- |
} } // namespace v8::internal |
#endif // V8_CONTEXTS_H_ |