OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/ast.h" | 7 #include "src/ast.h" |
8 #include "src/base/platform/platform.h" | 8 #include "src/base/platform/platform.h" |
9 #include "src/compilation-cache.h" | 9 #include "src/compilation-cache.h" |
10 #include "src/compiler.h" | 10 #include "src/compiler.h" |
(...skipping 606 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
617 return isolate->factory()->null_value(); | 617 return isolate->factory()->null_value(); |
618 } | 618 } |
619 | 619 |
620 | 620 |
621 Handle<JSArray> RegExpImpl::SetLastMatchInfo(Handle<JSArray> last_match_info, | 621 Handle<JSArray> RegExpImpl::SetLastMatchInfo(Handle<JSArray> last_match_info, |
622 Handle<String> subject, | 622 Handle<String> subject, |
623 int capture_count, | 623 int capture_count, |
624 int32_t* match) { | 624 int32_t* match) { |
625 DCHECK(last_match_info->HasFastObjectElements()); | 625 DCHECK(last_match_info->HasFastObjectElements()); |
626 int capture_register_count = (capture_count + 1) * 2; | 626 int capture_register_count = (capture_count + 1) * 2; |
627 JSArray::EnsureSize(last_match_info, | 627 JSArray::SetLength(last_match_info, |
628 capture_register_count + kLastMatchOverhead); | 628 capture_register_count + kLastMatchOverhead); |
629 DisallowHeapAllocation no_allocation; | 629 DisallowHeapAllocation no_allocation; |
630 FixedArray* array = FixedArray::cast(last_match_info->elements()); | 630 FixedArray* array = FixedArray::cast(last_match_info->elements()); |
631 if (match != NULL) { | 631 if (match != NULL) { |
632 for (int i = 0; i < capture_register_count; i += 2) { | 632 for (int i = 0; i < capture_register_count; i += 2) { |
633 SetCapture(array, i, match[i]); | 633 SetCapture(array, i, match[i]); |
634 SetCapture(array, i + 1, match[i + 1]); | 634 SetCapture(array, i + 1, match[i + 1]); |
635 } | 635 } |
636 } | 636 } |
637 SetLastCaptureCount(array, capture_register_count); | 637 SetLastCaptureCount(array, capture_register_count); |
638 SetLastSubject(array, *subject); | 638 SetLastSubject(array, *subject); |
(...skipping 5710 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6349 bool too_much = pattern->length() > RegExpImpl::kRegExpTooLargeToOptimize; | 6349 bool too_much = pattern->length() > RegExpImpl::kRegExpTooLargeToOptimize; |
6350 if (heap->total_regexp_code_generated() > RegExpImpl::kRegExpCompiledLimit && | 6350 if (heap->total_regexp_code_generated() > RegExpImpl::kRegExpCompiledLimit && |
6351 heap->isolate()->memory_allocator()->SizeExecutable() > | 6351 heap->isolate()->memory_allocator()->SizeExecutable() > |
6352 RegExpImpl::kRegExpExecutableMemoryLimit) { | 6352 RegExpImpl::kRegExpExecutableMemoryLimit) { |
6353 too_much = true; | 6353 too_much = true; |
6354 } | 6354 } |
6355 return too_much; | 6355 return too_much; |
6356 } | 6356 } |
6357 } // namespace internal | 6357 } // namespace internal |
6358 } // namespace v8 | 6358 } // namespace v8 |
OLD | NEW |