Commit 457de263 authored by jarin@chromium.org's avatar jarin@chromium.org

Fix arm64 deoptimization from double registers (reverts r20613).

This reverts "ARM64: Use pair memory access in deoptimizer entry", r20613. It does not really make sense to micro-optimize the deoptimizer as it is the ultra-slow path. Moreover, the original code was easier to read (in addition to being correct).

BUG=391313
LOG=N
R=ulan@chromium.org

Review URL: https://codereview.chromium.org/389583003

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@22360 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 18961d7c
......@@ -110,42 +110,6 @@ void Deoptimizer::CopyDoubleRegisters(FrameDescription* output_frame) {
}
#define __ masm->
static void CopyRegisterDumpToFrame(MacroAssembler* masm,
Register frame,
CPURegList reg_list,
Register scratch1,
Register scratch2,
int src_offset,
int dst_offset) {
int offset0, offset1;
CPURegList copy_to_input = reg_list;
int reg_count = reg_list.Count();
int reg_size = reg_list.RegisterSizeInBytes();
for (int i = 0; i < (reg_count / 2); i++) {
__ PeekPair(scratch1, scratch2, src_offset + (i * reg_size * 2));
offset0 = (copy_to_input.PopLowestIndex().code() * reg_size) + dst_offset;
offset1 = (copy_to_input.PopLowestIndex().code() * reg_size) + dst_offset;
if ((offset0 + reg_size) == offset1) {
// Registers are adjacent: store in pairs.
__ Stp(scratch1, scratch2, MemOperand(frame, offset0));
} else {
// Registers are not adjacent: store individually.
__ Str(scratch1, MemOperand(frame, offset0));
__ Str(scratch2, MemOperand(frame, offset1));
}
}
if ((reg_count & 1) != 0) {
__ Peek(scratch1, src_offset + (reg_count - 1) * reg_size);
offset0 = (copy_to_input.PopLowestIndex().code() * reg_size) + dst_offset;
__ Str(scratch1, MemOperand(frame, offset0));
}
}
#undef __
#define __ masm()->
......@@ -209,13 +173,23 @@ void Deoptimizer::EntryGenerator::Generate() {
__ Ldr(x1, MemOperand(deoptimizer, Deoptimizer::input_offset()));
// Copy core registers into the input frame.
CopyRegisterDumpToFrame(masm(), x1, saved_registers, x2, x4, 0,
FrameDescription::registers_offset());
CPURegList copy_to_input = saved_registers;
for (int i = 0; i < saved_registers.Count(); i++) {
__ Peek(x2, i * kPointerSize);
CPURegister current_reg = copy_to_input.PopLowestIndex();
int offset = (current_reg.code() * kPointerSize) +
FrameDescription::registers_offset();
__ Str(x2, MemOperand(x1, offset));
}
// Copy FP registers to the input frame.
CopyRegisterDumpToFrame(masm(), x1, saved_fp_registers, x2, x4,
kFPRegistersOffset,
FrameDescription::double_registers_offset());
for (int i = 0; i < saved_fp_registers.Count(); i++) {
int dst_offset = FrameDescription::double_registers_offset() +
(i * kDoubleSize);
int src_offset = kFPRegistersOffset + (i * kDoubleSize);
__ Peek(x2, src_offset);
__ Str(x2, MemOperand(x1, dst_offset));
}
// Remove the bailout id and the saved registers from the stack.
__ Drop(1 + (kSavedRegistersAreaSize / kXRegSize));
......
// Copyright 2014 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
var g = 0;
function f(x, deopt) {
var a0 = x;
var a1 = 2 * x;
var a2 = 3 * x;
var a3 = 4 * x;
var a4 = 5 * x;
var a5 = 6 * x;
var a6 = 7 * x;
var a7 = 8 * x;
var a8 = 9 * x;
var a9 = 10 * x;
var a10 = 11 * x;
var a11 = 12 * x;
var a12 = 13 * x;
var a13 = 14 * x;
var a14 = 15 * x;
var a15 = 16 * x;
var a16 = 17 * x;
var a17 = 18 * x;
var a18 = 19 * x;
var a19 = 20 * x;
g = 1;
deopt + 0;
return a0 + a1 + a2 + a3 + a4 + a5 + a6 + a7 + a8 + a9 +
a10 + a11 + a12 + a13 + a14 + a15 + a16 + a17 + a18 + a19;
}
f(0.5, 0);
f(0.5, 0);
%OptimizeFunctionOnNextCall(f);
print(f(0.5, ""));
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment