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

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

Issue 371923006: Add mips64 port. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebase Created 6 years, 5 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 | « src/mips64/debug-mips64.cc ('k') | src/mips64/disasm-mips64.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/mips64/deoptimizer-mips64.cc
diff --git a/src/mips/deoptimizer-mips.cc b/src/mips64/deoptimizer-mips64.cc
similarity index 80%
copy from src/mips/deoptimizer-mips.cc
copy to src/mips64/deoptimizer-mips64.cc
index 5723136c84ecbfb52ebe9ccf9200b53f19736ec2..6d9419b3311114eade56006c83220e9a676c6a67 100644
--- a/src/mips/deoptimizer-mips.cc
+++ b/src/mips64/deoptimizer-mips64.cc
@@ -1,4 +1,3 @@
-
// Copyright 2011 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.
@@ -15,7 +14,7 @@ namespace internal {
int Deoptimizer::patch_size() {
- const int kCallInstructionSizeInWords = 4;
+ const int kCallInstructionSizeInWords = 6;
return kCallInstructionSizeInWords * Assembler::kInstrSize;
}
@@ -94,7 +93,7 @@ void Deoptimizer::FillInputFrame(Address tos, JavaScriptFrame* frame) {
// Fill the frame content from the actual data on the frame.
for (unsigned i = 0; i < input_->GetFrameSize(); i += kPointerSize) {
- input_->SetFrameSlot(i, Memory::uint32_at(tos + i));
+ input_->SetFrameSlot(i, Memory::uint64_at(tos + i));
}
}
@@ -144,7 +143,7 @@ void Deoptimizer::EntryGenerator::Generate() {
kDoubleSize * FPURegister::kMaxNumAllocatableRegisters;
// Save all FPU registers before messing with them.
- __ Subu(sp, sp, Operand(kDoubleRegsSize));
+ __ Dsubu(sp, sp, Operand(kDoubleRegsSize));
for (int i = 0; i < FPURegister::kMaxNumAllocatableRegisters; ++i) {
FPURegister fpu_reg = FPURegister::FromAllocationIndex(i);
int offset = i * kDoubleSize;
@@ -153,10 +152,10 @@ void Deoptimizer::EntryGenerator::Generate() {
// Push saved_regs (needed to populate FrameDescription::registers_).
// Leave gaps for other registers.
- __ Subu(sp, sp, kNumberOfRegisters * kPointerSize);
+ __ Dsubu(sp, sp, kNumberOfRegisters * kPointerSize);
for (int16_t i = kNumberOfRegisters - 1; i >= 0; i--) {
if ((saved_regs & (1 << i)) != 0) {
- __ sw(ToRegister(i), MemOperand(sp, kPointerSize * i));
+ __ sd(ToRegister(i), MemOperand(sp, kPointerSize * i));
}
}
@@ -164,27 +163,33 @@ void Deoptimizer::EntryGenerator::Generate() {
(kNumberOfRegisters * kPointerSize) + kDoubleRegsSize;
// Get the bailout id from the stack.
- __ lw(a2, MemOperand(sp, kSavedRegistersAreaSize));
+ __ ld(a2, MemOperand(sp, kSavedRegistersAreaSize));
// Get the address of the location in the code object (a3) (return
// address for lazy deoptimization) and compute the fp-to-sp delta in
- // register t0.
+ // register a4.
__ mov(a3, ra);
// Correct one word for bailout id.
- __ Addu(t0, sp, Operand(kSavedRegistersAreaSize + (1 * kPointerSize)));
+ __ Daddu(a4, sp, Operand(kSavedRegistersAreaSize + (1 * kPointerSize)));
- __ Subu(t0, fp, t0);
+ __ Dsubu(a4, fp, a4);
// Allocate a new deoptimizer object.
- // Pass four arguments in a0 to a3 and fifth & sixth arguments on stack.
- __ PrepareCallCFunction(6, t1);
- __ lw(a0, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
+ __ PrepareCallCFunction(6, a5);
+ // Pass six arguments, according to O32 or n64 ABI. a0..a3 are same for both.
__ li(a1, Operand(type())); // bailout type,
+ __ ld(a0, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
// a2: bailout id already loaded.
// a3: code address or 0 already loaded.
- __ sw(t0, CFunctionArgumentOperand(5)); // Fp-to-sp delta.
- __ li(t1, Operand(ExternalReference::isolate_address(isolate())));
- __ sw(t1, CFunctionArgumentOperand(6)); // Isolate.
+ if (kMipsAbi == kN64) {
+ // a4: already has fp-to-sp delta.
+ __ li(a5, Operand(ExternalReference::isolate_address(isolate())));
+ } else { // O32 abi.
+ // Pass four arguments in a0 to a3 and fifth & sixth arguments on stack.
+ __ sd(a4, CFunctionArgumentOperand(5)); // Fp-to-sp delta.
+ __ li(a5, Operand(ExternalReference::isolate_address(isolate())));
+ __ sd(a5, CFunctionArgumentOperand(6)); // Isolate.
+ }
// Call Deoptimizer::New().
{
AllowExternalCallThatCantCauseGC scope(masm());
@@ -195,18 +200,18 @@ void Deoptimizer::EntryGenerator::Generate() {
// frame descriptor pointer to a1 (deoptimizer->input_);
// Move deopt-obj to a0 for call to Deoptimizer::ComputeOutputFrames() below.
__ mov(a0, v0);
- __ lw(a1, MemOperand(v0, Deoptimizer::input_offset()));
+ __ ld(a1, MemOperand(v0, Deoptimizer::input_offset()));
// Copy core registers into FrameDescription::registers_[kNumRegisters].
ASSERT(Register::kNumRegisters == kNumberOfRegisters);
for (int i = 0; i < kNumberOfRegisters; i++) {
int offset = (i * kPointerSize) + FrameDescription::registers_offset();
if ((saved_regs & (1 << i)) != 0) {
- __ lw(a2, MemOperand(sp, i * kPointerSize));
- __ sw(a2, MemOperand(a1, offset));
+ __ ld(a2, MemOperand(sp, i * kPointerSize));
+ __ sd(a2, MemOperand(a1, offset));
} else if (FLAG_debug_code) {
__ li(a2, kDebugZapValue);
- __ sw(a2, MemOperand(a1, offset));
+ __ sd(a2, MemOperand(a1, offset));
}
}
@@ -221,27 +226,26 @@ void Deoptimizer::EntryGenerator::Generate() {
}
// Remove the bailout id and the saved registers from the stack.
- __ Addu(sp, sp, Operand(kSavedRegistersAreaSize + (1 * kPointerSize)));
+ __ Daddu(sp, sp, Operand(kSavedRegistersAreaSize + (1 * kPointerSize)));
// Compute a pointer to the unwinding limit in register a2; that is
// the first stack slot not part of the input frame.
- __ lw(a2, MemOperand(a1, FrameDescription::frame_size_offset()));
- __ Addu(a2, a2, sp);
+ __ ld(a2, MemOperand(a1, FrameDescription::frame_size_offset()));
+ __ Daddu(a2, a2, sp);
// Unwind the stack down to - but not including - the unwinding
// limit and copy the contents of the activation frame to the input
// frame description.
- __ Addu(a3, a1, Operand(FrameDescription::frame_content_offset()));
+ __ Daddu(a3, a1, Operand(FrameDescription::frame_content_offset()));
Label pop_loop;
Label pop_loop_header;
__ BranchShort(&pop_loop_header);
__ bind(&pop_loop);
- __ pop(t0);
- __ sw(t0, MemOperand(a3, 0));
- __ addiu(a3, a3, sizeof(uint32_t));
+ __ pop(a4);
+ __ sd(a4, MemOperand(a3, 0));
+ __ daddiu(a3, a3, sizeof(uint64_t));
__ bind(&pop_loop_header);
__ BranchShort(&pop_loop, ne, a2, Operand(sp));
-
// Compute the output frame in the deoptimizer.
__ push(a0); // Preserve deoptimizer object across call.
// a0: deoptimizer object; a1: scratch.
@@ -257,31 +261,31 @@ void Deoptimizer::EntryGenerator::Generate() {
// Replace the current (input) frame with the output frames.
Label outer_push_loop, inner_push_loop,
outer_loop_header, inner_loop_header;
- // Outer loop state: t0 = current "FrameDescription** output_",
+ // Outer loop state: a4 = current "FrameDescription** output_",
// a1 = one past the last FrameDescription**.
__ lw(a1, MemOperand(a0, Deoptimizer::output_count_offset()));
- __ lw(t0, MemOperand(a0, Deoptimizer::output_offset())); // t0 is output_.
- __ sll(a1, a1, kPointerSizeLog2); // Count to offset.
- __ addu(a1, t0, a1); // a1 = one past the last FrameDescription**.
+ __ ld(a4, MemOperand(a0, Deoptimizer::output_offset())); // a4 is output_.
+ __ dsll(a1, a1, kPointerSizeLog2); // Count to offset.
+ __ daddu(a1, a4, a1); // a1 = one past the last FrameDescription**.
__ jmp(&outer_loop_header);
__ bind(&outer_push_loop);
// Inner loop state: a2 = current FrameDescription*, a3 = loop index.
- __ lw(a2, MemOperand(t0, 0)); // output_[ix]
- __ lw(a3, MemOperand(a2, FrameDescription::frame_size_offset()));
+ __ ld(a2, MemOperand(a4, 0)); // output_[ix]
+ __ ld(a3, MemOperand(a2, FrameDescription::frame_size_offset()));
__ jmp(&inner_loop_header);
__ bind(&inner_push_loop);
- __ Subu(a3, a3, Operand(sizeof(uint32_t)));
- __ Addu(t2, a2, Operand(a3));
- __ lw(t3, MemOperand(t2, FrameDescription::frame_content_offset()));
- __ push(t3);
+ __ Dsubu(a3, a3, Operand(sizeof(uint64_t)));
+ __ Daddu(a6, a2, Operand(a3));
+ __ ld(a7, MemOperand(a6, FrameDescription::frame_content_offset()));
+ __ push(a7);
__ bind(&inner_loop_header);
__ BranchShort(&inner_push_loop, ne, a3, Operand(zero_reg));
- __ Addu(t0, t0, Operand(kPointerSize));
+ __ Daddu(a4, a4, Operand(kPointerSize));
__ bind(&outer_loop_header);
- __ BranchShort(&outer_push_loop, lt, t0, Operand(a1));
+ __ BranchShort(&outer_push_loop, lt, a4, Operand(a1));
- __ lw(a1, MemOperand(a0, Deoptimizer::input_offset()));
+ __ ld(a1, MemOperand(a0, Deoptimizer::input_offset()));
for (int i = 0; i < FPURegister::kMaxNumAllocatableRegisters; ++i) {
const FPURegister fpu_reg = FPURegister::FromAllocationIndex(i);
int src_offset = i * kDoubleSize + double_regs_offset;
@@ -289,13 +293,13 @@ void Deoptimizer::EntryGenerator::Generate() {
}
// Push state, pc, and continuation from the last output frame.
- __ lw(t2, MemOperand(a2, FrameDescription::state_offset()));
- __ push(t2);
+ __ ld(a6, MemOperand(a2, FrameDescription::state_offset()));
+ __ push(a6);
- __ lw(t2, MemOperand(a2, FrameDescription::pc_offset()));
- __ push(t2);
- __ lw(t2, MemOperand(a2, FrameDescription::continuation_offset()));
- __ push(t2);
+ __ ld(a6, MemOperand(a2, FrameDescription::pc_offset()));
+ __ push(a6);
+ __ ld(a6, MemOperand(a2, FrameDescription::continuation_offset()));
+ __ push(a6);
// Technically restoring 'at' should work unless zero_reg is also restored
@@ -306,7 +310,7 @@ void Deoptimizer::EntryGenerator::Generate() {
for (int i = kNumberOfRegisters - 1; i >= 0; i--) {
int offset = (i * kPointerSize) + FrameDescription::registers_offset();
if ((restored_regs & (1 << i)) != 0) {
- __ lw(ToRegister(i), MemOperand(at, offset));
+ __ ld(ToRegister(i), MemOperand(at, offset));
}
}
@@ -320,7 +324,7 @@ void Deoptimizer::EntryGenerator::Generate() {
// Maximum size of a table entry generated below.
-const int Deoptimizer::table_entry_size_ = 7 * Assembler::kInstrSize;
+const int Deoptimizer::table_entry_size_ = 11 * Assembler::kInstrSize;
void Deoptimizer::TableEntryGenerator::GeneratePrologue() {
Assembler::BlockTrampolinePoolScope block_trampoline_pool(masm());
@@ -332,16 +336,16 @@ void Deoptimizer::TableEntryGenerator::GeneratePrologue() {
for (int i = 0; i < count(); i++) {
Label start;
__ bind(&start);
- __ addiu(sp, sp, -1 * kPointerSize);
+ __ daddiu(sp, sp, -1 * kPointerSize);
// Jump over the remaining deopt entries (including this one).
// This code is always reached by calling Jump, which puts the target (label
// start) into t9.
const int remaining_entries = (count() - i) * table_entry_size_;
- __ Addu(t9, t9, remaining_entries);
+ __ Daddu(t9, t9, remaining_entries);
// 'at' was clobbered so we can only load the current entry value here.
- __ li(at, i);
+ __ li(t8, i);
__ jr(t9); // Expose delay slot.
- __ sw(at, MemOperand(sp, 0 * kPointerSize)); // In the delay slot.
+ __ sd(t8, MemOperand(sp, 0 * kPointerSize)); // In the delay slot.
// Pad the rest of the code.
while (table_entry_size_ > (masm()->SizeOfCodeGeneratedSince(&start))) {
« no previous file with comments | « src/mips64/debug-mips64.cc ('k') | src/mips64/disasm-mips64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698