Index: src/objects.cc |
diff --git a/src/objects.cc b/src/objects.cc |
index 6f306408908eac1caf81d1606364b2ee13224110..6089558f78177ffb080cd41e98ec255c0a3a6f1c 100644 |
--- a/src/objects.cc |
+++ b/src/objects.cc |
@@ -1957,6 +1957,21 @@ MaybeHandle<Object> JSObject::AddProperty( |
} |
+Context* JSObject::GetCreationContext() { |
+ Object* constructor = this->map()->constructor(); |
+ JSFunction* function; |
+ if (!constructor->IsJSFunction()) { |
+ // Functions have null as a constructor, |
+ // but any JSFunction knows its context immediately. |
+ function = JSFunction::cast(this); |
+ } else { |
+ function = JSFunction::cast(constructor); |
+ } |
+ |
+ return function->context()->native_context(); |
+} |
+ |
+ |
void JSObject::EnqueueChangeRecord(Handle<JSObject> object, |
const char* type_str, |
Handle<Name> name, |