| 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 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 CONVERT_ARG_HANDLE_CHECKED(JSRegExp, regexp, 1); | 258 CONVERT_ARG_HANDLE_CHECKED(JSRegExp, regexp, 1); |
| 259 CONVERT_ARG_HANDLE_CHECKED(JSArray, regexp_info, 2); | 259 CONVERT_ARG_HANDLE_CHECKED(JSArray, regexp_info, 2); |
| 260 | 260 |
| 261 CHECK(regexp_info->HasFastObjectElements()); | 261 CHECK(regexp_info->HasFastObjectElements()); |
| 262 | 262 |
| 263 RegExpImpl::GlobalCache global_cache(regexp, subject, isolate); | 263 RegExpImpl::GlobalCache global_cache(regexp, subject, isolate); |
| 264 if (global_cache.HasException()) return isolate->heap()->exception(); | 264 if (global_cache.HasException()) return isolate->heap()->exception(); |
| 265 | 265 |
| 266 int capture_count = regexp->CaptureCount(); | 266 int capture_count = regexp->CaptureCount(); |
| 267 | 267 |
| 268 ZoneScope zone_scope(isolate->runtime_zone()); | 268 Zone zone(isolate->allocator()); |
| 269 ZoneList<int> offsets(8, zone_scope.zone()); | 269 ZoneList<int> offsets(8, &zone); |
| 270 | 270 |
| 271 while (true) { | 271 while (true) { |
| 272 int32_t* match = global_cache.FetchNext(); | 272 int32_t* match = global_cache.FetchNext(); |
| 273 if (match == NULL) break; | 273 if (match == NULL) break; |
| 274 offsets.Add(match[0], zone_scope.zone()); // start | 274 offsets.Add(match[0], &zone); // start |
| 275 offsets.Add(match[1], zone_scope.zone()); // end | 275 offsets.Add(match[1], &zone); // end |
| 276 } | 276 } |
| 277 | 277 |
| 278 if (global_cache.HasException()) return isolate->heap()->exception(); | 278 if (global_cache.HasException()) return isolate->heap()->exception(); |
| 279 | 279 |
| 280 if (offsets.length() == 0) { | 280 if (offsets.length() == 0) { |
| 281 // Not a single match. | 281 // Not a single match. |
| 282 return isolate->heap()->null_value(); | 282 return isolate->heap()->null_value(); |
| 283 } | 283 } |
| 284 | 284 |
| 285 RegExpImpl::SetLastMatchInfo(regexp_info, subject, capture_count, | 285 RegExpImpl::SetLastMatchInfo(regexp_info, subject, capture_count, |
| (...skipping 844 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1130 SealHandleScope shs(isolate); | 1130 SealHandleScope shs(isolate); |
| 1131 DCHECK(args.length() == 2); | 1131 DCHECK(args.length() == 2); |
| 1132 if (!args[0]->IsString()) return isolate->heap()->undefined_value(); | 1132 if (!args[0]->IsString()) return isolate->heap()->undefined_value(); |
| 1133 if (!args[1]->IsNumber()) return isolate->heap()->undefined_value(); | 1133 if (!args[1]->IsNumber()) return isolate->heap()->undefined_value(); |
| 1134 if (std::isinf(args.number_at(1))) return isolate->heap()->nan_value(); | 1134 if (std::isinf(args.number_at(1))) return isolate->heap()->nan_value(); |
| 1135 return __RT_impl_Runtime_StringCharCodeAtRT(args, isolate); | 1135 return __RT_impl_Runtime_StringCharCodeAtRT(args, isolate); |
| 1136 } | 1136 } |
| 1137 | 1137 |
| 1138 } // namespace internal | 1138 } // namespace internal |
| 1139 } // namespace v8 | 1139 } // namespace v8 |
| OLD | NEW |