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

Unified Diff: src/ppc/builtins-ppc.cc

Issue 1551473002: [builtins] Fix context for ConstructStub calls into C++. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: REBASE Created 5 years 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/builtins-mips64.cc ('k') | src/x64/builtins-x64.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ppc/builtins-ppc.cc
diff --git a/src/ppc/builtins-ppc.cc b/src/ppc/builtins-ppc.cc
index b1a8a83c69f8af2e13d4f56e28b5eae9ee395b03..c431fc18682ce008a5250f5cb243b7de016d24c3 100644
--- a/src/ppc/builtins-ppc.cc
+++ b/src/ppc/builtins-ppc.cc
@@ -30,6 +30,12 @@ void Builtins::Generate_Adaptor(MacroAssembler* masm, CFunctionId id,
// -----------------------------------
__ AssertFunction(r4);
+ // Make sure we operate in the context of the called function (for example
+ // ConstructStubs implemented in C++ will be run in the context of the caller
+ // instead of the callee, due to the way that [[Construct]] is defined for
+ // ordinary functions).
+ __ LoadP(cp, FieldMemOperand(r4, JSFunction::kContextOffset));
+
// Insert extra arguments.
int num_extra_args = 0;
switch (extra_args) {
« no previous file with comments | « src/mips64/builtins-mips64.cc ('k') | src/x64/builtins-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698