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-case.h" | 10 #include "src/string-case.h" |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 Object* first = fixed_array->get(0); | 256 Object* first = fixed_array->get(0); |
257 if (first->IsString()) return first; | 257 if (first->IsString()) return first; |
258 } | 258 } |
259 length = StringBuilderConcatLength(special_length, fixed_array, | 259 length = StringBuilderConcatLength(special_length, fixed_array, |
260 array_length, &one_byte); | 260 array_length, &one_byte); |
261 } | 261 } |
262 | 262 |
263 if (length == -1) { | 263 if (length == -1) { |
264 return isolate->Throw(isolate->heap()->illegal_argument_string()); | 264 return isolate->Throw(isolate->heap()->illegal_argument_string()); |
265 } | 265 } |
266 if (length == 0) { | |
267 return isolate->heap()->empty_string(); | |
268 } | |
269 | 266 |
270 if (one_byte) { | 267 if (one_byte) { |
271 Handle<SeqOneByteString> answer; | 268 Handle<SeqOneByteString> answer; |
272 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( | 269 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
273 isolate, answer, isolate->factory()->NewRawOneByteString(length)); | 270 isolate, answer, isolate->factory()->NewRawOneByteString(length)); |
274 StringBuilderConcatHelper(*special, answer->GetChars(), | 271 StringBuilderConcatHelper(*special, answer->GetChars(), |
275 FixedArray::cast(array->elements()), | 272 FixedArray::cast(array->elements()), |
276 array_length); | 273 array_length); |
277 return *answer; | 274 return *answer; |
278 } else { | 275 } else { |
(...skipping 608 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
887 SealHandleScope shs(isolate); | 884 SealHandleScope shs(isolate); |
888 DCHECK_EQ(2, args.length()); | 885 DCHECK_EQ(2, args.length()); |
889 if (!args[0]->IsString()) return isolate->heap()->undefined_value(); | 886 if (!args[0]->IsString()) return isolate->heap()->undefined_value(); |
890 if (!args[1]->IsNumber()) return isolate->heap()->undefined_value(); | 887 if (!args[1]->IsNumber()) return isolate->heap()->undefined_value(); |
891 if (std::isinf(args.number_at(1))) return isolate->heap()->nan_value(); | 888 if (std::isinf(args.number_at(1))) return isolate->heap()->nan_value(); |
892 return __RT_impl_Runtime_StringCharCodeAtRT(args, isolate); | 889 return __RT_impl_Runtime_StringCharCodeAtRT(args, isolate); |
893 } | 890 } |
894 | 891 |
895 } // namespace internal | 892 } // namespace internal |
896 } // namespace v8 | 893 } // namespace v8 |
OLD | NEW |