Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(358)

Side by Side Diff: src/builtins/builtins-date.cc

Issue 2498073002: [refactoring] Split CodeAssemblerState out of CodeAssembler (Closed)
Patch Set: one more attempt Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/builtins/builtins-conversion.cc ('k') | src/builtins/builtins-function.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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.h" 5 #include "src/builtins/builtins.h"
6 #include "src/builtins/builtins-utils.h" 6 #include "src/builtins/builtins-utils.h"
7 7
8 #include "src/dateparser-inl.h" 8 #include "src/dateparser-inl.h"
9 9
10 namespace v8 { 10 namespace v8 {
(...skipping 890 matching lines...) Expand 10 before | Expand all | Expand 10 after
901 Object::GetProperty(receiver_obj, name)); 901 Object::GetProperty(receiver_obj, name));
902 if (!function->IsCallable()) { 902 if (!function->IsCallable()) {
903 THROW_NEW_ERROR_RETURN_FAILURE( 903 THROW_NEW_ERROR_RETURN_FAILURE(
904 isolate, NewTypeError(MessageTemplate::kCalledNonCallable, name)); 904 isolate, NewTypeError(MessageTemplate::kCalledNonCallable, name));
905 } 905 }
906 RETURN_RESULT_OR_FAILURE( 906 RETURN_RESULT_OR_FAILURE(
907 isolate, Execution::Call(isolate, function, receiver_obj, 0, NULL)); 907 isolate, Execution::Call(isolate, function, receiver_obj, 0, NULL));
908 } 908 }
909 } 909 }
910 910
911 // static 911 namespace {
912 void Builtins::Generate_DatePrototype_GetField(CodeStubAssembler* assembler, 912
913 int field_index) { 913 void Generate_DatePrototype_GetField(CodeStubAssembler* assembler,
914 int field_index) {
914 typedef CodeStubAssembler::Label Label; 915 typedef CodeStubAssembler::Label Label;
915 typedef compiler::Node Node; 916 typedef compiler::Node Node;
916 917
917 Node* receiver = assembler->Parameter(0); 918 Node* receiver = assembler->Parameter(0);
918 Node* context = assembler->Parameter(3); 919 Node* context = assembler->Parameter(3);
919 920
920 Label receiver_not_date(assembler, Label::kDeferred); 921 Label receiver_not_date(assembler, Label::kDeferred);
921 922
922 assembler->GotoIf(assembler->TaggedIsSmi(receiver), &receiver_not_date); 923 assembler->GotoIf(assembler->TaggedIsSmi(receiver), &receiver_not_date);
923 Node* receiver_instance_type = assembler->LoadInstanceType(receiver); 924 Node* receiver_instance_type = assembler->LoadInstanceType(receiver);
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
958 } 959 }
959 960
960 // Raise a TypeError if the receiver is not a date. 961 // Raise a TypeError if the receiver is not a date.
961 assembler->Bind(&receiver_not_date); 962 assembler->Bind(&receiver_not_date);
962 { 963 {
963 Node* result = assembler->CallRuntime(Runtime::kThrowNotDateError, context); 964 Node* result = assembler->CallRuntime(Runtime::kThrowNotDateError, context);
964 assembler->Return(result); 965 assembler->Return(result);
965 } 966 }
966 } 967 }
967 968
969 } // namespace
970
968 // static 971 // static
969 void Builtins::Generate_DatePrototypeGetDate(CodeStubAssembler* assembler) { 972 void Builtins::Generate_DatePrototypeGetDate(
970 Generate_DatePrototype_GetField(assembler, JSDate::kDay); 973 compiler::CodeAssemblerState* state) {
974 CodeStubAssembler assembler(state);
975 Generate_DatePrototype_GetField(&assembler, JSDate::kDay);
971 } 976 }
972 977
973 // static 978 // static
974 void Builtins::Generate_DatePrototypeGetDay(CodeStubAssembler* assembler) { 979 void Builtins::Generate_DatePrototypeGetDay(
975 Generate_DatePrototype_GetField(assembler, JSDate::kWeekday); 980 compiler::CodeAssemblerState* state) {
981 CodeStubAssembler assembler(state);
982 Generate_DatePrototype_GetField(&assembler, JSDate::kWeekday);
976 } 983 }
977 984
978 // static 985 // static
979 void Builtins::Generate_DatePrototypeGetFullYear(CodeStubAssembler* assembler) { 986 void Builtins::Generate_DatePrototypeGetFullYear(
980 Generate_DatePrototype_GetField(assembler, JSDate::kYear); 987 compiler::CodeAssemblerState* state) {
988 CodeStubAssembler assembler(state);
989 Generate_DatePrototype_GetField(&assembler, JSDate::kYear);
981 } 990 }
982 991
983 // static 992 // static
984 void Builtins::Generate_DatePrototypeGetHours(CodeStubAssembler* assembler) { 993 void Builtins::Generate_DatePrototypeGetHours(
985 Generate_DatePrototype_GetField(assembler, JSDate::kHour); 994 compiler::CodeAssemblerState* state) {
995 CodeStubAssembler assembler(state);
996 Generate_DatePrototype_GetField(&assembler, JSDate::kHour);
986 } 997 }
987 998
988 // static 999 // static
989 void Builtins::Generate_DatePrototypeGetMilliseconds( 1000 void Builtins::Generate_DatePrototypeGetMilliseconds(
990 CodeStubAssembler* assembler) { 1001 compiler::CodeAssemblerState* state) {
991 Generate_DatePrototype_GetField(assembler, JSDate::kMillisecond); 1002 CodeStubAssembler assembler(state);
1003 Generate_DatePrototype_GetField(&assembler, JSDate::kMillisecond);
992 } 1004 }
993 1005
994 // static 1006 // static
995 void Builtins::Generate_DatePrototypeGetMinutes(CodeStubAssembler* assembler) { 1007 void Builtins::Generate_DatePrototypeGetMinutes(
996 Generate_DatePrototype_GetField(assembler, JSDate::kMinute); 1008 compiler::CodeAssemblerState* state) {
1009 CodeStubAssembler assembler(state);
1010 Generate_DatePrototype_GetField(&assembler, JSDate::kMinute);
997 } 1011 }
998 1012
999 // static 1013 // static
1000 void Builtins::Generate_DatePrototypeGetMonth(CodeStubAssembler* assembler) { 1014 void Builtins::Generate_DatePrototypeGetMonth(
1001 Generate_DatePrototype_GetField(assembler, JSDate::kMonth); 1015 compiler::CodeAssemblerState* state) {
1016 CodeStubAssembler assembler(state);
1017 Generate_DatePrototype_GetField(&assembler, JSDate::kMonth);
1002 } 1018 }
1003 1019
1004 // static 1020 // static
1005 void Builtins::Generate_DatePrototypeGetSeconds(CodeStubAssembler* assembler) { 1021 void Builtins::Generate_DatePrototypeGetSeconds(
1006 Generate_DatePrototype_GetField(assembler, JSDate::kSecond); 1022 compiler::CodeAssemblerState* state) {
1023 CodeStubAssembler assembler(state);
1024 Generate_DatePrototype_GetField(&assembler, JSDate::kSecond);
1007 } 1025 }
1008 1026
1009 // static 1027 // static
1010 void Builtins::Generate_DatePrototypeGetTime(CodeStubAssembler* assembler) { 1028 void Builtins::Generate_DatePrototypeGetTime(
1011 Generate_DatePrototype_GetField(assembler, JSDate::kDateValue); 1029 compiler::CodeAssemblerState* state) {
1030 CodeStubAssembler assembler(state);
1031 Generate_DatePrototype_GetField(&assembler, JSDate::kDateValue);
1012 } 1032 }
1013 1033
1014 // static 1034 // static
1015 void Builtins::Generate_DatePrototypeGetTimezoneOffset( 1035 void Builtins::Generate_DatePrototypeGetTimezoneOffset(
1016 CodeStubAssembler* assembler) { 1036 compiler::CodeAssemblerState* state) {
1017 Generate_DatePrototype_GetField(assembler, JSDate::kTimezoneOffset); 1037 CodeStubAssembler assembler(state);
1038 Generate_DatePrototype_GetField(&assembler, JSDate::kTimezoneOffset);
1018 } 1039 }
1019 1040
1020 // static 1041 // static
1021 void Builtins::Generate_DatePrototypeGetUTCDate(CodeStubAssembler* assembler) { 1042 void Builtins::Generate_DatePrototypeGetUTCDate(
1022 Generate_DatePrototype_GetField(assembler, JSDate::kDayUTC); 1043 compiler::CodeAssemblerState* state) {
1044 CodeStubAssembler assembler(state);
1045 Generate_DatePrototype_GetField(&assembler, JSDate::kDayUTC);
1023 } 1046 }
1024 1047
1025 // static 1048 // static
1026 void Builtins::Generate_DatePrototypeGetUTCDay(CodeStubAssembler* assembler) { 1049 void Builtins::Generate_DatePrototypeGetUTCDay(
1027 Generate_DatePrototype_GetField(assembler, JSDate::kWeekdayUTC); 1050 compiler::CodeAssemblerState* state) {
1051 CodeStubAssembler assembler(state);
1052 Generate_DatePrototype_GetField(&assembler, JSDate::kWeekdayUTC);
1028 } 1053 }
1029 1054
1030 // static 1055 // static
1031 void Builtins::Generate_DatePrototypeGetUTCFullYear( 1056 void Builtins::Generate_DatePrototypeGetUTCFullYear(
1032 CodeStubAssembler* assembler) { 1057 compiler::CodeAssemblerState* state) {
1033 Generate_DatePrototype_GetField(assembler, JSDate::kYearUTC); 1058 CodeStubAssembler assembler(state);
1059 Generate_DatePrototype_GetField(&assembler, JSDate::kYearUTC);
1034 } 1060 }
1035 1061
1036 // static 1062 // static
1037 void Builtins::Generate_DatePrototypeGetUTCHours(CodeStubAssembler* assembler) { 1063 void Builtins::Generate_DatePrototypeGetUTCHours(
1038 Generate_DatePrototype_GetField(assembler, JSDate::kHourUTC); 1064 compiler::CodeAssemblerState* state) {
1065 CodeStubAssembler assembler(state);
1066 Generate_DatePrototype_GetField(&assembler, JSDate::kHourUTC);
1039 } 1067 }
1040 1068
1041 // static 1069 // static
1042 void Builtins::Generate_DatePrototypeGetUTCMilliseconds( 1070 void Builtins::Generate_DatePrototypeGetUTCMilliseconds(
1043 CodeStubAssembler* assembler) { 1071 compiler::CodeAssemblerState* state) {
1044 Generate_DatePrototype_GetField(assembler, JSDate::kMillisecondUTC); 1072 CodeStubAssembler assembler(state);
1073 Generate_DatePrototype_GetField(&assembler, JSDate::kMillisecondUTC);
1045 } 1074 }
1046 1075
1047 // static 1076 // static
1048 void Builtins::Generate_DatePrototypeGetUTCMinutes( 1077 void Builtins::Generate_DatePrototypeGetUTCMinutes(
1049 CodeStubAssembler* assembler) { 1078 compiler::CodeAssemblerState* state) {
1050 Generate_DatePrototype_GetField(assembler, JSDate::kMinuteUTC); 1079 CodeStubAssembler assembler(state);
1080 Generate_DatePrototype_GetField(&assembler, JSDate::kMinuteUTC);
1051 } 1081 }
1052 1082
1053 // static 1083 // static
1054 void Builtins::Generate_DatePrototypeGetUTCMonth(CodeStubAssembler* assembler) { 1084 void Builtins::Generate_DatePrototypeGetUTCMonth(
1055 Generate_DatePrototype_GetField(assembler, JSDate::kMonthUTC); 1085 compiler::CodeAssemblerState* state) {
1086 CodeStubAssembler assembler(state);
1087 Generate_DatePrototype_GetField(&assembler, JSDate::kMonthUTC);
1056 } 1088 }
1057 1089
1058 // static 1090 // static
1059 void Builtins::Generate_DatePrototypeGetUTCSeconds( 1091 void Builtins::Generate_DatePrototypeGetUTCSeconds(
1060 CodeStubAssembler* assembler) { 1092 compiler::CodeAssemblerState* state) {
1061 Generate_DatePrototype_GetField(assembler, JSDate::kSecondUTC); 1093 CodeStubAssembler assembler(state);
1094 Generate_DatePrototype_GetField(&assembler, JSDate::kSecondUTC);
1062 } 1095 }
1063 1096
1064 } // namespace internal 1097 } // namespace internal
1065 } // namespace v8 1098 } // namespace v8
OLDNEW
« no previous file with comments | « src/builtins/builtins-conversion.cc ('k') | src/builtins/builtins-function.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698