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

Side by Side Diff: src/runtime/runtime-strings.cc

Issue 1759133002: [compiler] Initial TurboFan code stubs for abstract relational comparison. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 9 months 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/runtime/runtime.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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/runtime/runtime-utils.h" 5 #include "src/runtime/runtime-utils.h"
6 6
7 #include "src/arguments.h" 7 #include "src/arguments.h"
8 #include "src/conversions-inl.h" 8 #include "src/conversions-inl.h"
9 #include "src/isolate-inl.h" 9 #include "src/isolate-inl.h"
10 #include "src/regexp/jsregexp-inl.h" 10 #include "src/regexp/jsregexp-inl.h"
(...skipping 1127 matching lines...) Expand 10 before | Expand all | Expand 10 after
1138 if (is_one_byte) { 1138 if (is_one_byte) {
1139 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( 1139 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
1140 isolate, result, isolate->factory()->NewRawOneByteString(length)); 1140 isolate, result, isolate->factory()->NewRawOneByteString(length));
1141 } else { 1141 } else {
1142 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( 1142 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
1143 isolate, result, isolate->factory()->NewRawTwoByteString(length)); 1143 isolate, result, isolate->factory()->NewRawTwoByteString(length));
1144 } 1144 }
1145 return *result; 1145 return *result;
1146 } 1146 }
1147 1147
1148 RUNTIME_FUNCTION(Runtime_StringLessThan) {
1149 HandleScope handle_scope(isolate);
1150 DCHECK_EQ(2, args.length());
1151 CONVERT_ARG_HANDLE_CHECKED(String, x, 0);
1152 CONVERT_ARG_HANDLE_CHECKED(String, y, 1);
1153 switch (String::Compare(x, y)) {
1154 case ComparisonResult::kLessThan:
1155 return isolate->heap()->true_value();
1156 case ComparisonResult::kEqual:
1157 case ComparisonResult::kGreaterThan:
1158 return isolate->heap()->false_value();
1159 case ComparisonResult::kUndefined:
1160 break;
1161 }
1162 UNREACHABLE();
1163 return Smi::FromInt(0);
1164 }
1165
1166 RUNTIME_FUNCTION(Runtime_StringLessThanOrEqual) {
1167 HandleScope handle_scope(isolate);
1168 DCHECK_EQ(2, args.length());
1169 CONVERT_ARG_HANDLE_CHECKED(String, x, 0);
1170 CONVERT_ARG_HANDLE_CHECKED(String, y, 1);
1171 switch (String::Compare(x, y)) {
1172 case ComparisonResult::kEqual:
1173 case ComparisonResult::kLessThan:
1174 return isolate->heap()->true_value();
1175 case ComparisonResult::kGreaterThan:
1176 return isolate->heap()->false_value();
1177 case ComparisonResult::kUndefined:
1178 break;
1179 }
1180 UNREACHABLE();
1181 return Smi::FromInt(0);
1182 }
1183
1184 RUNTIME_FUNCTION(Runtime_StringGreaterThan) {
1185 HandleScope handle_scope(isolate);
1186 DCHECK_EQ(2, args.length());
1187 CONVERT_ARG_HANDLE_CHECKED(String, x, 0);
1188 CONVERT_ARG_HANDLE_CHECKED(String, y, 1);
1189 switch (String::Compare(x, y)) {
1190 case ComparisonResult::kGreaterThan:
1191 return isolate->heap()->true_value();
1192 case ComparisonResult::kEqual:
1193 case ComparisonResult::kLessThan:
1194 return isolate->heap()->false_value();
1195 case ComparisonResult::kUndefined:
1196 break;
1197 }
1198 UNREACHABLE();
1199 return Smi::FromInt(0);
1200 }
1201
1202 RUNTIME_FUNCTION(Runtime_StringGreaterThanOrEqual) {
1203 HandleScope handle_scope(isolate);
1204 DCHECK_EQ(2, args.length());
1205 CONVERT_ARG_HANDLE_CHECKED(String, x, 0);
1206 CONVERT_ARG_HANDLE_CHECKED(String, y, 1);
1207 switch (String::Compare(x, y)) {
1208 case ComparisonResult::kEqual:
1209 case ComparisonResult::kGreaterThan:
1210 return isolate->heap()->true_value();
1211 case ComparisonResult::kLessThan:
1212 return isolate->heap()->false_value();
1213 case ComparisonResult::kUndefined:
1214 break;
1215 }
1216 UNREACHABLE();
1217 return Smi::FromInt(0);
1218 }
1219
1148 RUNTIME_FUNCTION(Runtime_StringEqual) { 1220 RUNTIME_FUNCTION(Runtime_StringEqual) {
1149 HandleScope handle_scope(isolate); 1221 HandleScope handle_scope(isolate);
1150 DCHECK_EQ(2, args.length()); 1222 DCHECK_EQ(2, args.length());
1151 CONVERT_ARG_HANDLE_CHECKED(String, x, 0); 1223 CONVERT_ARG_HANDLE_CHECKED(String, x, 0);
1152 CONVERT_ARG_HANDLE_CHECKED(String, y, 1); 1224 CONVERT_ARG_HANDLE_CHECKED(String, y, 1);
1153 return isolate->heap()->ToBoolean(String::Equals(x, y)); 1225 return isolate->heap()->ToBoolean(String::Equals(x, y));
1154 } 1226 }
1155 1227
1156 RUNTIME_FUNCTION(Runtime_StringNotEqual) { 1228 RUNTIME_FUNCTION(Runtime_StringNotEqual) {
1157 HandleScope handle_scope(isolate); 1229 HandleScope handle_scope(isolate);
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
1237 SealHandleScope shs(isolate); 1309 SealHandleScope shs(isolate);
1238 DCHECK(args.length() == 2); 1310 DCHECK(args.length() == 2);
1239 if (!args[0]->IsString()) return isolate->heap()->undefined_value(); 1311 if (!args[0]->IsString()) return isolate->heap()->undefined_value();
1240 if (!args[1]->IsNumber()) return isolate->heap()->undefined_value(); 1312 if (!args[1]->IsNumber()) return isolate->heap()->undefined_value();
1241 if (std::isinf(args.number_at(1))) return isolate->heap()->nan_value(); 1313 if (std::isinf(args.number_at(1))) return isolate->heap()->nan_value();
1242 return __RT_impl_Runtime_StringCharCodeAtRT(args, isolate); 1314 return __RT_impl_Runtime_StringCharCodeAtRT(args, isolate);
1243 } 1315 }
1244 1316
1245 } // namespace internal 1317 } // namespace internal
1246 } // namespace v8 1318 } // namespace v8
OLDNEW
« no previous file with comments | « src/runtime/runtime.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698