Index: src/mips/lithium-codegen-mips.cc |
diff --git a/src/mips/lithium-codegen-mips.cc b/src/mips/lithium-codegen-mips.cc |
index d0531ec71ae7b35f1bb878cdcdb08dc5ae6569dd..607025cbdced12d3b47713418c12aa71d6481ee1 100644 |
--- a/src/mips/lithium-codegen-mips.cc |
+++ b/src/mips/lithium-codegen-mips.cc |
@@ -1261,6 +1261,46 @@ void LCodeGen::DoValueOf(LValueOf* instr) { |
} |
+void LCodeGen::DoDateField(LDateField* instr) { |
+ Register object = ToRegister(instr->InputAt(0)); |
+ Register result = ToRegister(instr->result()); |
+ Register scratch = ToRegister(instr->TempAt(0)); |
+ Smi* index = instr->index(); |
+ Label runtime, done; |
+ ASSERT(object.is(a0)); |
+ ASSERT(result.is(v0)); |
+ ASSERT(!scratch.is(scratch0())); |
+ ASSERT(!scratch.is(object)); |
+ |
+#ifdef DEBUG |
+ __ AbortIfSmi(object); |
+ __ GetObjectType(object, scratch, scratch); |
+ __ Assert(eq, "Trying to get date field from non-date.", |
+ scratch, Operand(JS_DATE_TYPE)); |
+#endif |
+ |
+ if (index->value() == 0) { |
+ __ lw(result, FieldMemOperand(object, JSDate::kValueOffset)); |
+ } else { |
+ if (index->value() < JSDate::kFirstUncachedField) { |
+ ExternalReference stamp = ExternalReference::date_cache_stamp(isolate()); |
+ __ li(scratch, Operand(stamp)); |
+ __ lw(scratch, MemOperand(scratch)); |
+ __ lw(scratch0(), FieldMemOperand(object, JSDate::kCacheStampOffset)); |
+ __ Branch(&runtime, ne, scratch, Operand(scratch0())); |
+ __ lw(result, FieldMemOperand(object, JSDate::kValueOffset + |
+ kPointerSize * index->value())); |
+ __ jmp(&done); |
+ } |
+ __ bind(&runtime); |
+ __ PrepareCallCFunction(2, scratch); |
+ __ li(a1, Operand(index)); |
+ __ CallCFunction(ExternalReference::get_date_field_function(isolate()), 2); |
+ __ bind(&done); |
+ } |
+} |
+ |
+ |
void LCodeGen::DoBitNotI(LBitNotI* instr) { |
Register input = ToRegister(instr->InputAt(0)); |
Register result = ToRegister(instr->result()); |