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 1247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1258 DCHECK(args.length() == 2); | 1258 DCHECK(args.length() == 2); |
1259 if (!args[0]->IsString()) return Smi::FromInt(0); | 1259 if (!args[0]->IsString()) return Smi::FromInt(0); |
1260 if (!args[1]->IsNumber()) return Smi::FromInt(0); | 1260 if (!args[1]->IsNumber()) return Smi::FromInt(0); |
1261 if (std::isinf(args.number_at(1))) return isolate->heap()->empty_string(); | 1261 if (std::isinf(args.number_at(1))) return isolate->heap()->empty_string(); |
1262 Object* code = __RT_impl_Runtime_StringCharCodeAtRT(args, isolate); | 1262 Object* code = __RT_impl_Runtime_StringCharCodeAtRT(args, isolate); |
1263 if (code->IsNaN()) return isolate->heap()->empty_string(); | 1263 if (code->IsNaN()) return isolate->heap()->empty_string(); |
1264 return __RT_impl_Runtime_CharFromCode(Arguments(1, &code), isolate); | 1264 return __RT_impl_Runtime_CharFromCode(Arguments(1, &code), isolate); |
1265 } | 1265 } |
1266 | 1266 |
1267 | 1267 |
| 1268 RUNTIME_FUNCTION(Runtime_OneByteSeqStringGetChar) { |
| 1269 SealHandleScope shs(isolate); |
| 1270 DCHECK(args.length() == 2); |
| 1271 CONVERT_ARG_CHECKED(SeqOneByteString, string, 0); |
| 1272 CONVERT_INT32_ARG_CHECKED(index, 1); |
| 1273 return Smi::FromInt(string->SeqOneByteStringGet(index)); |
| 1274 } |
| 1275 |
| 1276 |
1268 RUNTIME_FUNCTION(Runtime_OneByteSeqStringSetChar) { | 1277 RUNTIME_FUNCTION(Runtime_OneByteSeqStringSetChar) { |
1269 SealHandleScope shs(isolate); | 1278 SealHandleScope shs(isolate); |
1270 DCHECK(args.length() == 3); | 1279 DCHECK(args.length() == 3); |
1271 CONVERT_INT32_ARG_CHECKED(index, 0); | 1280 CONVERT_INT32_ARG_CHECKED(index, 0); |
1272 CONVERT_INT32_ARG_CHECKED(value, 1); | 1281 CONVERT_INT32_ARG_CHECKED(value, 1); |
1273 CONVERT_ARG_CHECKED(SeqOneByteString, string, 2); | 1282 CONVERT_ARG_CHECKED(SeqOneByteString, string, 2); |
1274 string->SeqOneByteStringSet(index, value); | 1283 string->SeqOneByteStringSet(index, value); |
1275 return string; | 1284 return string; |
1276 } | 1285 } |
1277 | 1286 |
1278 | 1287 |
| 1288 RUNTIME_FUNCTION(Runtime_TwoByteSeqStringGetChar) { |
| 1289 SealHandleScope shs(isolate); |
| 1290 DCHECK(args.length() == 2); |
| 1291 CONVERT_ARG_CHECKED(SeqTwoByteString, string, 0); |
| 1292 CONVERT_INT32_ARG_CHECKED(index, 1); |
| 1293 return Smi::FromInt(string->SeqTwoByteStringGet(index)); |
| 1294 } |
| 1295 |
| 1296 |
1279 RUNTIME_FUNCTION(Runtime_TwoByteSeqStringSetChar) { | 1297 RUNTIME_FUNCTION(Runtime_TwoByteSeqStringSetChar) { |
1280 SealHandleScope shs(isolate); | 1298 SealHandleScope shs(isolate); |
1281 DCHECK(args.length() == 3); | 1299 DCHECK(args.length() == 3); |
1282 CONVERT_INT32_ARG_CHECKED(index, 0); | 1300 CONVERT_INT32_ARG_CHECKED(index, 0); |
1283 CONVERT_INT32_ARG_CHECKED(value, 1); | 1301 CONVERT_INT32_ARG_CHECKED(value, 1); |
1284 CONVERT_ARG_CHECKED(SeqTwoByteString, string, 2); | 1302 CONVERT_ARG_CHECKED(SeqTwoByteString, string, 2); |
1285 string->SeqTwoByteStringSet(index, value); | 1303 string->SeqTwoByteStringSet(index, value); |
1286 return string; | 1304 return string; |
1287 } | 1305 } |
1288 | 1306 |
(...skipping 15 matching lines...) Expand all Loading... |
1304 | 1322 |
1305 | 1323 |
1306 RUNTIME_FUNCTION(Runtime_StringGetLength) { | 1324 RUNTIME_FUNCTION(Runtime_StringGetLength) { |
1307 HandleScope scope(isolate); | 1325 HandleScope scope(isolate); |
1308 DCHECK(args.length() == 1); | 1326 DCHECK(args.length() == 1); |
1309 CONVERT_ARG_HANDLE_CHECKED(String, s, 0); | 1327 CONVERT_ARG_HANDLE_CHECKED(String, s, 0); |
1310 return Smi::FromInt(s->length()); | 1328 return Smi::FromInt(s->length()); |
1311 } | 1329 } |
1312 } | 1330 } |
1313 } // namespace v8::internal | 1331 } // namespace v8::internal |
OLD | NEW |