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

Unified Diff: src/ppc/code-stubs-ppc.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/objects.cc ('k') | src/s390/code-stubs-s390.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ppc/code-stubs-ppc.cc
diff --git a/src/ppc/code-stubs-ppc.cc b/src/ppc/code-stubs-ppc.cc
index aa8877b48697e19d8a19d14954441a51d777ed62..9d0361f256cc7a533f2905b37121ee9d54c80f5e 100644
--- a/src/ppc/code-stubs-ppc.cc
+++ b/src/ppc/code-stubs-ppc.cc
@@ -2841,6 +2841,7 @@ void CallApiCallbackStub::Generate(MacroAssembler* masm) {
// -- ...
// -- sp[(argc - 1)* 4] : first argument
// -- sp[argc * 4] : receiver
+ // -- sp[(argc + 1)* 4] : accessor_holder
// -----------------------------------
Register callee = r3;
@@ -2866,10 +2867,6 @@ void CallApiCallbackStub::Generate(MacroAssembler* masm) {
// context save
__ push(context);
- if (!is_lazy()) {
- // load context from callee
- __ LoadP(context, FieldMemOperand(callee, JSFunction::kContextOffset));
- }
// callee
__ push(callee);
@@ -2889,6 +2886,20 @@ void CallApiCallbackStub::Generate(MacroAssembler* masm) {
// holder
__ push(holder);
+ // Enter a new context
+ if (is_lazy()) {
+ // Load context from accessor_holder
+ Register accessor_holder = context;
+ __ LoadP(accessor_holder,
+ MemOperand(sp, (FCA::kArgsLength + 1 + argc()) * kPointerSize));
+ __ LoadP(scratch, FieldMemOperand(accessor_holder, HeapObject::kMapOffset));
+ __ GetMapConstructor(scratch, scratch, context, callee);
+ __ LoadP(context, FieldMemOperand(scratch, JSFunction::kContextOffset));
+ } else {
+ // Load context from callee
+ __ LoadP(context, FieldMemOperand(callee, JSFunction::kContextOffset));
+ }
+
// Prepare arguments.
__ mr(scratch, sp);
@@ -2933,12 +2944,8 @@ void CallApiCallbackStub::Generate(MacroAssembler* masm) {
return_value_offset = 2 + FCA::kReturnValueOffset;
}
MemOperand return_value_operand(fp, return_value_offset * kPointerSize);
- int stack_space = 0;
- MemOperand length_operand =
- MemOperand(sp, kFunctionCallbackInfoOffset + 2 * kPointerSize);
- MemOperand* stack_space_operand = &length_operand;
- stack_space = argc() + FCA::kArgsLength + 1;
- stack_space_operand = NULL;
+ const int stack_space = argc() + FCA::kArgsLength + 2;
+ MemOperand* stack_space_operand = nullptr;
CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, stack_space,
stack_space_operand, return_value_operand,
&context_restore_operand);
« no previous file with comments | « src/objects.cc ('k') | src/s390/code-stubs-s390.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698