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/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/regexp/jsregexp-inl.h" | 8 #include "src/regexp/jsregexp-inl.h" |
9 #include "src/string-builder.h" | 9 #include "src/string-builder.h" |
10 #include "src/string-search.h" | 10 #include "src/string-search.h" |
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
392 HandleScope scope(isolate); | 392 HandleScope scope(isolate); |
393 DCHECK(args.length() == 3); | 393 DCHECK(args.length() == 3); |
394 CONVERT_ARG_HANDLE_CHECKED(JSArray, array, 0); | 394 CONVERT_ARG_HANDLE_CHECKED(JSArray, array, 0); |
395 int32_t array_length; | 395 int32_t array_length; |
396 if (!args[1]->ToInt32(&array_length)) { | 396 if (!args[1]->ToInt32(&array_length)) { |
397 THROW_NEW_ERROR_RETURN_FAILURE(isolate, NewInvalidStringLengthError()); | 397 THROW_NEW_ERROR_RETURN_FAILURE(isolate, NewInvalidStringLengthError()); |
398 } | 398 } |
399 CONVERT_ARG_HANDLE_CHECKED(String, special, 2); | 399 CONVERT_ARG_HANDLE_CHECKED(String, special, 2); |
400 | 400 |
401 size_t actual_array_length = 0; | 401 size_t actual_array_length = 0; |
402 CHECK(TryNumberToSize(isolate, array->length(), &actual_array_length)); | 402 CHECK(TryNumberToSize(array->length(), &actual_array_length)); |
403 CHECK(array_length >= 0); | 403 CHECK(array_length >= 0); |
404 CHECK(static_cast<size_t>(array_length) <= actual_array_length); | 404 CHECK(static_cast<size_t>(array_length) <= actual_array_length); |
405 | 405 |
406 // This assumption is used by the slice encoding in one or two smis. | 406 // This assumption is used by the slice encoding in one or two smis. |
407 DCHECK(Smi::kMaxValue >= String::kMaxLength); | 407 DCHECK(Smi::kMaxValue >= String::kMaxLength); |
408 | 408 |
409 CHECK(array->HasFastElements()); | 409 CHECK(array->HasFastElements()); |
410 JSObject::EnsureCanContainHeapObjectElements(array); | 410 JSObject::EnsureCanContainHeapObjectElements(array); |
411 | 411 |
412 int special_length = special->length(); | 412 int special_length = special->length(); |
(...skipping 761 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1174 SealHandleScope shs(isolate); | 1174 SealHandleScope shs(isolate); |
1175 DCHECK(args.length() == 2); | 1175 DCHECK(args.length() == 2); |
1176 if (!args[0]->IsString()) return isolate->heap()->undefined_value(); | 1176 if (!args[0]->IsString()) return isolate->heap()->undefined_value(); |
1177 if (!args[1]->IsNumber()) return isolate->heap()->undefined_value(); | 1177 if (!args[1]->IsNumber()) return isolate->heap()->undefined_value(); |
1178 if (std::isinf(args.number_at(1))) return isolate->heap()->nan_value(); | 1178 if (std::isinf(args.number_at(1))) return isolate->heap()->nan_value(); |
1179 return __RT_impl_Runtime_StringCharCodeAtRT(args, isolate); | 1179 return __RT_impl_Runtime_StringCharCodeAtRT(args, isolate); |
1180 } | 1180 } |
1181 | 1181 |
1182 } // namespace internal | 1182 } // namespace internal |
1183 } // namespace v8 | 1183 } // namespace v8 |
OLD | NEW |