OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #if V8_TARGET_ARCH_X64 | 5 #if V8_TARGET_ARCH_X64 |
6 | 6 |
7 #include "src/code-factory.h" | 7 #include "src/code-factory.h" |
8 #include "src/codegen.h" | 8 #include "src/codegen.h" |
9 #include "src/deoptimizer.h" | 9 #include "src/deoptimizer.h" |
10 #include "src/full-codegen/full-codegen.h" | 10 #include "src/full-codegen/full-codegen.h" |
(...skipping 1034 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1045 void Builtins::Generate_NotifySoftDeoptimized(MacroAssembler* masm) { | 1045 void Builtins::Generate_NotifySoftDeoptimized(MacroAssembler* masm) { |
1046 Generate_NotifyDeoptimizedHelper(masm, Deoptimizer::SOFT); | 1046 Generate_NotifyDeoptimizedHelper(masm, Deoptimizer::SOFT); |
1047 } | 1047 } |
1048 | 1048 |
1049 | 1049 |
1050 void Builtins::Generate_NotifyLazyDeoptimized(MacroAssembler* masm) { | 1050 void Builtins::Generate_NotifyLazyDeoptimized(MacroAssembler* masm) { |
1051 Generate_NotifyDeoptimizedHelper(masm, Deoptimizer::LAZY); | 1051 Generate_NotifyDeoptimizedHelper(masm, Deoptimizer::LAZY); |
1052 } | 1052 } |
1053 | 1053 |
1054 | 1054 |
| 1055 // static |
| 1056 void Builtins::Generate_DatePrototype_GetField(MacroAssembler* masm, |
| 1057 int field_index) { |
| 1058 // ----------- S t a t e ------------- |
| 1059 // -- rsp[0] : return address |
| 1060 // -- rsp[8] : receiver |
| 1061 // ----------------------------------- |
| 1062 |
| 1063 // 1. Load receiver into rax and check that it's actually a JSDate object. |
| 1064 Label receiver_not_date; |
| 1065 { |
| 1066 StackArgumentsAccessor args(rsp, 0); |
| 1067 __ movp(rax, args.GetReceiverOperand()); |
| 1068 __ JumpIfSmi(rax, &receiver_not_date); |
| 1069 __ CmpObjectType(rax, JS_DATE_TYPE, rbx); |
| 1070 __ j(not_equal, &receiver_not_date); |
| 1071 } |
| 1072 |
| 1073 // 2. Load the specified date field, falling back to the runtime as necessary. |
| 1074 if (field_index == JSDate::kDateValue) { |
| 1075 __ movp(rax, FieldOperand(rax, JSDate::kValueOffset)); |
| 1076 } else { |
| 1077 if (field_index < JSDate::kFirstUncachedField) { |
| 1078 Label stamp_mismatch; |
| 1079 __ Load(rdx, ExternalReference::date_cache_stamp(masm->isolate())); |
| 1080 __ cmpp(rdx, FieldOperand(rax, JSDate::kCacheStampOffset)); |
| 1081 __ j(not_equal, &stamp_mismatch, Label::kNear); |
| 1082 __ movp(rax, FieldOperand( |
| 1083 rax, JSDate::kValueOffset + field_index * kPointerSize)); |
| 1084 __ ret(1 * kPointerSize); |
| 1085 __ bind(&stamp_mismatch); |
| 1086 } |
| 1087 FrameScope scope(masm, StackFrame::INTERNAL); |
| 1088 __ PrepareCallCFunction(2); |
| 1089 __ Move(arg_reg_1, rax); |
| 1090 __ Move(arg_reg_2, Smi::FromInt(field_index)); |
| 1091 __ CallCFunction( |
| 1092 ExternalReference::get_date_field_function(masm->isolate()), 2); |
| 1093 } |
| 1094 __ ret(1 * kPointerSize); |
| 1095 |
| 1096 // 3. Raise a TypeError if the receiver is not a date. |
| 1097 __ bind(&receiver_not_date); |
| 1098 { |
| 1099 FrameScope scope(masm, StackFrame::MANUAL); |
| 1100 __ EnterFrame(StackFrame::INTERNAL); |
| 1101 __ CallRuntime(Runtime::kThrowNotDateError); |
| 1102 } |
| 1103 } |
| 1104 |
| 1105 |
| 1106 // static |
1055 void Builtins::Generate_FunctionPrototypeApply(MacroAssembler* masm) { | 1107 void Builtins::Generate_FunctionPrototypeApply(MacroAssembler* masm) { |
1056 // ----------- S t a t e ------------- | 1108 // ----------- S t a t e ------------- |
1057 // -- rax : argc | 1109 // -- rax : argc |
1058 // -- rsp[0] : return address | 1110 // -- rsp[0] : return address |
1059 // -- rsp[8] : argArray | 1111 // -- rsp[8] : argArray |
1060 // -- rsp[16] : thisArg | 1112 // -- rsp[16] : thisArg |
1061 // -- rsp[24] : receiver | 1113 // -- rsp[24] : receiver |
1062 // ----------------------------------- | 1114 // ----------------------------------- |
1063 | 1115 |
1064 // 1. Load receiver into rdi, argArray into rax (if present), remove all | 1116 // 1. Load receiver into rdi, argArray into rax (if present), remove all |
(...skipping 1386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2451 __ ret(0); | 2503 __ ret(0); |
2452 } | 2504 } |
2453 | 2505 |
2454 | 2506 |
2455 #undef __ | 2507 #undef __ |
2456 | 2508 |
2457 } // namespace internal | 2509 } // namespace internal |
2458 } // namespace v8 | 2510 } // namespace v8 |
2459 | 2511 |
2460 #endif // V8_TARGET_ARCH_X64 | 2512 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |