| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 #include "src/contexts.h" | 5 #include "src/contexts.h" |
| 6 | 6 |
| 7 #include "src/bootstrapper.h" | 7 #include "src/bootstrapper.h" |
| 8 #include "src/debug/debug.h" | 8 #include "src/debug/debug.h" |
| 9 #include "src/isolate-inl.h" | 9 #include "src/isolate-inl.h" |
| 10 #include "src/scopeinfo.h" | 10 #include "src/scopeinfo.h" |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 return current; | 126 return current; |
| 127 } | 127 } |
| 128 | 128 |
| 129 | 129 |
| 130 Context* Context::native_context() { | 130 Context* Context::native_context() { |
| 131 // Fast case: the receiver context is already a native context. | 131 // Fast case: the receiver context is already a native context. |
| 132 if (IsNativeContext()) return this; | 132 if (IsNativeContext()) return this; |
| 133 // The global object has a direct pointer to the native context. If the | 133 // The global object has a direct pointer to the native context. If the |
| 134 // following DCHECK fails, the native context is probably being accessed | 134 // following DCHECK fails, the native context is probably being accessed |
| 135 // indirectly during bootstrapping. This is unsupported. | 135 // indirectly during bootstrapping. This is unsupported. |
| 136 DCHECK(global_object()->IsGlobalObject()); | 136 DCHECK(global_object()->IsJSGlobalObject()); |
| 137 return global_object()->native_context(); | 137 return global_object()->native_context(); |
| 138 } | 138 } |
| 139 | 139 |
| 140 | 140 |
| 141 JSObject* Context::global_proxy() { | 141 JSObject* Context::global_proxy() { |
| 142 return native_context()->global_proxy_object(); | 142 return native_context()->global_proxy_object(); |
| 143 } | 143 } |
| 144 | 144 |
| 145 | 145 |
| 146 void Context::set_global_proxy(JSObject* object) { | 146 void Context::set_global_proxy(JSObject* object) { |
| (...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 566 Context* context = Context::cast(object); | 566 Context* context = Context::cast(object); |
| 567 return context->IsNativeContext() || context->IsScriptContext() || | 567 return context->IsNativeContext() || context->IsScriptContext() || |
| 568 context->IsModuleContext() || !child->IsModuleContext(); | 568 context->IsModuleContext() || !child->IsModuleContext(); |
| 569 } | 569 } |
| 570 | 570 |
| 571 | 571 |
| 572 bool Context::IsBootstrappingOrGlobalObject(Isolate* isolate, Object* object) { | 572 bool Context::IsBootstrappingOrGlobalObject(Isolate* isolate, Object* object) { |
| 573 // During bootstrapping we allow all objects to pass as global | 573 // During bootstrapping we allow all objects to pass as global |
| 574 // objects. This is necessary to fix circular dependencies. | 574 // objects. This is necessary to fix circular dependencies. |
| 575 return isolate->heap()->gc_state() != Heap::NOT_IN_GC || | 575 return isolate->heap()->gc_state() != Heap::NOT_IN_GC || |
| 576 isolate->bootstrapper()->IsActive() || | 576 isolate->bootstrapper()->IsActive() || object->IsJSGlobalObject(); |
| 577 object->IsGlobalObject(); | |
| 578 } | 577 } |
| 579 #endif | 578 #endif |
| 580 | 579 |
| 581 } // namespace internal | 580 } // namespace internal |
| 582 } // namespace v8 | 581 } // namespace v8 |
| OLD | NEW |