| Index: src/x64/full-codegen-x64.cc
|
| diff --git a/src/x64/full-codegen-x64.cc b/src/x64/full-codegen-x64.cc
|
| index a9bf9a80e717e1e91ff94a20ea84190653dadd61..ff0eb67e9ee48aae97cfa80f13adce46b2b6b5c6 100644
|
| --- a/src/x64/full-codegen-x64.cc
|
| +++ b/src/x64/full-codegen-x64.cc
|
| @@ -2821,6 +2821,54 @@ 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 = rax;
|
| + Register result = rax;
|
| + Register scratch = rcx;
|
| +
|
| +#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) {
|
| + __ movq(result, FieldOperand(object, JSDate::kValueOffset));
|
| + } else {
|
| + if (index->value() < JSDate::kFirstUncachedField) {
|
| + ExternalReference stamp = ExternalReference::date_cache_stamp(isolate());
|
| + __ movq(scratch, stamp);
|
| + __ cmpq(scratch, FieldOperand(object, JSDate::kCacheStampOffset));
|
| + __ j(not_equal, &runtime, Label::kNear);
|
| + __ movq(result, FieldOperand(object, JSDate::kValueOffset +
|
| + kPointerSize * index->value()));
|
| + __ jmp(&done);
|
| + }
|
| + __ bind(&runtime);
|
| + __ PrepareCallCFunction(2);
|
| +#ifdef _WIN64
|
| + __ movq(rcx, object);
|
| + __ movq(rdx, index, RelocInfo::NONE);
|
| +#else
|
| + __ movq(rdi, object);
|
| + __ movq(rsi, index, RelocInfo::NONE);
|
| +#endif
|
| + __ CallCFunction(ExternalReference::get_date_field_function(isolate()), 2);
|
| + __ movq(rsi, Operand(rbp, StandardFrameConstants::kContextOffset));
|
| + __ bind(&done);
|
| + }
|
| + context()->Plug(rax);
|
| +}
|
| +
|
| +
|
| void FullCodeGenerator::EmitMathPow(CallRuntime* expr) {
|
| // Load the arguments on the stack and call the runtime function.
|
| ZoneList<Expression*>* args = expr->arguments();
|
|
|