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

Unified Diff: src/mips/macro-assembler-mips.cc

Issue 9372063: MIPS: Enable serialization for MIPS architecture. (Closed)
Patch Set: rebased on r10858. Created 8 years, 10 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
Index: src/mips/macro-assembler-mips.cc
diff --git a/src/mips/macro-assembler-mips.cc b/src/mips/macro-assembler-mips.cc
index 7a733bca5b45ba67516b78ac8137e5b7f2be4820..dbf1937361b91f2fae5cd0c9a93b72579c0eadf4 100644
--- a/src/mips/macro-assembler-mips.cc
+++ b/src/mips/macro-assembler-mips.cc
@@ -759,12 +759,25 @@ void MacroAssembler::Ror(Register rd, Register rs, const Operand& rt) {
}
+static const int kInvalidRootIndex = -1;
+
+int MacroAssembler::FindRootIndex(Object* heap_object) {
+ Heap* heap = HEAP;
+ if (heap->InNewSpace(heap_object)) return kInvalidRootIndex;
+ for (int i = 0; i < Heap::kRootListLength; i++) {
+ Object* root = heap->roots_array_start()[i];
+ if (!root->IsSmi() && root == heap_object) return i;
+ }
+ return kInvalidRootIndex;
+}
+
+
//------------Pseudo-instructions-------------
-void MacroAssembler::li(Register rd, Operand j, bool gen2instr) {
+void MacroAssembler::li(Register rd, Operand j, LiFlags mode) {
ASSERT(!j.is_reg());
BlockTrampolinePoolScope block_trampoline_pool(this);
- if (!MustUseReg(j.rmode_) && !gen2instr) {
+ if (!MustUseReg(j.rmode_) && mode == OPTIMIZE_SIZE) {
// Normal load of an immediate value which does not need Relocation Info.
if (is_int16(j.imm32_)) {
addiu(rd, zero_reg, j.imm32_);
@@ -776,7 +789,20 @@ void MacroAssembler::li(Register rd, Operand j, bool gen2instr) {
lui(rd, (j.imm32_ >> kLuiShift) & kImm16Mask);
ori(rd, rd, (j.imm32_ & kImm16Mask));
}
- } else if (MustUseReg(j.rmode_) || gen2instr) {
+ } else if (can_use_relative_load(j.rmode_) && mode == OPTIMIZE_SIZE) {
+ int32_t index = FindRootIndex(*(reinterpret_cast<Object**>(j.imm32_)));
Erik Corry 2012/02/29 14:38:13 This will be too slow. I suggest you make it into
kalmard 2012/03/12 12:40:00 The FindRootIndex() lookup only happens at seriali
Erik Corry 2012/03/17 02:49:18 In that case you should assert that the Serializer
+ if (index != kInvalidRootIndex) {
+ // Replace lui/ori pair for references that are found in root array with
+ // relative load using LoadRoot with no relocation info.
+ LoadRoot(rd, static_cast<Heap::RootListIndex>(index));
+ } else {
+ if (MustUseReg(j.rmode_)) {
+ RecordRelocInfo(j.rmode_, j.imm32_);
+ }
+ lui(rd, (j.imm32_ >> kLuiShift) & kImm16Mask);
+ ori(rd, rd, (j.imm32_ & kImm16Mask));
+ }
+ } else {
if (MustUseReg(j.rmode_)) {
RecordRelocInfo(j.rmode_, j.imm32_);
}
@@ -2384,7 +2410,7 @@ void MacroAssembler::Call(Address target,
// Must record previous source positions before the
// li() generates a new code target.
positions_recorder()->WriteRecordedPositions();
- li(t9, Operand(target_int, rmode), true);
+ li(t9, Operand(target_int, rmode), CONSTANT_SIZE);
Call(t9, cond, rs, rt, bd);
ASSERT_EQ(CallSize(target, rmode, cond, rs, rt, bd),
SizeOfCodeGeneratedSince(&start));
@@ -2593,7 +2619,7 @@ void MacroAssembler::PushTryHandler(StackHandler::Kind kind,
unsigned state =
StackHandler::IndexField::encode(handler_index) |
StackHandler::KindField::encode(kind);
- li(t1, Operand(CodeObject()));
+ li(t1, Operand(CodeObject()), CONSTANT_SIZE);
li(t2, Operand(state));
// Push the frame pointer, context, state, and code object.
@@ -4325,7 +4351,7 @@ void MacroAssembler::LoadGlobalFunctionInitialMap(Register function,
void MacroAssembler::EnterFrame(StackFrame::Type type) {
addiu(sp, sp, -5 * kPointerSize);
li(t8, Operand(Smi::FromInt(type)));
- li(t9, Operand(CodeObject()));
+ li(t9, Operand(CodeObject()), CONSTANT_SIZE);
sw(ra, MemOperand(sp, 4 * kPointerSize));
sw(fp, MemOperand(sp, 3 * kPointerSize));
sw(cp, MemOperand(sp, 2 * kPointerSize));
@@ -4369,7 +4395,8 @@ void MacroAssembler::EnterExitFrame(bool save_doubles,
sw(zero_reg, MemOperand(fp, ExitFrameConstants::kSPOffset));
}
- li(t8, Operand(CodeObject())); // Accessed from ExitFrame::code_slot.
+ // Accessed from ExitFrame::code_slot.
+ li(t8, Operand(CodeObject()), CONSTANT_SIZE);
sw(t8, MemOperand(fp, ExitFrameConstants::kCodeOffset));
// Save the frame pointer and the context in top.

Powered by Google App Engine
This is Rietveld 408576698