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 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
218 // Conversions. | 218 // Conversions. |
219 static ScriptContextTable* cast(Object* context) { | 219 static ScriptContextTable* cast(Object* context) { |
220 DCHECK(context->IsScriptContextTable()); | 220 DCHECK(context->IsScriptContextTable()); |
221 return reinterpret_cast<ScriptContextTable*>(context); | 221 return reinterpret_cast<ScriptContextTable*>(context); |
222 } | 222 } |
223 | 223 |
224 struct LookupResult { | 224 struct LookupResult { |
225 int context_index; | 225 int context_index; |
226 int slot_index; | 226 int slot_index; |
227 VariableMode mode; | 227 VariableMode mode; |
228 ContextSlotKindFlag slot_kind; | |
228 InitializationFlag init_flag; | 229 InitializationFlag init_flag; |
229 MaybeAssignedFlag maybe_assigned_flag; | 230 MaybeAssignedFlag maybe_assigned_flag; |
230 }; | 231 }; |
231 | 232 |
232 int used() const { return Smi::cast(get(kUsedSlot))->value(); } | 233 int used() const { return Smi::cast(get(kUsedSlot))->value(); } |
233 | 234 |
234 void set_used(int used) { set(kUsedSlot, Smi::FromInt(used)); } | 235 void set_used(int used) { set(kUsedSlot, Smi::FromInt(used)); } |
235 | 236 |
236 static Handle<Context> GetContext(Handle<ScriptContextTable> table, int i) { | 237 static Handle<Context> GetContext(Handle<ScriptContextTable> table, int i) { |
237 DCHECK(i < table->used()); | 238 DCHECK(i < table->used()); |
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
549 bool IsScriptContext() { | 550 bool IsScriptContext() { |
550 Map* map = this->map(); | 551 Map* map = this->map(); |
551 return map == map->GetHeap()->script_context_map(); | 552 return map == map->GetHeap()->script_context_map(); |
552 } | 553 } |
553 | 554 |
554 bool HasSameSecurityTokenAs(Context* that) { | 555 bool HasSameSecurityTokenAs(Context* that) { |
555 return this->global_object()->native_context()->security_token() == | 556 return this->global_object()->native_context()->security_token() == |
556 that->global_object()->native_context()->security_token(); | 557 that->global_object()->native_context()->security_token(); |
557 } | 558 } |
558 | 559 |
560 // Invalidates global variable bindings in given script context. | |
561 void InvalidateGlobalSlots(); | |
Toon Verwaest
2015/07/01 09:28:55
InitializeGlobalSlots
Igor Sheludko
2015/07/02 16:50:13
Done.
| |
562 | |
559 // A native context holds a list of all functions with optimized code. | 563 // A native context holds a list of all functions with optimized code. |
560 void AddOptimizedFunction(JSFunction* function); | 564 void AddOptimizedFunction(JSFunction* function); |
561 void RemoveOptimizedFunction(JSFunction* function); | 565 void RemoveOptimizedFunction(JSFunction* function); |
562 void SetOptimizedFunctionsListHead(Object* head); | 566 void SetOptimizedFunctionsListHead(Object* head); |
563 Object* OptimizedFunctionsListHead(); | 567 Object* OptimizedFunctionsListHead(); |
564 | 568 |
565 // The native context also stores a list of all optimized code and a | 569 // The native context also stores a list of all optimized code and a |
566 // list of all deoptimized code, which are needed by the deoptimizer. | 570 // list of all deoptimized code, which are needed by the deoptimizer. |
567 void AddOptimizedCode(Code* code); | 571 void AddOptimizedCode(Code* code); |
568 void SetOptimizedCodeListHead(Object* head); | 572 void SetOptimizedCodeListHead(Object* head); |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
662 static bool IsBootstrappingOrGlobalObject(Isolate* isolate, Object* object); | 666 static bool IsBootstrappingOrGlobalObject(Isolate* isolate, Object* object); |
663 #endif | 667 #endif |
664 | 668 |
665 STATIC_ASSERT(kHeaderSize == Internals::kContextHeaderSize); | 669 STATIC_ASSERT(kHeaderSize == Internals::kContextHeaderSize); |
666 STATIC_ASSERT(EMBEDDER_DATA_INDEX == Internals::kContextEmbedderDataIndex); | 670 STATIC_ASSERT(EMBEDDER_DATA_INDEX == Internals::kContextEmbedderDataIndex); |
667 }; | 671 }; |
668 | 672 |
669 } } // namespace v8::internal | 673 } } // namespace v8::internal |
670 | 674 |
671 #endif // V8_CONTEXTS_H_ | 675 #endif // V8_CONTEXTS_H_ |
OLD | NEW |