Index: src/contexts.cc |
diff --git a/src/contexts.cc b/src/contexts.cc |
index f769b9bb7e9fd6ce5e874d7dde741aa2de382c45..206f4a2e73d17015a17238610b63b92d7553c98b 100644 |
--- a/src/contexts.cc |
+++ b/src/contexts.cc |
@@ -118,6 +118,11 @@ String* Context::catch_name() { |
} |
+JSGlobalObject* Context::global_object() { |
+ return JSGlobalObject::cast(native_context()->extension()); |
+} |
+ |
+ |
Context* Context::script_context() { |
Context* current = this; |
while (!current->IsScriptContext()) { |
@@ -127,17 +132,6 @@ Context* Context::script_context() { |
} |
-Context* Context::native_context() { |
- // Fast case: the receiver context is already a native context. |
- if (IsNativeContext()) return this; |
- // The global object has a direct pointer to the native context. If the |
- // following DCHECK fails, the native context is probably being accessed |
- // indirectly during bootstrapping. This is unsupported. |
- DCHECK(global_object()->IsJSGlobalObject()); |
- return global_object()->native_context(); |
-} |
- |
- |
JSObject* Context::global_proxy() { |
return native_context()->global_proxy_object(); |
} |
@@ -557,6 +551,15 @@ bool Context::IsJSBuiltin(Handle<Context> native_context, |
#ifdef DEBUG |
+ |
+bool Context::IsBootstrappingOrNativeContext(Isolate* isolate, Object* object) { |
+ // During bootstrapping we allow all objects to pass as global |
+ // objects. This is necessary to fix circular dependencies. |
+ return isolate->heap()->gc_state() != Heap::NOT_IN_GC || |
+ isolate->bootstrapper()->IsActive() || object->IsNativeContext(); |
+} |
+ |
+ |
bool Context::IsBootstrappingOrValidParentContext( |
Object* object, Context* child) { |
// During bootstrapping we allow all objects to pass as |
@@ -568,13 +571,6 @@ bool Context::IsBootstrappingOrValidParentContext( |
context->IsModuleContext() || !child->IsModuleContext(); |
} |
- |
-bool Context::IsBootstrappingOrGlobalObject(Isolate* isolate, Object* object) { |
- // During bootstrapping we allow all objects to pass as global |
- // objects. This is necessary to fix circular dependencies. |
- return isolate->heap()->gc_state() != Heap::NOT_IN_GC || |
- isolate->bootstrapper()->IsActive() || object->IsJSGlobalObject(); |
-} |
#endif |