Cherry pick http://codereview.chromium.org/1207003/show

Implement support for reattaching a global object to a context. This
can be used to use the same global object for different contexts at
different points in time.

Needed to fix b: 2533219

Change-Id: Ib3b0d35f6ce3e0a5f4b8e54561ba2e99a9ab0ab1
diff --git a/src/api.cc b/src/api.cc
index 262bf52..22c5b77 100644
--- a/src/api.cc
+++ b/src/api.cc
@@ -3007,6 +3007,16 @@
 }
 
 
+void Context::ReattachGlobal(Handle<Object> global_object) {
+  if (IsDeadCheck("v8::Context::ReattachGlobal()")) return;
+  ENTER_V8;
+  i::Object** ctx = reinterpret_cast<i::Object**>(this);
+  i::Handle<i::Context> context =
+      i::Handle<i::Context>::cast(i::Handle<i::Object>(ctx));
+  i::Bootstrapper::ReattachGlobal(context, Utils::OpenHandle(*global_object));
+}
+
+
 Local<v8::Object> ObjectTemplate::NewInstance() {
   ON_BAILOUT("v8::ObjectTemplate::NewInstance()", return Local<v8::Object>());
   LOG_API("ObjectTemplate::NewInstance");