OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 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 #include "src/builtins/builtins-utils.h" | 5 #include "src/builtins/builtins-utils.h" |
6 #include "src/builtins/builtins.h" | 6 #include "src/builtins/builtins.h" |
7 #include "src/code-factory.h" | 7 #include "src/code-factory.h" |
8 #include "src/code-stub-assembler.h" | 8 #include "src/code-stub-assembler.h" |
9 #include "src/dateparser-inl.h" | 9 #include "src/dateparser-inl.h" |
10 | 10 |
(...skipping 927 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
938 ExternalReference::get_date_field_function(assembler->isolate())); | 938 ExternalReference::get_date_field_function(assembler->isolate())); |
939 Node* result = assembler->CallCFunction2( | 939 Node* result = assembler->CallCFunction2( |
940 MachineType::AnyTagged(), MachineType::AnyTagged(), | 940 MachineType::AnyTagged(), MachineType::AnyTagged(), |
941 MachineType::AnyTagged(), function, receiver, field_index_smi); | 941 MachineType::AnyTagged(), function, receiver, field_index_smi); |
942 assembler->Return(result); | 942 assembler->Return(result); |
943 } | 943 } |
944 | 944 |
945 // Raise a TypeError if the receiver is not a date. | 945 // Raise a TypeError if the receiver is not a date. |
946 assembler->Bind(&receiver_not_date); | 946 assembler->Bind(&receiver_not_date); |
947 { | 947 { |
948 Node* result = assembler->CallRuntime(Runtime::kThrowNotDateError, context); | 948 assembler->CallRuntime(Runtime::kThrowNotDateError, context); |
949 assembler->Return(result); | 949 assembler->Unreachable(); |
950 } | 950 } |
951 } | 951 } |
952 | 952 |
953 } // namespace | 953 } // namespace |
954 | 954 |
955 // static | 955 // static |
956 void Builtins::Generate_DatePrototypeGetDate( | 956 void Builtins::Generate_DatePrototypeGetDate( |
957 compiler::CodeAssemblerState* state) { | 957 compiler::CodeAssemblerState* state) { |
958 CodeStubAssembler assembler(state); | 958 CodeStubAssembler assembler(state); |
959 Generate_DatePrototype_GetField(&assembler, JSDate::kDay); | 959 Generate_DatePrototype_GetField(&assembler, JSDate::kDay); |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1145 { | 1145 { |
1146 Callable callable = CodeFactory::OrdinaryToPrimitive( | 1146 Callable callable = CodeFactory::OrdinaryToPrimitive( |
1147 assembler.isolate(), OrdinaryToPrimitiveHint::kString); | 1147 assembler.isolate(), OrdinaryToPrimitiveHint::kString); |
1148 Node* result = assembler.CallStub(callable, context, receiver); | 1148 Node* result = assembler.CallStub(callable, context, receiver); |
1149 assembler.Return(result); | 1149 assembler.Return(result); |
1150 } | 1150 } |
1151 | 1151 |
1152 // Raise a TypeError if the {hint} is invalid. | 1152 // Raise a TypeError if the {hint} is invalid. |
1153 assembler.Bind(&hint_is_invalid); | 1153 assembler.Bind(&hint_is_invalid); |
1154 { | 1154 { |
1155 Node* result = | 1155 assembler.CallRuntime(Runtime::kThrowInvalidHint, context, hint); |
1156 assembler.CallRuntime(Runtime::kThrowInvalidHint, context, hint); | 1156 assembler.Unreachable(); |
1157 assembler.Return(result); | |
1158 } | 1157 } |
1159 | 1158 |
1160 // Raise a TypeError if the {receiver} is not a JSReceiver instance. | 1159 // Raise a TypeError if the {receiver} is not a JSReceiver instance. |
1161 assembler.Bind(&receiver_is_invalid); | 1160 assembler.Bind(&receiver_is_invalid); |
1162 { | 1161 { |
1163 Node* result = assembler.CallRuntime( | 1162 assembler.CallRuntime( |
1164 Runtime::kThrowIncompatibleMethodReceiver, context, | 1163 Runtime::kThrowIncompatibleMethodReceiver, context, |
1165 assembler.HeapConstant(assembler.factory()->NewStringFromAsciiChecked( | 1164 assembler.HeapConstant(assembler.factory()->NewStringFromAsciiChecked( |
1166 "Date.prototype [ @@toPrimitive ]", TENURED)), | 1165 "Date.prototype [ @@toPrimitive ]", TENURED)), |
1167 receiver); | 1166 receiver); |
1168 assembler.Return(result); | 1167 assembler.Unreachable(); |
1169 } | 1168 } |
1170 } | 1169 } |
1171 | 1170 |
1172 } // namespace internal | 1171 } // namespace internal |
1173 } // namespace v8 | 1172 } // namespace v8 |
OLD | NEW |