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/conversions-inl.h" | 8 #include "src/conversions-inl.h" |
9 #include "src/isolate-inl.h" | 9 #include "src/isolate-inl.h" |
10 #include "src/messages.h" | 10 #include "src/messages.h" |
(...skipping 716 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
727 indices.Add(subject_length, zone_scope.zone()); | 727 indices.Add(subject_length, zone_scope.zone()); |
728 } | 728 } |
729 | 729 |
730 // The list indices now contains the end of each part to create. | 730 // The list indices now contains the end of each part to create. |
731 | 731 |
732 // Create JSArray of substrings separated by separator. | 732 // Create JSArray of substrings separated by separator. |
733 int part_count = indices.length(); | 733 int part_count = indices.length(); |
734 | 734 |
735 Handle<JSArray> result = | 735 Handle<JSArray> result = |
736 isolate->factory()->NewJSArray(FAST_ELEMENTS, part_count, part_count, | 736 isolate->factory()->NewJSArray(FAST_ELEMENTS, part_count, part_count, |
737 INITIALIZE_ARRAY_ELEMENTS_WITH_UNDEFINED); | 737 INITIALIZE_ARRAY_ELEMENTS_WITH_HOLE); |
738 | 738 |
739 DCHECK(result->HasFastObjectElements()); | 739 DCHECK(result->HasFastObjectElements()); |
740 | 740 |
741 Handle<FixedArray> elements(FixedArray::cast(result->elements())); | 741 Handle<FixedArray> elements(FixedArray::cast(result->elements())); |
742 | 742 |
743 if (part_count == 1 && indices.at(0) == subject_length) { | 743 if (part_count == 1 && indices.at(0) == subject_length) { |
744 elements->set(0, *subject); | 744 elements->set(0, *subject); |
745 } else { | 745 } else { |
746 int part_start = 0; | 746 int part_start = 0; |
747 FOR_WITH_HANDLE_SCOPE(isolate, int, i = 0, i, i < part_count, i++, { | 747 FOR_WITH_HANDLE_SCOPE(isolate, int, i = 0, i, i < part_count, i++, { |
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1016 | 1016 |
1017 | 1017 |
1018 RUNTIME_FUNCTION(Runtime_IsRegExp) { | 1018 RUNTIME_FUNCTION(Runtime_IsRegExp) { |
1019 SealHandleScope shs(isolate); | 1019 SealHandleScope shs(isolate); |
1020 DCHECK(args.length() == 1); | 1020 DCHECK(args.length() == 1); |
1021 CONVERT_ARG_CHECKED(Object, obj, 0); | 1021 CONVERT_ARG_CHECKED(Object, obj, 0); |
1022 return isolate->heap()->ToBoolean(obj->IsJSRegExp()); | 1022 return isolate->heap()->ToBoolean(obj->IsJSRegExp()); |
1023 } | 1023 } |
1024 } // namespace internal | 1024 } // namespace internal |
1025 } // namespace v8 | 1025 } // namespace v8 |
OLD | NEW |