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 } |
266 | 269 |
267 if (one_byte) { | 270 if (one_byte) { |
268 Handle<SeqOneByteString> answer; | 271 Handle<SeqOneByteString> answer; |
269 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( | 272 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
270 isolate, answer, isolate->factory()->NewRawOneByteString(length)); | 273 isolate, answer, isolate->factory()->NewRawOneByteString(length)); |
271 StringBuilderConcatHelper(*special, answer->GetChars(), | 274 StringBuilderConcatHelper(*special, answer->GetChars(), |
272 FixedArray::cast(array->elements()), | 275 FixedArray::cast(array->elements()), |
273 array_length); | 276 array_length); |
274 return *answer; | 277 return *answer; |
275 } else { | 278 } else { |
(...skipping 608 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
884 SealHandleScope shs(isolate); | 887 SealHandleScope shs(isolate); |
885 DCHECK_EQ(2, args.length()); | 888 DCHECK_EQ(2, args.length()); |
886 if (!args[0]->IsString()) return isolate->heap()->undefined_value(); | 889 if (!args[0]->IsString()) return isolate->heap()->undefined_value(); |
887 if (!args[1]->IsNumber()) return isolate->heap()->undefined_value(); | 890 if (!args[1]->IsNumber()) return isolate->heap()->undefined_value(); |
888 if (std::isinf(args.number_at(1))) return isolate->heap()->nan_value(); | 891 if (std::isinf(args.number_at(1))) return isolate->heap()->nan_value(); |
889 return __RT_impl_Runtime_StringCharCodeAtRT(args, isolate); | 892 return __RT_impl_Runtime_StringCharCodeAtRT(args, isolate); |
890 } | 893 } |
891 | 894 |
892 } // namespace internal | 895 } // namespace internal |
893 } // namespace v8 | 896 } // namespace v8 |
OLD | NEW |