Index: src/factory.cc |
diff --git a/src/factory.cc b/src/factory.cc |
index b321adec29915d2191caa77eb5ceac1fba37b598..24215b64e5e2c45f6997bf5dfb87a3ac40022ed4 100644 |
--- a/src/factory.cc |
+++ b/src/factory.cc |
@@ -725,6 +725,7 @@ Handle<Context> Factory::NewNativeContext() { |
NewFixedArray(Context::NATIVE_CONTEXT_SLOTS, TENURED); |
array->set_map_no_write_barrier(*native_context_map()); |
Handle<Context> context = Handle<Context>::cast(array); |
+ context->set_native_context(*context); |
context->set_js_array_maps(*undefined_value()); |
context->set_errors_thrown(Smi::FromInt(0)); |
DCHECK(context->IsNativeContext()); |
@@ -741,7 +742,7 @@ Handle<Context> Factory::NewScriptContext(Handle<JSFunction> function, |
context->set_closure(*function); |
context->set_previous(function->context()); |
context->set_extension(*scope_info); |
- context->set_global_object(function->context()->global_object()); |
+ context->set_native_context(function->native_context()); |
DCHECK(context->IsScriptContext()); |
return context; |
} |
@@ -777,7 +778,7 @@ Handle<Context> Factory::NewFunctionContext(int length, |
context->set_closure(*function); |
context->set_previous(function->context()); |
context->set_extension(Smi::FromInt(0)); |
- context->set_global_object(function->context()->global_object()); |
+ context->set_native_context(function->native_context()); |
return context; |
} |
@@ -793,7 +794,7 @@ Handle<Context> Factory::NewCatchContext(Handle<JSFunction> function, |
context->set_closure(*function); |
context->set_previous(*previous); |
context->set_extension(*name); |
- context->set_global_object(previous->global_object()); |
+ context->set_native_context(previous->native_context()); |
context->set(Context::THROWN_OBJECT_INDEX, *thrown_object); |
return context; |
} |
@@ -808,7 +809,7 @@ Handle<Context> Factory::NewWithContext(Handle<JSFunction> function, |
context->set_closure(*function); |
context->set_previous(*previous); |
context->set_extension(*extension); |
- context->set_global_object(previous->global_object()); |
+ context->set_native_context(previous->native_context()); |
return context; |
} |
@@ -823,7 +824,7 @@ Handle<Context> Factory::NewBlockContext(Handle<JSFunction> function, |
context->set_closure(*function); |
context->set_previous(*previous); |
context->set_extension(*scope_info); |
- context->set_global_object(previous->global_object()); |
+ context->set_native_context(previous->native_context()); |
return context; |
} |