// remaining stack slots.
if (FLAG_code_comments) __ RecordComment("-- OSR entrypoint --");
osr_pc_offset_ = __ pc_offset();
+ // TODO(titzer): cannot address target function == local #-1
+ __ ldr(r1, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
DCHECK(stack_slots >= frame()->GetOsrStackSlotCount());
stack_slots -= frame()->GetOsrStackSlotCount();
}
// remaining stack slots.
if (FLAG_code_comments) __ RecordComment("-- OSR entrypoint --");
osr_pc_offset_ = __ pc_offset();
+ // TODO(titzer): cannot address target function == local #-1
+ __ ldr(x1, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
DCHECK(stack_slots >= frame()->GetOsrStackSlotCount());
stack_slots -= frame()->GetOsrStackSlotCount();
}
// remaining stack slots.
if (FLAG_code_comments) __ RecordComment("-- OSR entrypoint --");
osr_pc_offset_ = __ pc_offset();
+ // TODO(titzer): cannot address target function == local #-1
+ __ mov(edi, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset));
DCHECK(stack_slots >= frame()->GetOsrStackSlotCount());
stack_slots -= frame()->GetOsrStackSlotCount();
}
// The target for JS function calls is the JSFunction object.
MachineType target_type = kMachAnyTagged;
- // Unoptimized code doesn't preserve the JSCallFunctionReg, so expect the
- // closure on the stack.
- LinkageLocation target_loc =
- is_osr ? stackloc(Linkage::kJSFunctionCallClosureParamIndex -
- js_parameter_count)
- : regloc(LinkageTraits::JSCallFunctionReg());
+ // TODO(titzer): When entering into an OSR function from unoptimized code,
+ // the JSFunction is not in a register, but it is on the stack in an
+ // unaddressable spill slot. We hack this in the OSR prologue. Fix.
+ LinkageLocation target_loc = regloc(LinkageTraits::JSCallFunctionReg());
return new (zone) CallDescriptor( // --
CallDescriptor::kCallJSFunction, // kind
target_type, // target MachineType
// remaining stack slots.
if (FLAG_code_comments) __ RecordComment("-- OSR entrypoint --");
osr_pc_offset_ = __ pc_offset();
+ // TODO(titzer): cannot address target function == local #-1
+ __ lw(a1, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
DCHECK(stack_slots >= frame()->GetOsrStackSlotCount());
stack_slots -= frame()->GetOsrStackSlotCount();
}
// remaining stack slots.
if (FLAG_code_comments) __ RecordComment("-- OSR entrypoint --");
osr_pc_offset_ = __ pc_offset();
+ // TODO(titzer): cannot address target function == local #-1
+ __ lw(a1, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
DCHECK(stack_slots >= frame()->GetOsrStackSlotCount());
stack_slots -= frame()->GetOsrStackSlotCount();
}
// remaining stack slots.
if (FLAG_code_comments) __ RecordComment("-- OSR entrypoint --");
osr_pc_offset_ = __ pc_offset();
+ // TODO(titzer): cannot address target function == local #-1
+ __ lwa(r4, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
DCHECK(stack_slots >= frame()->GetOsrStackSlotCount());
stack_slots -= frame()->GetOsrStackSlotCount();
}
// remaining stack slots.
if (FLAG_code_comments) __ RecordComment("-- OSR entrypoint --");
osr_pc_offset_ = __ pc_offset();
+ // TODO(titzer): cannot address target function == local #-1
+ __ movq(rdi, Operand(rbp, JavaScriptFrameConstants::kFunctionOffset));
DCHECK(stack_slots >= frame()->GetOsrStackSlotCount());
stack_slots -= frame()->GetOsrStackSlotCount();
}
--- /dev/null
+// 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();
--- /dev/null
+// 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();