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