Index: src/objects.cc |
diff --git a/src/objects.cc b/src/objects.cc |
index 2450f0798cf295e57bc66bce15f36f6eb1e52ae8..42a0a8a1339b76bd02488d2e510cfa19628c4eb2 100644 |
--- a/src/objects.cc |
+++ b/src/objects.cc |
@@ -1365,8 +1365,8 @@ MaybeHandle<Object> Object::GetPropertyWithAccessor(LookupIterator* it) { |
DCHECK(!structure->IsForeign()); |
// API style callbacks. |
+ Handle<JSObject> holder = it->GetHolder<JSObject>(); |
if (structure->IsAccessorInfo()) { |
- Handle<JSObject> holder = it->GetHolder<JSObject>(); |
Handle<Name> name = it->GetName(); |
Handle<AccessorInfo> info = Handle<AccessorInfo>::cast(structure); |
if (!info->IsCompatibleReceiver(*receiver)) { |
@@ -1409,6 +1409,8 @@ MaybeHandle<Object> Object::GetPropertyWithAccessor(LookupIterator* it) { |
// Regular accessor. |
Handle<Object> getter(AccessorPair::cast(*structure)->getter(), isolate); |
if (getter->IsFunctionTemplateInfo()) { |
+ SaveContext save(isolate); |
+ isolate->set_context(*holder->GetCreationContext()); |
return Builtins::InvokeApiFunction( |
isolate, false, Handle<FunctionTemplateInfo>::cast(getter), receiver, 0, |
nullptr, isolate->factory()->undefined_value()); |
@@ -1462,8 +1464,8 @@ Maybe<bool> Object::SetPropertyWithAccessor(LookupIterator* it, |
DCHECK(!structure->IsForeign()); |
// API style callbacks. |
+ Handle<JSObject> holder = it->GetHolder<JSObject>(); |
if (structure->IsAccessorInfo()) { |
- Handle<JSObject> holder = it->GetHolder<JSObject>(); |
Handle<Name> name = it->GetName(); |
Handle<AccessorInfo> info = Handle<AccessorInfo>::cast(structure); |
if (!info->IsCompatibleReceiver(*receiver)) { |
@@ -1509,6 +1511,8 @@ Maybe<bool> Object::SetPropertyWithAccessor(LookupIterator* it, |
// Regular accessor. |
Handle<Object> setter(AccessorPair::cast(*structure)->setter(), isolate); |
if (setter->IsFunctionTemplateInfo()) { |
+ SaveContext save(isolate); |
+ isolate->set_context(*holder->GetCreationContext()); |
Handle<Object> argv[] = {value}; |
RETURN_ON_EXCEPTION_VALUE( |
isolate, Builtins::InvokeApiFunction( |