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

Unified Diff: src/arm/deoptimizer-arm.cc

Issue 11428137: ARM: Make use of d16-d31 when available. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Get the feature detection right Created 8 years 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
Index: src/arm/deoptimizer-arm.cc
diff --git a/src/arm/deoptimizer-arm.cc b/src/arm/deoptimizer-arm.cc
index ee2a581a57dcb443e22f1395dab540afa6e3927b..320c6f4d93c0d34e5a3821e972eb600d56dfab45 100644
--- a/src/arm/deoptimizer-arm.cc
+++ b/src/arm/deoptimizer-arm.cc
@@ -878,7 +878,7 @@ void Deoptimizer::FillInputFrame(Address tos, JavaScriptFrame* frame) {
}
input_->SetRegister(sp.code(), reinterpret_cast<intptr_t>(frame->sp()));
input_->SetRegister(fp.code(), reinterpret_cast<intptr_t>(frame->fp()));
- for (int i = 0; i < DoubleRegister::kNumAllocatableRegisters; i++) {
+ for (int i = 0; i < DoubleRegister::NumAllocatableRegisters(); i++) {
input_->SetDoubleRegister(i, 0.0);
}
@@ -906,23 +906,33 @@ void Deoptimizer::EntryGenerator::Generate() {
RegList restored_regs = kJSCallerSaved | kCalleeSaved | ip.bit();
const int kDoubleRegsSize =
- kDoubleSize * DwVfpRegister::kNumAllocatableRegisters;
+ kDoubleSize * DwVfpRegister::NumAllocatableRegisters();
// Save all VFP registers before messing with them.
+ ASSERT(!Serializer::enabled()); // Nbr of d-regs not known at snapshot time.
DwVfpRegister first = DwVfpRegister::FromAllocationIndex(0);
- DwVfpRegister last =
- DwVfpRegister::FromAllocationIndex(
- DwVfpRegister::kNumAllocatableRegisters - 1);
+ DwVfpRegister last = DwVfpRegister::FromAllocationIndex(
+ DwVfpRegister::NumAllocatableRegisters() - 1);
ASSERT(last.code() > first.code());
- ASSERT((last.code() - first.code()) ==
- (DwVfpRegister::kNumAllocatableRegisters - 1));
#ifdef DEBUG
- for (int i = 0; i <= (DwVfpRegister::kNumAllocatableRegisters - 1); i++) {
+ for (int i = 0; i <= (DwVfpRegister::NumAllocatableRegisters() - 1); i++) {
ASSERT((DwVfpRegister::FromAllocationIndex(i).code() <= last.code()) &&
(DwVfpRegister::FromAllocationIndex(i).code() >= first.code()));
}
#endif
- __ vstm(db_w, sp, first, last);
+ if (last.code() > kScratchDoubleReg.code()) {
+ // This happens when we also have d16-d31 available.
+ // Store the registers < ZeroReg and > ScratchReg separately.
+ ASSERT(kScratchDoubleReg.code() == kDoubleRegZero.code() + 1);
+ __ vstm(db_w, sp, DwVfpRegister::from_code(
+ kScratchDoubleReg.code() + 1), last);
+ __ vstm(db_w, sp, first, DwVfpRegister::from_code(
+ kDoubleRegZero.code() - 1));
+ } else {
+ ASSERT(last.code() - first.code() ==
+ DwVfpRegister::NumAllocatableRegisters() - 1);
+ __ vstm(db_w, sp, first, last);
+ }
// Push all 16 registers (needed to populate FrameDescription::registers_).
// TODO(1588) Note that using pc with stm is deprecated, so we should perhaps
@@ -984,7 +994,7 @@ void Deoptimizer::EntryGenerator::Generate() {
// Copy VFP registers to
// double_registers_[DoubleRegister::kNumAllocatableRegisters]
int double_regs_offset = FrameDescription::double_registers_offset();
- for (int i = 0; i < DwVfpRegister::kNumAllocatableRegisters; ++i) {
+ for (int i = 0; i < DwVfpRegister::NumAllocatableRegisters(); ++i) {
int dst_offset = i * kDoubleSize + double_regs_offset;
int src_offset = i * kDoubleSize + kNumberOfRegisters * kPointerSize;
__ vldr(d0, sp, src_offset);
@@ -1028,6 +1038,11 @@ void Deoptimizer::EntryGenerator::Generate() {
}
__ pop(r0); // Restore deoptimizer object (class Deoptimizer).
+ // TODO(hans): Change the code below to not clobber r0, so that it can be
+ // used in the "restore the d registers" code further down, making this mov
+ // redundant.
+ __ mov(r4, r0);
+
// Replace the current (input) frame with the output frames.
Label outer_push_loop, inner_push_loop;
// Outer loop state: r0 = current "FrameDescription** output_",
@@ -1050,6 +1065,16 @@ void Deoptimizer::EntryGenerator::Generate() {
__ cmp(r0, r1);
__ b(lt, &outer_push_loop);
+ // In case of OSR, we have to restore the d registers.
+ if (type() == OSR) {
+ __ ldr(r1, MemOperand(r4, Deoptimizer::input_offset()));
+ for (int i = 0; i < DwVfpRegister::NumAllocatableRegisters(); ++i) {
+ DwVfpRegister reg = DwVfpRegister::FromAllocationIndex(i);
+ int src_offset = double_regs_offset + i * kDoubleSize;
+ __ vldr(reg, r1, src_offset);
+ }
+ }
+
// Push state, pc, and continuation from the last output frame.
if (type() != OSR) {
__ ldr(r6, MemOperand(r2, FrameDescription::state_offset()));

Powered by Google App Engine
This is Rietveld 408576698