Index: src/arm/lithium-codegen-arm.cc |
diff --git a/src/arm/lithium-codegen-arm.cc b/src/arm/lithium-codegen-arm.cc |
index 630ae8dbd9c02139b453fae086d30a89607b1210..e4c9bbcfcc9881fa745655de863bddc4da98ac30 100644 |
--- a/src/arm/lithium-codegen-arm.cc |
+++ b/src/arm/lithium-codegen-arm.cc |
@@ -1438,6 +1438,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(result)); |
+ ASSERT(object.is(r0)); |
+ ASSERT(!scratch.is(scratch0())); |
+ ASSERT(!scratch.is(object)); |
+ |
+#ifdef DEBUG |
+ __ AbortIfSmi(object); |
+ __ CompareObjectType(object, scratch, scratch, JS_DATE_TYPE); |
+ __ Assert(eq, "Trying to get date field from non-date."); |
+#endif |
+ |
+ if (index->value() == 0) { |
+ __ ldr(result, FieldMemOperand(object, JSDate::kValueOffset)); |
+ } else { |
+ if (index->value() < JSDate::kFirstUncachedField) { |
+ ExternalReference stamp = ExternalReference::date_cache_stamp(isolate()); |
+ __ mov(scratch, Operand(stamp)); |
+ __ ldr(scratch, MemOperand(scratch)); |
+ __ ldr(scratch0(), FieldMemOperand(object, JSDate::kCacheStampOffset)); |
+ __ cmp(scratch, scratch0()); |
+ __ b(ne, &runtime); |
+ __ ldr(result, FieldMemOperand(object, JSDate::kValueOffset + |
+ kPointerSize * index->value())); |
+ __ jmp(&done); |
+ } |
+ __ bind(&runtime); |
+ __ PrepareCallCFunction(2, scratch); |
+ __ mov(r1, 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()); |