Index: src/full-codegen/x64/full-codegen-x64.cc |
diff --git a/src/full-codegen/x64/full-codegen-x64.cc b/src/full-codegen/x64/full-codegen-x64.cc |
index 2fdd482b30b4dc5161c5c563b5c662a45df7278f..fb1c30b7b026bacb0b6a0f277fdbb30d42b7e699 100644 |
--- a/src/full-codegen/x64/full-codegen-x64.cc |
+++ b/src/full-codegen/x64/full-codegen-x64.cc |
@@ -3295,6 +3295,49 @@ |
Split(equal, if_true, if_false, fall_through); |
context()->Plug(if_true, if_false); |
+} |
+ |
+ |
+void FullCodeGenerator::EmitDateField(CallRuntime* expr) { |
+ ZoneList<Expression*>* args = expr->arguments(); |
+ DCHECK(args->length() == 2); |
+ DCHECK_NOT_NULL(args->at(1)->AsLiteral()); |
+ Smi* index = Smi::cast(*(args->at(1)->AsLiteral()->value())); |
+ |
+ VisitForAccumulatorValue(args->at(0)); // Load the object. |
+ |
+ Register object = rax; |
+ Register result = rax; |
+ Register scratch = rcx; |
+ |
+ if (FLAG_debug_code) { |
+ __ AssertNotSmi(object); |
+ __ CmpObjectType(object, JS_DATE_TYPE, scratch); |
+ __ Check(equal, kOperandIsNotADate); |
+ } |
+ |
+ if (index->value() == 0) { |
+ __ movp(result, FieldOperand(object, JSDate::kValueOffset)); |
+ } else { |
+ Label runtime, done; |
+ if (index->value() < JSDate::kFirstUncachedField) { |
+ __ Load(scratch, ExternalReference::date_cache_stamp(isolate())); |
+ __ cmpp(scratch, 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); |
+ __ movp(rsi, Operand(rbp, StandardFrameConstants::kContextOffset)); |
+ __ bind(&done); |
+ } |
+ |
+ context()->Plug(rax); |
} |