| 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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 } | 83 } |
| 84 if (isolate->has_pending_exception()) return isolate->heap()->exception(); | 84 if (isolate->has_pending_exception()) return isolate->heap()->exception(); |
| 85 // In case of empty handle and no pending exception we have stack overflow. | 85 // In case of empty handle and no pending exception we have stack overflow. |
| 86 return isolate->StackOverflow(); | 86 return isolate->StackOverflow(); |
| 87 } | 87 } |
| 88 | 88 |
| 89 | 89 |
| 90 RUNTIME_FUNCTION(Runtime_StringIndexOf) { | 90 RUNTIME_FUNCTION(Runtime_StringIndexOf) { |
| 91 HandleScope scope(isolate); | 91 HandleScope scope(isolate); |
| 92 DCHECK(args.length() == 3); | 92 DCHECK(args.length() == 3); |
| 93 return String::IndexOf(isolate, args.at<Object>(0), args.at<Object>(1), | 93 return String::IndexOf(isolate, args.at(0), args.at(1), args.at(2)); |
| 94 args.at<Object>(2)); | |
| 95 } | 94 } |
| 96 | 95 |
| 97 RUNTIME_FUNCTION(Runtime_StringLastIndexOf) { | 96 RUNTIME_FUNCTION(Runtime_StringLastIndexOf) { |
| 98 HandleScope handle_scope(isolate); | 97 HandleScope handle_scope(isolate); |
| 99 return String::LastIndexOf(isolate, args.at<Object>(0), args.at<Object>(1), | 98 return String::LastIndexOf(isolate, args.at(0), args.at(1), |
| 100 isolate->factory()->undefined_value()); | 99 isolate->factory()->undefined_value()); |
| 101 } | 100 } |
| 102 | 101 |
| 103 RUNTIME_FUNCTION(Runtime_SubString) { | 102 RUNTIME_FUNCTION(Runtime_SubString) { |
| 104 HandleScope scope(isolate); | 103 HandleScope scope(isolate); |
| 105 DCHECK(args.length() == 3); | 104 DCHECK(args.length() == 3); |
| 106 | 105 |
| 107 CONVERT_ARG_HANDLE_CHECKED(String, string, 0); | 106 CONVERT_ARG_HANDLE_CHECKED(String, string, 0); |
| 108 int start, end; | 107 int start, end; |
| 109 // We have a fast integer-only case here to avoid a conversion to double in | 108 // We have a fast integer-only case here to avoid a conversion to double in |
| (...skipping 872 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 982 | 981 |
| 983 RUNTIME_FUNCTION(Runtime_StringCharCodeAt) { | 982 RUNTIME_FUNCTION(Runtime_StringCharCodeAt) { |
| 984 SealHandleScope shs(isolate); | 983 SealHandleScope shs(isolate); |
| 985 DCHECK(args.length() == 2); | 984 DCHECK(args.length() == 2); |
| 986 if (!args[0]->IsString()) return isolate->heap()->undefined_value(); | 985 if (!args[0]->IsString()) return isolate->heap()->undefined_value(); |
| 987 if (!args[1]->IsNumber()) return isolate->heap()->undefined_value(); | 986 if (!args[1]->IsNumber()) return isolate->heap()->undefined_value(); |
| 988 if (std::isinf(args.number_at(1))) return isolate->heap()->nan_value(); | 987 if (std::isinf(args.number_at(1))) return isolate->heap()->nan_value(); |
| 989 return __RT_impl_Runtime_StringCharCodeAtRT(args, isolate); | 988 return __RT_impl_Runtime_StringCharCodeAtRT(args, isolate); |
| 990 } | 989 } |
| 991 | 990 |
| 991 // ES6 #sec-string.prototype.indexof |
| 992 // String.prototype.indexOf(searchString [, position]) |
| 993 RUNTIME_FUNCTION(Runtime_StringPrototypeIndexOf) { |
| 994 HandleScope handle_scope(isolate); |
| 995 DCHECK(args.length() == 3); |
| 996 return String::IndexOf(isolate, args.at(0), args.at(1), args.at(2)); |
| 997 } |
| 998 |
| 992 } // namespace internal | 999 } // namespace internal |
| 993 } // namespace v8 | 1000 } // namespace v8 |
| OLD | NEW |