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

Unified Diff: src/arm64/code-stubs-arm64.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/arm/code-stubs-arm.cc ('k') | src/compiler/js-call-reducer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/arm64/code-stubs-arm64.cc
diff --git a/src/arm64/code-stubs-arm64.cc b/src/arm64/code-stubs-arm64.cc
index 810f3aa7c831c3d4693653f0d9d7626f19904e81..e86135294f70c947c34e7f8ae214376de0fb95b0 100644
--- a/src/arm64/code-stubs-arm64.cc
+++ b/src/arm64/code-stubs-arm64.cc
@@ -2941,6 +2941,7 @@ void CallApiCallbackStub::Generate(MacroAssembler* masm) {
// -- ...
// -- sp[(argc - 1) * 8] : first argument
// -- sp[argc * 8] : receiver
+ // -- sp[(argc + 1) * 8] : accessor_holder
// -----------------------------------
Register callee = x0;
@@ -2969,18 +2970,29 @@ void CallApiCallbackStub::Generate(MacroAssembler* masm) {
// context, callee and call data.
__ Push(context, callee, call_data);
- if (!is_lazy()) {
- // Load context from callee
- __ Ldr(context, FieldMemOperand(callee, JSFunction::kContextOffset));
- }
-
- __ LoadRoot(call_data, Heap::kUndefinedValueRootIndex);
+ Register scratch = call_data;
+ __ LoadRoot(scratch, Heap::kUndefinedValueRootIndex);
Register isolate_reg = x5;
__ Mov(isolate_reg, ExternalReference::isolate_address(masm->isolate()));
// FunctionCallbackArguments:
// return value, return value default, isolate, holder.
- __ Push(call_data, call_data, isolate_reg, holder);
+ __ Push(scratch, scratch, isolate_reg, holder);
+
+ // Enter a new context
+ if (is_lazy()) {
+ // Load context from accessor_holder
+ Register accessor_holder = context;
+ __ Ldr(accessor_holder,
+ MemOperand(__ StackPointer(),
+ (FCA::kArgsLength + 1 + argc()) * kPointerSize));
+ __ Ldr(scratch, FieldMemOperand(accessor_holder, HeapObject::kMapOffset));
+ __ GetMapConstructor(scratch, scratch, context, callee);
+ __ Ldr(context, FieldMemOperand(scratch, JSFunction::kContextOffset));
+ } else {
+ // Load context from callee
+ __ Ldr(context, FieldMemOperand(callee, JSFunction::kContextOffset));
+ }
// Prepare arguments.
Register args = x6;
@@ -3022,12 +3034,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(masm->StackPointer(), 3 * 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;
const int spill_offset = 1 + kApiStackSpace;
CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, stack_space,
« no previous file with comments | « src/arm/code-stubs-arm.cc ('k') | src/compiler/js-call-reducer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698