Index: src/contexts.cc |
diff --git a/src/contexts.cc b/src/contexts.cc |
index 61b83c2c4e546b7a37d25007ee0ea26d1de6ef4f..d434cf3a6d0bd6d0dbc1590d44f8d178767f58bc 100644 |
--- a/src/contexts.cc |
+++ b/src/contexts.cc |
@@ -85,22 +85,12 @@ Context* Context::script_context() { |
Context* Context::native_context() { |
+ if (IsNativeContext()) return this; |
// Fast case: the global object for this context has been set. In |
Jakob Kummerow
2015/07/01 14:14:27
nit: outdated comment.
|
// that case, the global object has a direct pointer to the global |
// context. |
- if (global_object()->IsGlobalObject()) { |
- return global_object()->native_context(); |
- } |
- |
- // During bootstrapping, the global object might not be set and we |
- // have to search the context chain to find the native context. |
- DCHECK(this->GetIsolate()->bootstrapper()->IsActive()); |
- Context* current = this; |
- while (!current->IsNativeContext()) { |
- JSFunction* closure = JSFunction::cast(current->closure()); |
- current = Context::cast(closure->context()); |
- } |
- return current; |
+ DCHECK(global_object()->IsGlobalObject()); |
+ return global_object()->native_context(); |
} |