| 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 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 CONVERT_ARG_HANDLE_CHECKED(JSRegExp, regexp, 1); | 174 CONVERT_ARG_HANDLE_CHECKED(JSRegExp, regexp, 1); |
| 175 CONVERT_ARG_HANDLE_CHECKED(JSArray, regexp_info, 2); | 175 CONVERT_ARG_HANDLE_CHECKED(JSArray, regexp_info, 2); |
| 176 | 176 |
| 177 CHECK(regexp_info->HasFastObjectElements()); | 177 CHECK(regexp_info->HasFastObjectElements()); |
| 178 | 178 |
| 179 RegExpImpl::GlobalCache global_cache(regexp, subject, isolate); | 179 RegExpImpl::GlobalCache global_cache(regexp, subject, isolate); |
| 180 if (global_cache.HasException()) return isolate->heap()->exception(); | 180 if (global_cache.HasException()) return isolate->heap()->exception(); |
| 181 | 181 |
| 182 int capture_count = regexp->CaptureCount(); | 182 int capture_count = regexp->CaptureCount(); |
| 183 | 183 |
| 184 ZoneScope zone_scope(isolate->runtime_zone()); | 184 Zone zone(isolate->allocator()); |
| 185 ZoneList<int> offsets(8, zone_scope.zone()); | 185 ZoneList<int> offsets(8, &zone); |
| 186 | 186 |
| 187 while (true) { | 187 while (true) { |
| 188 int32_t* match = global_cache.FetchNext(); | 188 int32_t* match = global_cache.FetchNext(); |
| 189 if (match == NULL) break; | 189 if (match == NULL) break; |
| 190 offsets.Add(match[0], zone_scope.zone()); // start | 190 offsets.Add(match[0], &zone); // start |
| 191 offsets.Add(match[1], zone_scope.zone()); // end | 191 offsets.Add(match[1], &zone); // end |
| 192 } | 192 } |
| 193 | 193 |
| 194 if (global_cache.HasException()) return isolate->heap()->exception(); | 194 if (global_cache.HasException()) return isolate->heap()->exception(); |
| 195 | 195 |
| 196 if (offsets.length() == 0) { | 196 if (offsets.length() == 0) { |
| 197 // Not a single match. | 197 // Not a single match. |
| 198 return isolate->heap()->null_value(); | 198 return isolate->heap()->null_value(); |
| 199 } | 199 } |
| 200 | 200 |
| 201 RegExpImpl::SetLastMatchInfo(regexp_info, subject, capture_count, | 201 RegExpImpl::SetLastMatchInfo(regexp_info, subject, capture_count, |
| (...skipping 844 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1046 SealHandleScope shs(isolate); | 1046 SealHandleScope shs(isolate); |
| 1047 DCHECK(args.length() == 2); | 1047 DCHECK(args.length() == 2); |
| 1048 if (!args[0]->IsString()) return isolate->heap()->undefined_value(); | 1048 if (!args[0]->IsString()) return isolate->heap()->undefined_value(); |
| 1049 if (!args[1]->IsNumber()) return isolate->heap()->undefined_value(); | 1049 if (!args[1]->IsNumber()) return isolate->heap()->undefined_value(); |
| 1050 if (std::isinf(args.number_at(1))) return isolate->heap()->nan_value(); | 1050 if (std::isinf(args.number_at(1))) return isolate->heap()->nan_value(); |
| 1051 return __RT_impl_Runtime_StringCharCodeAtRT(args, isolate); | 1051 return __RT_impl_Runtime_StringCharCodeAtRT(args, isolate); |
| 1052 } | 1052 } |
| 1053 | 1053 |
| 1054 } // namespace internal | 1054 } // namespace internal |
| 1055 } // namespace v8 | 1055 } // namespace v8 |
| OLD | NEW |