Index: src/crankshaft/x64/lithium-codegen-x64.cc |
diff --git a/src/crankshaft/x64/lithium-codegen-x64.cc b/src/crankshaft/x64/lithium-codegen-x64.cc |
index 30d47c8da09e2beb3656c8f13e5a9964edf3f95b..c758812b163b785683d6e01e4827732f44814406 100644 |
--- a/src/crankshaft/x64/lithium-codegen-x64.cc |
+++ b/src/crankshaft/x64/lithium-codegen-x64.cc |
@@ -1664,6 +1664,44 @@ |
Register result = ToRegister(instr->result()); |
Register map = ToRegister(instr->value()); |
__ EnumLength(result, map); |
+} |
+ |
+ |
+void LCodeGen::DoDateField(LDateField* instr) { |
+ Register object = ToRegister(instr->date()); |
+ Register result = ToRegister(instr->result()); |
+ Smi* index = instr->index(); |
+ DCHECK(object.is(result)); |
+ DCHECK(object.is(rax)); |
+ |
+ if (FLAG_debug_code) { |
+ __ AssertNotSmi(object); |
+ __ CmpObjectType(object, JS_DATE_TYPE, kScratchRegister); |
+ __ Check(equal, kOperandIsNotADate); |
+ } |
+ |
+ if (index->value() == 0) { |
+ __ movp(result, FieldOperand(object, JSDate::kValueOffset)); |
+ } else { |
+ Label runtime, done; |
+ if (index->value() < JSDate::kFirstUncachedField) { |
+ ExternalReference stamp = ExternalReference::date_cache_stamp(isolate()); |
+ Operand stamp_operand = __ ExternalOperand(stamp); |
+ __ movp(kScratchRegister, stamp_operand); |
+ __ cmpp(kScratchRegister, FieldOperand(object, |
+ JSDate::kCacheStampOffset)); |
+ __ j(not_equal, &runtime, Label::kNear); |
+ __ movp(result, FieldOperand(object, JSDate::kValueOffset + |
+ kPointerSize * index->value())); |
+ __ jmp(&done, Label::kNear); |
+ } |
+ __ bind(&runtime); |
+ __ PrepareCallCFunction(2); |
+ __ movp(arg_reg_1, object); |
+ __ Move(arg_reg_2, index, Assembler::RelocInfoNone()); |
+ __ CallCFunction(ExternalReference::get_date_field_function(isolate()), 2); |
+ __ bind(&done); |
+ } |
} |