| 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 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 265 } | 265 } |
| 266 isolate->counters()->sub_string_runtime()->Increment(); | 266 isolate->counters()->sub_string_runtime()->Increment(); |
| 267 | 267 |
| 268 return *isolate->factory()->NewSubString(string, start, end); | 268 return *isolate->factory()->NewSubString(string, start, end); |
| 269 } | 269 } |
| 270 | 270 |
| 271 | 271 |
| 272 RUNTIME_FUNCTION(Runtime_StringAdd) { | 272 RUNTIME_FUNCTION(Runtime_StringAdd) { |
| 273 HandleScope scope(isolate); | 273 HandleScope scope(isolate); |
| 274 DCHECK(args.length() == 2); | 274 DCHECK(args.length() == 2); |
| 275 CONVERT_ARG_HANDLE_CHECKED(String, str1, 0); | 275 CONVERT_ARG_HANDLE_CHECKED(Object, obj1, 0); |
| 276 CONVERT_ARG_HANDLE_CHECKED(String, str2, 1); | 276 CONVERT_ARG_HANDLE_CHECKED(Object, obj2, 1); |
| 277 isolate->counters()->string_add_runtime()->Increment(); | 277 isolate->counters()->string_add_runtime()->Increment(); |
| 278 MaybeHandle<String> maybe_str1(Object::ToString(isolate, obj1)); |
| 279 MaybeHandle<String> maybe_str2(Object::ToString(isolate, obj2)); |
| 280 Handle<String> str1; |
| 281 Handle<String> str2; |
| 282 maybe_str1.ToHandle(&str1); |
| 283 maybe_str2.ToHandle(&str2); |
| 278 RETURN_RESULT_OR_FAILURE(isolate, | 284 RETURN_RESULT_OR_FAILURE(isolate, |
| 279 isolate->factory()->NewConsString(str1, str2)); | 285 isolate->factory()->NewConsString(str1, str2)); |
| 280 } | 286 } |
| 281 | 287 |
| 282 | 288 |
| 283 RUNTIME_FUNCTION(Runtime_InternalizeString) { | 289 RUNTIME_FUNCTION(Runtime_InternalizeString) { |
| 284 HandleScope handles(isolate); | 290 HandleScope handles(isolate); |
| 285 DCHECK(args.length() == 1); | 291 DCHECK(args.length() == 1); |
| 286 CONVERT_ARG_HANDLE_CHECKED(String, string, 0); | 292 CONVERT_ARG_HANDLE_CHECKED(String, string, 0); |
| 287 return *isolate->factory()->InternalizeString(string); | 293 return *isolate->factory()->InternalizeString(string); |
| (...skipping 880 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1168 SealHandleScope shs(isolate); | 1174 SealHandleScope shs(isolate); |
| 1169 DCHECK(args.length() == 2); | 1175 DCHECK(args.length() == 2); |
| 1170 if (!args[0]->IsString()) return isolate->heap()->undefined_value(); | 1176 if (!args[0]->IsString()) return isolate->heap()->undefined_value(); |
| 1171 if (!args[1]->IsNumber()) return isolate->heap()->undefined_value(); | 1177 if (!args[1]->IsNumber()) return isolate->heap()->undefined_value(); |
| 1172 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(); |
| 1173 return __RT_impl_Runtime_StringCharCodeAtRT(args, isolate); | 1179 return __RT_impl_Runtime_StringCharCodeAtRT(args, isolate); |
| 1174 } | 1180 } |
| 1175 | 1181 |
| 1176 } // namespace internal | 1182 } // namespace internal |
| 1177 } // namespace v8 | 1183 } // namespace v8 |
| OLD | NEW |