| Index: src/ia32/full-codegen-ia32.cc
|
| diff --git a/src/ia32/full-codegen-ia32.cc b/src/ia32/full-codegen-ia32.cc
|
| index 0b7c7fd451fdc1bdf2dd31ee91b13308f8f8ec9d..9bd55d72e04ee33effa5033e60f5b76206a74f42 100644
|
| --- a/src/ia32/full-codegen-ia32.cc
|
| +++ b/src/ia32/full-codegen-ia32.cc
|
| @@ -2948,6 +2948,48 @@ void FullCodeGenerator::EmitValueOf(CallRuntime* expr) {
|
| }
|
|
|
|
|
| +void FullCodeGenerator::EmitDateField(CallRuntime* expr) {
|
| + ZoneList<Expression*>* args = expr->arguments();
|
| + ASSERT(args->length() == 2);
|
| + ASSERT_NE(NULL, args->at(1)->AsLiteral());
|
| + Smi* index = Smi::cast(*(args->at(1)->AsLiteral()->handle()));
|
| +
|
| + VisitForAccumulatorValue(args->at(0)); // Load the object.
|
| +
|
| + Label runtime, done;
|
| + Register object = eax;
|
| + Register result = eax;
|
| + Register scratch = ecx;
|
| +
|
| +#ifdef DEBUG
|
| + __ AbortIfSmi(object);
|
| + __ CmpObjectType(object, JS_DATE_TYPE, scratch);
|
| + __ Assert(equal, "Trying to get date field from non-date.");
|
| +#endif
|
| +
|
| + if (index->value() == 0) {
|
| + __ mov(result, FieldOperand(object, JSDate::kValueOffset));
|
| + } else {
|
| + 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);
|
| + }
|
| + __ 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);
|
| +}
|
| +
|
| +
|
| void FullCodeGenerator::EmitMathPow(CallRuntime* expr) {
|
| // Load the arguments on the stack and call the runtime function.
|
| ZoneList<Expression*>* args = expr->arguments();
|
|
|