Index: src/full-codegen/x87/full-codegen-x87.cc |
diff --git a/src/full-codegen/x87/full-codegen-x87.cc b/src/full-codegen/x87/full-codegen-x87.cc |
index b1576a5d2c2c8c7194e55eb0a9552432a40aad9c..47ca6346d61cf44328e8b057c27e51fc6ccf47f8 100644 |
--- a/src/full-codegen/x87/full-codegen-x87.cc |
+++ b/src/full-codegen/x87/full-codegen-x87.cc |
@@ -3299,6 +3299,43 @@ |
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 = eax; |
+ Register result = eax; |
+ Register scratch = ecx; |
+ |
+ if (index->value() == 0) { |
+ __ mov(result, FieldOperand(object, JSDate::kValueOffset)); |
+ } else { |
+ Label runtime, done; |
+ if (index->value() < JSDate::kFirstUncachedField) { |
+ ExternalReference stamp = ExternalReference::date_cache_stamp(isolate()); |
+ __ mov(scratch, Operand::StaticVariable(stamp)); |
+ __ cmp(scratch, FieldOperand(object, JSDate::kCacheStampOffset)); |
+ __ j(not_equal, &runtime, Label::kNear); |
+ __ mov(result, FieldOperand(object, JSDate::kValueOffset + |
+ kPointerSize * index->value())); |
+ __ jmp(&done, Label::kNear); |
+ } |
+ __ bind(&runtime); |
+ __ PrepareCallCFunction(2, scratch); |
+ __ mov(Operand(esp, 0), object); |
+ __ mov(Operand(esp, 1 * kPointerSize), Immediate(index)); |
+ __ CallCFunction(ExternalReference::get_date_field_function(isolate()), 2); |
+ __ bind(&done); |
+ } |
+ |
+ context()->Plug(result); |
} |