Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(559)

Unified Diff: src/objects.cc

Issue 2770003002: Set the current context to the function's context when entering to LAP. (Closed)
Patch Set: Synced. Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/mips64/code-stubs-mips64.cc ('k') | src/ppc/code-stubs-ppc.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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(
« no previous file with comments | « src/mips64/code-stubs-mips64.cc ('k') | src/ppc/code-stubs-ppc.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698