OLD | NEW |
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/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/arguments.h" | 7 #include "src/arguments.h" |
8 #include "src/jsregexp-inl.h" | 8 #include "src/jsregexp-inl.h" |
9 #include "src/jsregexp.h" | 9 #include "src/jsregexp.h" |
10 #include "src/runtime/runtime-utils.h" | 10 #include "src/runtime/runtime-utils.h" |
(...skipping 1203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1214 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( | 1214 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
1215 isolate, result, isolate->factory()->NewRawOneByteString(length)); | 1215 isolate, result, isolate->factory()->NewRawOneByteString(length)); |
1216 } else { | 1216 } else { |
1217 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( | 1217 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
1218 isolate, result, isolate->factory()->NewRawTwoByteString(length)); | 1218 isolate, result, isolate->factory()->NewRawTwoByteString(length)); |
1219 } | 1219 } |
1220 return *result; | 1220 return *result; |
1221 } | 1221 } |
1222 | 1222 |
1223 | 1223 |
| 1224 RUNTIME_FUNCTION(Runtime_NewConsString) { |
| 1225 HandleScope scope(isolate); |
| 1226 DCHECK(args.length() == 4); |
| 1227 CONVERT_INT32_ARG_CHECKED(length, 0); |
| 1228 CONVERT_BOOLEAN_ARG_CHECKED(is_one_byte, 1); |
| 1229 CONVERT_ARG_HANDLE_CHECKED(String, left, 2); |
| 1230 CONVERT_ARG_HANDLE_CHECKED(String, right, 3); |
| 1231 |
| 1232 Handle<String> result; |
| 1233 if (is_one_byte) { |
| 1234 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
| 1235 isolate, result, |
| 1236 isolate->factory()->NewOneByteConsString(length, left, right)); |
| 1237 } else { |
| 1238 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
| 1239 isolate, result, |
| 1240 isolate->factory()->NewTwoByteConsString(length, left, right)); |
| 1241 } |
| 1242 return *result; |
| 1243 } |
| 1244 |
| 1245 |
1224 RUNTIME_FUNCTION(Runtime_StringEquals) { | 1246 RUNTIME_FUNCTION(Runtime_StringEquals) { |
1225 HandleScope handle_scope(isolate); | 1247 HandleScope handle_scope(isolate); |
1226 DCHECK(args.length() == 2); | 1248 DCHECK(args.length() == 2); |
1227 | 1249 |
1228 CONVERT_ARG_HANDLE_CHECKED(String, x, 0); | 1250 CONVERT_ARG_HANDLE_CHECKED(String, x, 0); |
1229 CONVERT_ARG_HANDLE_CHECKED(String, y, 1); | 1251 CONVERT_ARG_HANDLE_CHECKED(String, y, 1); |
1230 | 1252 |
1231 bool not_equal = !String::Equals(x, y); | 1253 bool not_equal = !String::Equals(x, y); |
1232 // This is slightly convoluted because the value that signifies | 1254 // This is slightly convoluted because the value that signifies |
1233 // equality is 0 and inequality is 1 so we have to negate the result | 1255 // equality is 0 and inequality is 1 so we have to negate the result |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1322 | 1344 |
1323 | 1345 |
1324 RUNTIME_FUNCTION(Runtime_StringGetLength) { | 1346 RUNTIME_FUNCTION(Runtime_StringGetLength) { |
1325 HandleScope scope(isolate); | 1347 HandleScope scope(isolate); |
1326 DCHECK(args.length() == 1); | 1348 DCHECK(args.length() == 1); |
1327 CONVERT_ARG_HANDLE_CHECKED(String, s, 0); | 1349 CONVERT_ARG_HANDLE_CHECKED(String, s, 0); |
1328 return Smi::FromInt(s->length()); | 1350 return Smi::FromInt(s->length()); |
1329 } | 1351 } |
1330 } | 1352 } |
1331 } // namespace v8::internal | 1353 } // namespace v8::internal |
OLD | NEW |