[turbofan] Fix loading of JSFunction from activation in case of adapter frame.
R=mstarzinger@chromium.org BUG= Review URL: https://codereview.chromium.org/1026023004 Cr-Commit-Position: refs/heads/master@{#27454}
This commit is contained in:
parent
918ec32d7b
commit
ebc5167476
@ -872,6 +872,8 @@ void CodeGenerator::AssemblePrologue() {
|
|||||||
// remaining stack slots.
|
// remaining stack slots.
|
||||||
if (FLAG_code_comments) __ RecordComment("-- OSR entrypoint --");
|
if (FLAG_code_comments) __ RecordComment("-- OSR entrypoint --");
|
||||||
osr_pc_offset_ = __ pc_offset();
|
osr_pc_offset_ = __ pc_offset();
|
||||||
|
// TODO(titzer): cannot address target function == local #-1
|
||||||
|
__ ldr(r1, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
|
||||||
DCHECK(stack_slots >= frame()->GetOsrStackSlotCount());
|
DCHECK(stack_slots >= frame()->GetOsrStackSlotCount());
|
||||||
stack_slots -= frame()->GetOsrStackSlotCount();
|
stack_slots -= frame()->GetOsrStackSlotCount();
|
||||||
}
|
}
|
||||||
|
@ -1001,6 +1001,8 @@ void CodeGenerator::AssemblePrologue() {
|
|||||||
// remaining stack slots.
|
// remaining stack slots.
|
||||||
if (FLAG_code_comments) __ RecordComment("-- OSR entrypoint --");
|
if (FLAG_code_comments) __ RecordComment("-- OSR entrypoint --");
|
||||||
osr_pc_offset_ = __ pc_offset();
|
osr_pc_offset_ = __ pc_offset();
|
||||||
|
// TODO(titzer): cannot address target function == local #-1
|
||||||
|
__ ldr(x1, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
|
||||||
DCHECK(stack_slots >= frame()->GetOsrStackSlotCount());
|
DCHECK(stack_slots >= frame()->GetOsrStackSlotCount());
|
||||||
stack_slots -= frame()->GetOsrStackSlotCount();
|
stack_slots -= frame()->GetOsrStackSlotCount();
|
||||||
}
|
}
|
||||||
|
@ -1091,6 +1091,8 @@ void CodeGenerator::AssemblePrologue() {
|
|||||||
// remaining stack slots.
|
// remaining stack slots.
|
||||||
if (FLAG_code_comments) __ RecordComment("-- OSR entrypoint --");
|
if (FLAG_code_comments) __ RecordComment("-- OSR entrypoint --");
|
||||||
osr_pc_offset_ = __ pc_offset();
|
osr_pc_offset_ = __ pc_offset();
|
||||||
|
// TODO(titzer): cannot address target function == local #-1
|
||||||
|
__ mov(edi, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset));
|
||||||
DCHECK(stack_slots >= frame()->GetOsrStackSlotCount());
|
DCHECK(stack_slots >= frame()->GetOsrStackSlotCount());
|
||||||
stack_slots -= frame()->GetOsrStackSlotCount();
|
stack_slots -= frame()->GetOsrStackSlotCount();
|
||||||
}
|
}
|
||||||
|
@ -57,12 +57,10 @@ class LinkageHelper {
|
|||||||
|
|
||||||
// The target for JS function calls is the JSFunction object.
|
// The target for JS function calls is the JSFunction object.
|
||||||
MachineType target_type = kMachAnyTagged;
|
MachineType target_type = kMachAnyTagged;
|
||||||
// Unoptimized code doesn't preserve the JSCallFunctionReg, so expect the
|
// TODO(titzer): When entering into an OSR function from unoptimized code,
|
||||||
// closure on the stack.
|
// the JSFunction is not in a register, but it is on the stack in an
|
||||||
LinkageLocation target_loc =
|
// unaddressable spill slot. We hack this in the OSR prologue. Fix.
|
||||||
is_osr ? stackloc(Linkage::kJSFunctionCallClosureParamIndex -
|
LinkageLocation target_loc = regloc(LinkageTraits::JSCallFunctionReg());
|
||||||
js_parameter_count)
|
|
||||||
: regloc(LinkageTraits::JSCallFunctionReg());
|
|
||||||
return new (zone) CallDescriptor( // --
|
return new (zone) CallDescriptor( // --
|
||||||
CallDescriptor::kCallJSFunction, // kind
|
CallDescriptor::kCallJSFunction, // kind
|
||||||
target_type, // target MachineType
|
target_type, // target MachineType
|
||||||
|
@ -984,6 +984,8 @@ void CodeGenerator::AssemblePrologue() {
|
|||||||
// remaining stack slots.
|
// remaining stack slots.
|
||||||
if (FLAG_code_comments) __ RecordComment("-- OSR entrypoint --");
|
if (FLAG_code_comments) __ RecordComment("-- OSR entrypoint --");
|
||||||
osr_pc_offset_ = __ pc_offset();
|
osr_pc_offset_ = __ pc_offset();
|
||||||
|
// TODO(titzer): cannot address target function == local #-1
|
||||||
|
__ lw(a1, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
|
||||||
DCHECK(stack_slots >= frame()->GetOsrStackSlotCount());
|
DCHECK(stack_slots >= frame()->GetOsrStackSlotCount());
|
||||||
stack_slots -= frame()->GetOsrStackSlotCount();
|
stack_slots -= frame()->GetOsrStackSlotCount();
|
||||||
}
|
}
|
||||||
|
@ -1050,6 +1050,8 @@ void CodeGenerator::AssemblePrologue() {
|
|||||||
// remaining stack slots.
|
// remaining stack slots.
|
||||||
if (FLAG_code_comments) __ RecordComment("-- OSR entrypoint --");
|
if (FLAG_code_comments) __ RecordComment("-- OSR entrypoint --");
|
||||||
osr_pc_offset_ = __ pc_offset();
|
osr_pc_offset_ = __ pc_offset();
|
||||||
|
// TODO(titzer): cannot address target function == local #-1
|
||||||
|
__ lw(a1, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
|
||||||
DCHECK(stack_slots >= frame()->GetOsrStackSlotCount());
|
DCHECK(stack_slots >= frame()->GetOsrStackSlotCount());
|
||||||
stack_slots -= frame()->GetOsrStackSlotCount();
|
stack_slots -= frame()->GetOsrStackSlotCount();
|
||||||
}
|
}
|
||||||
|
@ -1221,6 +1221,8 @@ void CodeGenerator::AssemblePrologue() {
|
|||||||
// remaining stack slots.
|
// remaining stack slots.
|
||||||
if (FLAG_code_comments) __ RecordComment("-- OSR entrypoint --");
|
if (FLAG_code_comments) __ RecordComment("-- OSR entrypoint --");
|
||||||
osr_pc_offset_ = __ pc_offset();
|
osr_pc_offset_ = __ pc_offset();
|
||||||
|
// TODO(titzer): cannot address target function == local #-1
|
||||||
|
__ lwa(r4, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
|
||||||
DCHECK(stack_slots >= frame()->GetOsrStackSlotCount());
|
DCHECK(stack_slots >= frame()->GetOsrStackSlotCount());
|
||||||
stack_slots -= frame()->GetOsrStackSlotCount();
|
stack_slots -= frame()->GetOsrStackSlotCount();
|
||||||
}
|
}
|
||||||
|
@ -1265,6 +1265,8 @@ void CodeGenerator::AssemblePrologue() {
|
|||||||
// remaining stack slots.
|
// remaining stack slots.
|
||||||
if (FLAG_code_comments) __ RecordComment("-- OSR entrypoint --");
|
if (FLAG_code_comments) __ RecordComment("-- OSR entrypoint --");
|
||||||
osr_pc_offset_ = __ pc_offset();
|
osr_pc_offset_ = __ pc_offset();
|
||||||
|
// TODO(titzer): cannot address target function == local #-1
|
||||||
|
__ movq(rdi, Operand(rbp, JavaScriptFrameConstants::kFunctionOffset));
|
||||||
DCHECK(stack_slots >= frame()->GetOsrStackSlotCount());
|
DCHECK(stack_slots >= frame()->GetOsrStackSlotCount());
|
||||||
stack_slots -= frame()->GetOsrStackSlotCount();
|
stack_slots -= frame()->GetOsrStackSlotCount();
|
||||||
}
|
}
|
||||||
|
56
test/mjsunit/compiler/osr-literals-adapted.js
Normal file
56
test/mjsunit/compiler/osr-literals-adapted.js
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
// Copyright 2015 the V8 project authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
|
// found in the LICENSE file.
|
||||||
|
|
||||||
|
// Flags: --allow-natives-syntax --use-osr --turbo-osr
|
||||||
|
|
||||||
|
function mod() {
|
||||||
|
function f0() {
|
||||||
|
for (var i = 0; i < 3; i = i + 1 | 0) {
|
||||||
|
%OptimizeOsr();
|
||||||
|
}
|
||||||
|
return {blah: i};
|
||||||
|
}
|
||||||
|
|
||||||
|
function f1(a) {
|
||||||
|
for (var i = 0; i < 3; i = i + 1 | 0) {
|
||||||
|
%OptimizeOsr();
|
||||||
|
}
|
||||||
|
return {blah: i};
|
||||||
|
}
|
||||||
|
|
||||||
|
function f2(a,b) {
|
||||||
|
for (var i = 0; i < 3; i = i + 1 | 0) {
|
||||||
|
%OptimizeOsr();
|
||||||
|
}
|
||||||
|
return {blah: i};
|
||||||
|
}
|
||||||
|
|
||||||
|
function f3(a,b,c) {
|
||||||
|
for (var i = 0; i < 3; i = i + 1 | 0) {
|
||||||
|
%OptimizeOsr();
|
||||||
|
}
|
||||||
|
return {blah: i};
|
||||||
|
}
|
||||||
|
|
||||||
|
function f4(a,b,c,d) {
|
||||||
|
for (var i = 0; i < 3; i = i + 1 | 0) {
|
||||||
|
%OptimizeOsr();
|
||||||
|
}
|
||||||
|
return {blah: i};
|
||||||
|
}
|
||||||
|
|
||||||
|
function bar() {
|
||||||
|
assertEquals(3, f0().blah);
|
||||||
|
assertEquals(3, f1().blah);
|
||||||
|
assertEquals(3, f2().blah);
|
||||||
|
assertEquals(3, f3().blah);
|
||||||
|
assertEquals(3, f4().blah);
|
||||||
|
}
|
||||||
|
bar();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
mod();
|
||||||
|
mod();
|
||||||
|
mod();
|
56
test/mjsunit/compiler/osr-literals.js
Normal file
56
test/mjsunit/compiler/osr-literals.js
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
// Copyright 2015 the V8 project authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
|
// found in the LICENSE file.
|
||||||
|
|
||||||
|
// Flags: --allow-natives-syntax --use-osr --turbo-osr
|
||||||
|
|
||||||
|
function mod() {
|
||||||
|
function f0() {
|
||||||
|
for (var i = 0; i < 3; i = i + 1 | 0) {
|
||||||
|
%OptimizeOsr();
|
||||||
|
}
|
||||||
|
return {blah: i};
|
||||||
|
}
|
||||||
|
|
||||||
|
function f1(a) {
|
||||||
|
for (var i = 0; i < 3; i = i + 1 | 0) {
|
||||||
|
%OptimizeOsr();
|
||||||
|
}
|
||||||
|
return {blah: i};
|
||||||
|
}
|
||||||
|
|
||||||
|
function f2(a,b) {
|
||||||
|
for (var i = 0; i < 3; i = i + 1 | 0) {
|
||||||
|
%OptimizeOsr();
|
||||||
|
}
|
||||||
|
return {blah: i};
|
||||||
|
}
|
||||||
|
|
||||||
|
function f3(a,b,c) {
|
||||||
|
for (var i = 0; i < 3; i = i + 1 | 0) {
|
||||||
|
%OptimizeOsr();
|
||||||
|
}
|
||||||
|
return {blah: i};
|
||||||
|
}
|
||||||
|
|
||||||
|
function f4(a,b,c,d) {
|
||||||
|
for (var i = 0; i < 3; i = i + 1 | 0) {
|
||||||
|
%OptimizeOsr();
|
||||||
|
}
|
||||||
|
return {blah: i};
|
||||||
|
}
|
||||||
|
|
||||||
|
function bar() {
|
||||||
|
assertEquals(3, f0().blah);
|
||||||
|
assertEquals(3, f1(1).blah);
|
||||||
|
assertEquals(3, f2(1,2).blah);
|
||||||
|
assertEquals(3, f3(1,2,3).blah);
|
||||||
|
assertEquals(3, f4(1,2,3,4).blah);
|
||||||
|
}
|
||||||
|
bar();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
mod();
|
||||||
|
mod();
|
||||||
|
mod();
|
Loading…
Reference in New Issue
Block a user