Index: src/full-codegen/ia32/full-codegen-ia32.cc |
diff --git a/src/full-codegen/ia32/full-codegen-ia32.cc b/src/full-codegen/ia32/full-codegen-ia32.cc |
index cab5d16a0e4e50b113fe192c8ede5148f6aa9350..875dae998e7e418ea052dbd0f3f2c450e08ee694 100644 |
--- a/src/full-codegen/ia32/full-codegen-ia32.cc |
+++ b/src/full-codegen/ia32/full-codegen-ia32.cc |
@@ -3307,6 +3307,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); |
} |