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/conversions.h" | 9 #include "src/conversions.h" |
10 #include "src/counters.h" | 10 #include "src/counters.h" |
11 #include "src/dateparser-inl.h" | 11 #include "src/dateparser-inl.h" |
12 #include "src/objects-inl.h" | 12 #include "src/objects-inl.h" |
13 | 13 |
14 namespace v8 { | 14 namespace v8 { |
15 namespace internal { | 15 namespace internal { |
16 | 16 |
17 // ----------------------------------------------------------------------------- | 17 // ----------------------------------------------------------------------------- |
18 // ES6 section 20.3 Date Objects | 18 // ES6 section 20.3 Date Objects |
19 | 19 |
| 20 class DateBuiltinsAssembler : public CodeStubAssembler { |
| 21 public: |
| 22 explicit DateBuiltinsAssembler(compiler::CodeAssemblerState* state) |
| 23 : CodeStubAssembler(state) {} |
| 24 |
| 25 protected: |
| 26 void Generate_DatePrototype_GetField(int field_index); |
| 27 }; |
| 28 |
20 namespace { | 29 namespace { |
21 | 30 |
22 // ES6 section 20.3.1.1 Time Values and Time Range | 31 // ES6 section 20.3.1.1 Time Values and Time Range |
23 const double kMinYear = -1000000.0; | 32 const double kMinYear = -1000000.0; |
24 const double kMaxYear = -kMinYear; | 33 const double kMaxYear = -kMinYear; |
25 const double kMinMonth = -10000000.0; | 34 const double kMinMonth = -10000000.0; |
26 const double kMaxMonth = -kMinMonth; | 35 const double kMaxMonth = -kMinMonth; |
27 | 36 |
28 // 20.3.1.2 Day Number and Time within Day | 37 // 20.3.1.2 Day Number and Time within Day |
29 const double kMsPerDay = 86400000.0; | 38 const double kMsPerDay = 86400000.0; |
(...skipping 858 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
888 Object::GetProperty(receiver_obj, name)); | 897 Object::GetProperty(receiver_obj, name)); |
889 if (!function->IsCallable()) { | 898 if (!function->IsCallable()) { |
890 THROW_NEW_ERROR_RETURN_FAILURE( | 899 THROW_NEW_ERROR_RETURN_FAILURE( |
891 isolate, NewTypeError(MessageTemplate::kCalledNonCallable, name)); | 900 isolate, NewTypeError(MessageTemplate::kCalledNonCallable, name)); |
892 } | 901 } |
893 RETURN_RESULT_OR_FAILURE( | 902 RETURN_RESULT_OR_FAILURE( |
894 isolate, Execution::Call(isolate, function, receiver_obj, 0, NULL)); | 903 isolate, Execution::Call(isolate, function, receiver_obj, 0, NULL)); |
895 } | 904 } |
896 } | 905 } |
897 | 906 |
898 namespace { | 907 void DateBuiltinsAssembler::Generate_DatePrototype_GetField(int field_index) { |
| 908 Node* receiver = Parameter(0); |
| 909 Node* context = Parameter(3); |
899 | 910 |
900 void Generate_DatePrototype_GetField(CodeStubAssembler* assembler, | 911 Label receiver_not_date(this, Label::kDeferred); |
901 int field_index) { | |
902 typedef CodeStubAssembler::Label Label; | |
903 typedef compiler::Node Node; | |
904 | 912 |
905 Node* receiver = assembler->Parameter(0); | 913 GotoIf(TaggedIsSmi(receiver), &receiver_not_date); |
906 Node* context = assembler->Parameter(3); | 914 Node* receiver_instance_type = LoadInstanceType(receiver); |
907 | 915 GotoIf(Word32NotEqual(receiver_instance_type, Int32Constant(JS_DATE_TYPE)), |
908 Label receiver_not_date(assembler, Label::kDeferred); | 916 &receiver_not_date); |
909 | |
910 assembler->GotoIf(assembler->TaggedIsSmi(receiver), &receiver_not_date); | |
911 Node* receiver_instance_type = assembler->LoadInstanceType(receiver); | |
912 assembler->GotoIf( | |
913 assembler->Word32NotEqual(receiver_instance_type, | |
914 assembler->Int32Constant(JS_DATE_TYPE)), | |
915 &receiver_not_date); | |
916 | 917 |
917 // Load the specified date field, falling back to the runtime as necessary. | 918 // Load the specified date field, falling back to the runtime as necessary. |
918 if (field_index == JSDate::kDateValue) { | 919 if (field_index == JSDate::kDateValue) { |
919 assembler->Return( | 920 Return(LoadObjectField(receiver, JSDate::kValueOffset)); |
920 assembler->LoadObjectField(receiver, JSDate::kValueOffset)); | |
921 } else { | 921 } else { |
922 if (field_index < JSDate::kFirstUncachedField) { | 922 if (field_index < JSDate::kFirstUncachedField) { |
923 Label stamp_mismatch(assembler, Label::kDeferred); | 923 Label stamp_mismatch(this, Label::kDeferred); |
924 Node* date_cache_stamp = assembler->Load( | 924 Node* date_cache_stamp = Load( |
925 MachineType::AnyTagged(), | 925 MachineType::AnyTagged(), |
926 assembler->ExternalConstant( | 926 ExternalConstant(ExternalReference::date_cache_stamp(isolate()))); |
927 ExternalReference::date_cache_stamp(assembler->isolate()))); | |
928 | 927 |
929 Node* cache_stamp = | 928 Node* cache_stamp = LoadObjectField(receiver, JSDate::kCacheStampOffset); |
930 assembler->LoadObjectField(receiver, JSDate::kCacheStampOffset); | 929 GotoIf(WordNotEqual(date_cache_stamp, cache_stamp), &stamp_mismatch); |
931 assembler->GotoIf(assembler->WordNotEqual(date_cache_stamp, cache_stamp), | 930 Return(LoadObjectField( |
932 &stamp_mismatch); | |
933 assembler->Return(assembler->LoadObjectField( | |
934 receiver, JSDate::kValueOffset + field_index * kPointerSize)); | 931 receiver, JSDate::kValueOffset + field_index * kPointerSize)); |
935 | 932 |
936 assembler->Bind(&stamp_mismatch); | 933 Bind(&stamp_mismatch); |
937 } | 934 } |
938 | 935 |
939 Node* field_index_smi = assembler->SmiConstant(Smi::FromInt(field_index)); | 936 Node* field_index_smi = SmiConstant(Smi::FromInt(field_index)); |
940 Node* function = assembler->ExternalConstant( | 937 Node* function = |
941 ExternalReference::get_date_field_function(assembler->isolate())); | 938 ExternalConstant(ExternalReference::get_date_field_function(isolate())); |
942 Node* result = assembler->CallCFunction2( | 939 Node* result = CallCFunction2( |
943 MachineType::AnyTagged(), MachineType::AnyTagged(), | 940 MachineType::AnyTagged(), MachineType::AnyTagged(), |
944 MachineType::AnyTagged(), function, receiver, field_index_smi); | 941 MachineType::AnyTagged(), function, receiver, field_index_smi); |
945 assembler->Return(result); | 942 Return(result); |
946 } | 943 } |
947 | 944 |
948 // Raise a TypeError if the receiver is not a date. | 945 // Raise a TypeError if the receiver is not a date. |
949 assembler->Bind(&receiver_not_date); | 946 Bind(&receiver_not_date); |
950 { | 947 { |
951 assembler->CallRuntime(Runtime::kThrowNotDateError, context); | 948 CallRuntime(Runtime::kThrowNotDateError, context); |
952 assembler->Unreachable(); | 949 Unreachable(); |
953 } | 950 } |
954 } | 951 } |
955 | 952 |
956 } // namespace | 953 TF_BUILTIN(DatePrototypeGetDate, DateBuiltinsAssembler) { |
957 | 954 Generate_DatePrototype_GetField(JSDate::kDay); |
958 // static | |
959 void Builtins::Generate_DatePrototypeGetDate( | |
960 compiler::CodeAssemblerState* state) { | |
961 CodeStubAssembler assembler(state); | |
962 Generate_DatePrototype_GetField(&assembler, JSDate::kDay); | |
963 } | 955 } |
964 | 956 |
965 // static | 957 TF_BUILTIN(DatePrototypeGetDay, DateBuiltinsAssembler) { |
966 void Builtins::Generate_DatePrototypeGetDay( | 958 Generate_DatePrototype_GetField(JSDate::kWeekday); |
967 compiler::CodeAssemblerState* state) { | |
968 CodeStubAssembler assembler(state); | |
969 Generate_DatePrototype_GetField(&assembler, JSDate::kWeekday); | |
970 } | 959 } |
971 | 960 |
972 // static | 961 TF_BUILTIN(DatePrototypeGetFullYear, DateBuiltinsAssembler) { |
973 void Builtins::Generate_DatePrototypeGetFullYear( | 962 Generate_DatePrototype_GetField(JSDate::kYear); |
974 compiler::CodeAssemblerState* state) { | |
975 CodeStubAssembler assembler(state); | |
976 Generate_DatePrototype_GetField(&assembler, JSDate::kYear); | |
977 } | 963 } |
978 | 964 |
979 // static | 965 TF_BUILTIN(DatePrototypeGetHours, DateBuiltinsAssembler) { |
980 void Builtins::Generate_DatePrototypeGetHours( | 966 Generate_DatePrototype_GetField(JSDate::kHour); |
981 compiler::CodeAssemblerState* state) { | |
982 CodeStubAssembler assembler(state); | |
983 Generate_DatePrototype_GetField(&assembler, JSDate::kHour); | |
984 } | 967 } |
985 | 968 |
986 // static | 969 TF_BUILTIN(DatePrototypeGetMilliseconds, DateBuiltinsAssembler) { |
987 void Builtins::Generate_DatePrototypeGetMilliseconds( | 970 Generate_DatePrototype_GetField(JSDate::kMillisecond); |
988 compiler::CodeAssemblerState* state) { | |
989 CodeStubAssembler assembler(state); | |
990 Generate_DatePrototype_GetField(&assembler, JSDate::kMillisecond); | |
991 } | 971 } |
992 | 972 |
993 // static | 973 TF_BUILTIN(DatePrototypeGetMinutes, DateBuiltinsAssembler) { |
994 void Builtins::Generate_DatePrototypeGetMinutes( | 974 Generate_DatePrototype_GetField(JSDate::kMinute); |
995 compiler::CodeAssemblerState* state) { | |
996 CodeStubAssembler assembler(state); | |
997 Generate_DatePrototype_GetField(&assembler, JSDate::kMinute); | |
998 } | 975 } |
999 | 976 |
1000 // static | 977 TF_BUILTIN(DatePrototypeGetMonth, DateBuiltinsAssembler) { |
1001 void Builtins::Generate_DatePrototypeGetMonth( | 978 Generate_DatePrototype_GetField(JSDate::kMonth); |
1002 compiler::CodeAssemblerState* state) { | |
1003 CodeStubAssembler assembler(state); | |
1004 Generate_DatePrototype_GetField(&assembler, JSDate::kMonth); | |
1005 } | 979 } |
1006 | 980 |
1007 // static | 981 TF_BUILTIN(DatePrototypeGetSeconds, DateBuiltinsAssembler) { |
1008 void Builtins::Generate_DatePrototypeGetSeconds( | 982 Generate_DatePrototype_GetField(JSDate::kSecond); |
1009 compiler::CodeAssemblerState* state) { | |
1010 CodeStubAssembler assembler(state); | |
1011 Generate_DatePrototype_GetField(&assembler, JSDate::kSecond); | |
1012 } | 983 } |
1013 | 984 |
1014 // static | 985 TF_BUILTIN(DatePrototypeGetTime, DateBuiltinsAssembler) { |
1015 void Builtins::Generate_DatePrototypeGetTime( | 986 Generate_DatePrototype_GetField(JSDate::kDateValue); |
1016 compiler::CodeAssemblerState* state) { | |
1017 CodeStubAssembler assembler(state); | |
1018 Generate_DatePrototype_GetField(&assembler, JSDate::kDateValue); | |
1019 } | 987 } |
1020 | 988 |
1021 // static | 989 TF_BUILTIN(DatePrototypeGetTimezoneOffset, DateBuiltinsAssembler) { |
1022 void Builtins::Generate_DatePrototypeGetTimezoneOffset( | 990 Generate_DatePrototype_GetField(JSDate::kTimezoneOffset); |
1023 compiler::CodeAssemblerState* state) { | |
1024 CodeStubAssembler assembler(state); | |
1025 Generate_DatePrototype_GetField(&assembler, JSDate::kTimezoneOffset); | |
1026 } | 991 } |
1027 | 992 |
1028 // static | 993 TF_BUILTIN(DatePrototypeGetUTCDate, DateBuiltinsAssembler) { |
1029 void Builtins::Generate_DatePrototypeGetUTCDate( | 994 Generate_DatePrototype_GetField(JSDate::kDayUTC); |
1030 compiler::CodeAssemblerState* state) { | |
1031 CodeStubAssembler assembler(state); | |
1032 Generate_DatePrototype_GetField(&assembler, JSDate::kDayUTC); | |
1033 } | 995 } |
1034 | 996 |
1035 // static | 997 TF_BUILTIN(DatePrototypeGetUTCDay, DateBuiltinsAssembler) { |
1036 void Builtins::Generate_DatePrototypeGetUTCDay( | 998 Generate_DatePrototype_GetField(JSDate::kWeekdayUTC); |
1037 compiler::CodeAssemblerState* state) { | |
1038 CodeStubAssembler assembler(state); | |
1039 Generate_DatePrototype_GetField(&assembler, JSDate::kWeekdayUTC); | |
1040 } | 999 } |
1041 | 1000 |
1042 // static | 1001 TF_BUILTIN(DatePrototypeGetUTCFullYear, DateBuiltinsAssembler) { |
1043 void Builtins::Generate_DatePrototypeGetUTCFullYear( | 1002 Generate_DatePrototype_GetField(JSDate::kYearUTC); |
1044 compiler::CodeAssemblerState* state) { | |
1045 CodeStubAssembler assembler(state); | |
1046 Generate_DatePrototype_GetField(&assembler, JSDate::kYearUTC); | |
1047 } | 1003 } |
1048 | 1004 |
1049 // static | 1005 TF_BUILTIN(DatePrototypeGetUTCHours, DateBuiltinsAssembler) { |
1050 void Builtins::Generate_DatePrototypeGetUTCHours( | 1006 Generate_DatePrototype_GetField(JSDate::kHourUTC); |
1051 compiler::CodeAssemblerState* state) { | |
1052 CodeStubAssembler assembler(state); | |
1053 Generate_DatePrototype_GetField(&assembler, JSDate::kHourUTC); | |
1054 } | 1007 } |
1055 | 1008 |
1056 // static | 1009 TF_BUILTIN(DatePrototypeGetUTCMilliseconds, DateBuiltinsAssembler) { |
1057 void Builtins::Generate_DatePrototypeGetUTCMilliseconds( | 1010 Generate_DatePrototype_GetField(JSDate::kMillisecondUTC); |
1058 compiler::CodeAssemblerState* state) { | |
1059 CodeStubAssembler assembler(state); | |
1060 Generate_DatePrototype_GetField(&assembler, JSDate::kMillisecondUTC); | |
1061 } | 1011 } |
1062 | 1012 |
1063 // static | 1013 TF_BUILTIN(DatePrototypeGetUTCMinutes, DateBuiltinsAssembler) { |
1064 void Builtins::Generate_DatePrototypeGetUTCMinutes( | 1014 Generate_DatePrototype_GetField(JSDate::kMinuteUTC); |
1065 compiler::CodeAssemblerState* state) { | |
1066 CodeStubAssembler assembler(state); | |
1067 Generate_DatePrototype_GetField(&assembler, JSDate::kMinuteUTC); | |
1068 } | 1015 } |
1069 | 1016 |
1070 // static | 1017 TF_BUILTIN(DatePrototypeGetUTCMonth, DateBuiltinsAssembler) { |
1071 void Builtins::Generate_DatePrototypeGetUTCMonth( | 1018 Generate_DatePrototype_GetField(JSDate::kMonthUTC); |
1072 compiler::CodeAssemblerState* state) { | |
1073 CodeStubAssembler assembler(state); | |
1074 Generate_DatePrototype_GetField(&assembler, JSDate::kMonthUTC); | |
1075 } | 1019 } |
1076 | 1020 |
1077 // static | 1021 TF_BUILTIN(DatePrototypeGetUTCSeconds, DateBuiltinsAssembler) { |
1078 void Builtins::Generate_DatePrototypeGetUTCSeconds( | 1022 Generate_DatePrototype_GetField(JSDate::kSecondUTC); |
1079 compiler::CodeAssemblerState* state) { | |
1080 CodeStubAssembler assembler(state); | |
1081 Generate_DatePrototype_GetField(&assembler, JSDate::kSecondUTC); | |
1082 } | 1023 } |
1083 | 1024 |
1084 // static | 1025 TF_BUILTIN(DatePrototypeValueOf, DateBuiltinsAssembler) { |
1085 void Builtins::Generate_DatePrototypeValueOf( | 1026 Generate_DatePrototype_GetField(JSDate::kDateValue); |
1086 compiler::CodeAssemblerState* state) { | |
1087 CodeStubAssembler assembler(state); | |
1088 Generate_DatePrototype_GetField(&assembler, JSDate::kDateValue); | |
1089 } | 1027 } |
1090 | 1028 |
1091 // static | 1029 TF_BUILTIN(DatePrototypeToPrimitive, CodeStubAssembler) { |
1092 void Builtins::Generate_DatePrototypeToPrimitive( | 1030 Node* receiver = Parameter(0); |
1093 compiler::CodeAssemblerState* state) { | 1031 Node* hint = Parameter(1); |
1094 CodeStubAssembler assembler(state); | 1032 Node* context = Parameter(4); |
1095 typedef CodeStubAssembler::Label Label; | |
1096 typedef compiler::Node Node; | |
1097 | |
1098 Node* receiver = assembler.Parameter(0); | |
1099 Node* hint = assembler.Parameter(1); | |
1100 Node* context = assembler.Parameter(4); | |
1101 | 1033 |
1102 // Check if the {receiver} is actually a JSReceiver. | 1034 // Check if the {receiver} is actually a JSReceiver. |
1103 Label receiver_is_invalid(&assembler, Label::kDeferred); | 1035 Label receiver_is_invalid(this, Label::kDeferred); |
1104 assembler.GotoIf(assembler.TaggedIsSmi(receiver), &receiver_is_invalid); | 1036 GotoIf(TaggedIsSmi(receiver), &receiver_is_invalid); |
1105 assembler.GotoIfNot(assembler.IsJSReceiver(receiver), &receiver_is_invalid); | 1037 GotoIfNot(IsJSReceiver(receiver), &receiver_is_invalid); |
1106 | 1038 |
1107 // Dispatch to the appropriate OrdinaryToPrimitive builtin. | 1039 // Dispatch to the appropriate OrdinaryToPrimitive builtin. |
1108 Label hint_is_number(&assembler), hint_is_string(&assembler), | 1040 Label hint_is_number(this), hint_is_string(this), |
1109 hint_is_invalid(&assembler, Label::kDeferred); | 1041 hint_is_invalid(this, Label::kDeferred); |
1110 | 1042 |
1111 // Fast cases for internalized strings. | 1043 // Fast cases for internalized strings. |
1112 Node* number_string = assembler.LoadRoot(Heap::knumber_stringRootIndex); | 1044 Node* number_string = LoadRoot(Heap::knumber_stringRootIndex); |
1113 assembler.GotoIf(assembler.WordEqual(hint, number_string), &hint_is_number); | 1045 GotoIf(WordEqual(hint, number_string), &hint_is_number); |
1114 Node* default_string = assembler.LoadRoot(Heap::kdefault_stringRootIndex); | 1046 Node* default_string = LoadRoot(Heap::kdefault_stringRootIndex); |
1115 assembler.GotoIf(assembler.WordEqual(hint, default_string), &hint_is_string); | 1047 GotoIf(WordEqual(hint, default_string), &hint_is_string); |
1116 Node* string_string = assembler.LoadRoot(Heap::kstring_stringRootIndex); | 1048 Node* string_string = LoadRoot(Heap::kstring_stringRootIndex); |
1117 assembler.GotoIf(assembler.WordEqual(hint, string_string), &hint_is_string); | 1049 GotoIf(WordEqual(hint, string_string), &hint_is_string); |
1118 | 1050 |
1119 // Slow-case with actual string comparisons. | 1051 // Slow-case with actual string comparisons. |
1120 Callable string_equal = CodeFactory::StringEqual(assembler.isolate()); | 1052 Callable string_equal = CodeFactory::StringEqual(isolate()); |
1121 assembler.GotoIf(assembler.TaggedIsSmi(hint), &hint_is_invalid); | 1053 GotoIf(TaggedIsSmi(hint), &hint_is_invalid); |
1122 assembler.GotoIfNot(assembler.IsString(hint), &hint_is_invalid); | 1054 GotoIfNot(IsString(hint), &hint_is_invalid); |
1123 assembler.GotoIf(assembler.WordEqual(assembler.CallStub(string_equal, context, | 1055 GotoIf(WordEqual(CallStub(string_equal, context, hint, number_string), |
1124 hint, number_string), | 1056 TrueConstant()), |
1125 assembler.TrueConstant()), | 1057 &hint_is_number); |
1126 &hint_is_number); | 1058 GotoIf(WordEqual(CallStub(string_equal, context, hint, default_string), |
1127 assembler.GotoIf(assembler.WordEqual(assembler.CallStub(string_equal, context, | 1059 TrueConstant()), |
1128 hint, default_string), | 1060 &hint_is_string); |
1129 assembler.TrueConstant()), | 1061 GotoIf(WordEqual(CallStub(string_equal, context, hint, string_string), |
1130 &hint_is_string); | 1062 TrueConstant()), |
1131 assembler.GotoIf(assembler.WordEqual(assembler.CallStub(string_equal, context, | 1063 &hint_is_string); |
1132 hint, string_string), | 1064 Goto(&hint_is_invalid); |
1133 assembler.TrueConstant()), | |
1134 &hint_is_string); | |
1135 assembler.Goto(&hint_is_invalid); | |
1136 | 1065 |
1137 // Use the OrdinaryToPrimitive builtin to convert to a Number. | 1066 // Use the OrdinaryToPrimitive builtin to convert to a Number. |
1138 assembler.Bind(&hint_is_number); | 1067 Bind(&hint_is_number); |
1139 { | 1068 { |
1140 Callable callable = CodeFactory::OrdinaryToPrimitive( | 1069 Callable callable = CodeFactory::OrdinaryToPrimitive( |
1141 assembler.isolate(), OrdinaryToPrimitiveHint::kNumber); | 1070 isolate(), OrdinaryToPrimitiveHint::kNumber); |
1142 Node* result = assembler.CallStub(callable, context, receiver); | 1071 Node* result = CallStub(callable, context, receiver); |
1143 assembler.Return(result); | 1072 Return(result); |
1144 } | 1073 } |
1145 | 1074 |
1146 // Use the OrdinaryToPrimitive builtin to convert to a String. | 1075 // Use the OrdinaryToPrimitive builtin to convert to a String. |
1147 assembler.Bind(&hint_is_string); | 1076 Bind(&hint_is_string); |
1148 { | 1077 { |
1149 Callable callable = CodeFactory::OrdinaryToPrimitive( | 1078 Callable callable = CodeFactory::OrdinaryToPrimitive( |
1150 assembler.isolate(), OrdinaryToPrimitiveHint::kString); | 1079 isolate(), OrdinaryToPrimitiveHint::kString); |
1151 Node* result = assembler.CallStub(callable, context, receiver); | 1080 Node* result = CallStub(callable, context, receiver); |
1152 assembler.Return(result); | 1081 Return(result); |
1153 } | 1082 } |
1154 | 1083 |
1155 // Raise a TypeError if the {hint} is invalid. | 1084 // Raise a TypeError if the {hint} is invalid. |
1156 assembler.Bind(&hint_is_invalid); | 1085 Bind(&hint_is_invalid); |
1157 { | 1086 { |
1158 assembler.CallRuntime(Runtime::kThrowInvalidHint, context, hint); | 1087 CallRuntime(Runtime::kThrowInvalidHint, context, hint); |
1159 assembler.Unreachable(); | 1088 Unreachable(); |
1160 } | 1089 } |
1161 | 1090 |
1162 // Raise a TypeError if the {receiver} is not a JSReceiver instance. | 1091 // Raise a TypeError if the {receiver} is not a JSReceiver instance. |
1163 assembler.Bind(&receiver_is_invalid); | 1092 Bind(&receiver_is_invalid); |
1164 { | 1093 { |
1165 assembler.CallRuntime( | 1094 CallRuntime(Runtime::kThrowIncompatibleMethodReceiver, context, |
1166 Runtime::kThrowIncompatibleMethodReceiver, context, | 1095 HeapConstant(factory()->NewStringFromAsciiChecked( |
1167 assembler.HeapConstant(assembler.factory()->NewStringFromAsciiChecked( | 1096 "Date.prototype [ @@toPrimitive ]", TENURED)), |
1168 "Date.prototype [ @@toPrimitive ]", TENURED)), | 1097 receiver); |
1169 receiver); | 1098 Unreachable(); |
1170 assembler.Unreachable(); | |
1171 } | 1099 } |
1172 } | 1100 } |
1173 | 1101 |
1174 } // namespace internal | 1102 } // namespace internal |
1175 } // namespace v8 | 1103 } // namespace v8 |
OLD | NEW |