| Index: src/x64/builtins-x64.cc
|
| diff --git a/src/x64/builtins-x64.cc b/src/x64/builtins-x64.cc
|
| index 9fcbe2dcab00f68c4cfbfe669c32745267925bca..6d8e9bcc0f63cc843e92c40df33cae85549a2381 100644
|
| --- a/src/x64/builtins-x64.cc
|
| +++ b/src/x64/builtins-x64.cc
|
| @@ -1052,6 +1052,58 @@ void Builtins::Generate_NotifyLazyDeoptimized(MacroAssembler* masm) {
|
| }
|
|
|
|
|
| +// static
|
| +void Builtins::Generate_DatePrototype_GetField(MacroAssembler* masm,
|
| + int field_index) {
|
| + // ----------- S t a t e -------------
|
| + // -- rsp[0] : return address
|
| + // -- rsp[8] : receiver
|
| + // -----------------------------------
|
| +
|
| + // 1. Load receiver into rax and check that it's actually a JSDate object.
|
| + Label receiver_not_date;
|
| + {
|
| + StackArgumentsAccessor args(rsp, 0);
|
| + __ movp(rax, args.GetReceiverOperand());
|
| + __ JumpIfSmi(rax, &receiver_not_date);
|
| + __ CmpObjectType(rax, JS_DATE_TYPE, rbx);
|
| + __ j(not_equal, &receiver_not_date);
|
| + }
|
| +
|
| + // 2. Load the specified date field, falling back to the runtime as necessary.
|
| + if (field_index == JSDate::kDateValue) {
|
| + __ movp(rax, FieldOperand(rax, JSDate::kValueOffset));
|
| + } else {
|
| + if (field_index < JSDate::kFirstUncachedField) {
|
| + Label stamp_mismatch;
|
| + __ Load(rdx, ExternalReference::date_cache_stamp(masm->isolate()));
|
| + __ cmpp(rdx, FieldOperand(rax, JSDate::kCacheStampOffset));
|
| + __ j(not_equal, &stamp_mismatch, Label::kNear);
|
| + __ movp(rax, FieldOperand(
|
| + rax, JSDate::kValueOffset + field_index * kPointerSize));
|
| + __ ret(1 * kPointerSize);
|
| + __ bind(&stamp_mismatch);
|
| + }
|
| + FrameScope scope(masm, StackFrame::INTERNAL);
|
| + __ PrepareCallCFunction(2);
|
| + __ Move(arg_reg_1, rax);
|
| + __ Move(arg_reg_2, Smi::FromInt(field_index));
|
| + __ CallCFunction(
|
| + ExternalReference::get_date_field_function(masm->isolate()), 2);
|
| + }
|
| + __ ret(1 * kPointerSize);
|
| +
|
| + // 3. Raise a TypeError if the receiver is not a date.
|
| + __ bind(&receiver_not_date);
|
| + {
|
| + FrameScope scope(masm, StackFrame::MANUAL);
|
| + __ EnterFrame(StackFrame::INTERNAL);
|
| + __ CallRuntime(Runtime::kThrowNotDateError);
|
| + }
|
| +}
|
| +
|
| +
|
| +// static
|
| void Builtins::Generate_FunctionPrototypeApply(MacroAssembler* masm) {
|
| // ----------- S t a t e -------------
|
| // -- rax : argc
|
|
|