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

Unified Diff: src/arm/code-stubs-arm.cc

Issue 2770003002: Set the current context to the function's context when entering to LAP. (Closed)
Patch Set: Crashing at cctest test-accessors/AccessorIC 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 | « no previous file | src/arm64/code-stubs-arm64.cc » ('j') | src/ic/x64/handler-compiler-x64.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/arm/code-stubs-arm.cc
diff --git a/src/arm/code-stubs-arm.cc b/src/arm/code-stubs-arm.cc
index 323a78d7b966cfc6796348049a9707428f8d9b7c..76245aaf89e9bb98ca16dd71455384a8c82bfe13 100644
--- a/src/arm/code-stubs-arm.cc
+++ b/src/arm/code-stubs-arm.cc
@@ -2762,8 +2762,9 @@ void CallApiCallbackStub::Generate(MacroAssembler* masm) {
// --
// -- sp[0] : last argument
// -- ...
- // -- sp[(argc - 1)* 4] : first argument
+ // -- sp[(argc - 1) * 4] : first argument
// -- sp[argc * 4] : receiver
+ // -- sp[(argc + 1) * 4] : accessor_holder
// -----------------------------------
Register callee = r0;
@@ -2789,10 +2790,6 @@ void CallApiCallbackStub::Generate(MacroAssembler* masm) {
// context save
__ push(context);
- if (!is_lazy()) {
- // load context from callee
- __ ldr(context, FieldMemOperand(callee, JSFunction::kContextOffset));
- }
// callee
__ push(callee);
@@ -2812,6 +2809,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;
+ __ ldr(accessor_holder,
+ MemOperand(sp, (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.
__ mov(scratch, sp);
« no previous file with comments | « no previous file | src/arm64/code-stubs-arm64.cc » ('j') | src/ic/x64/handler-compiler-x64.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698