Index: src/objects.cc |
diff --git a/src/objects.cc b/src/objects.cc |
index b37cf3b43c90a502025827bbe8bc9d4f7317d261..5b3e29a8e31affed3c66159b421c9aa573039cd6 100644 |
--- a/src/objects.cc |
+++ b/src/objects.cc |
@@ -1957,6 +1957,22 @@ 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. |
+ ASSERT(this->IsJSFunction()); |
Toon Verwaest
2014/05/02 13:48:00
This assert is done already by JSFunction::cast so
|
+ 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, |