OLD | NEW |
---|---|
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 3514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3525 CONVERT_ARG_CHECKED(JSRegExp, regexp, 0); | 3525 CONVERT_ARG_CHECKED(JSRegExp, regexp, 0); |
3526 CONVERT_ARG_CHECKED(JSArray, last_match_info, 2); | 3526 CONVERT_ARG_CHECKED(JSArray, last_match_info, 2); |
3527 CONVERT_ARG_CHECKED(JSArray, result_array, 3); | 3527 CONVERT_ARG_CHECKED(JSArray, result_array, 3); |
3528 | 3528 |
3529 ASSERT(last_match_info->HasFastElements()); | 3529 ASSERT(last_match_info->HasFastElements()); |
3530 ASSERT(regexp->GetFlags().is_global()); | 3530 ASSERT(regexp->GetFlags().is_global()); |
3531 Handle<FixedArray> result_elements; | 3531 Handle<FixedArray> result_elements; |
3532 if (result_array->HasFastElements()) { | 3532 if (result_array->HasFastElements()) { |
3533 result_elements = | 3533 result_elements = |
3534 Handle<FixedArray>(FixedArray::cast(result_array->elements())); | 3534 Handle<FixedArray>(FixedArray::cast(result_array->elements())); |
3535 } else { | 3535 } |
3536 if (result_elements.is_null() || result_elements->length() < 16) { | |
Mads Ager (chromium)
2011/06/23 06:37:04
Is this an unrelated change?
Mads Ager (chromium)
2011/06/23 08:54:08
Nevermind, just read the change description. :-)
| |
3536 result_elements = isolate->factory()->NewFixedArrayWithHoles(16); | 3537 result_elements = isolate->factory()->NewFixedArrayWithHoles(16); |
3537 } | 3538 } |
3538 FixedArrayBuilder builder(result_elements); | 3539 FixedArrayBuilder builder(result_elements); |
3539 | 3540 |
3540 if (regexp->TypeTag() == JSRegExp::ATOM) { | 3541 if (regexp->TypeTag() == JSRegExp::ATOM) { |
3541 Handle<String> pattern( | 3542 Handle<String> pattern( |
3542 String::cast(regexp->DataAt(JSRegExp::kAtomPatternIndex))); | 3543 String::cast(regexp->DataAt(JSRegExp::kAtomPatternIndex))); |
3543 ASSERT(pattern->IsFlat()); | 3544 ASSERT(pattern->IsFlat()); |
3544 if (SearchStringMultiple(isolate, subject, pattern, | 3545 if (SearchStringMultiple(isolate, subject, pattern, |
3545 last_match_info, &builder)) { | 3546 last_match_info, &builder)) { |
(...skipping 8936 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
12482 } else { | 12483 } else { |
12483 // Handle last resort GC and make sure to allow future allocations | 12484 // Handle last resort GC and make sure to allow future allocations |
12484 // to grow the heap without causing GCs (if possible). | 12485 // to grow the heap without causing GCs (if possible). |
12485 isolate->counters()->gc_last_resort_from_js()->Increment(); | 12486 isolate->counters()->gc_last_resort_from_js()->Increment(); |
12486 isolate->heap()->CollectAllGarbage(false); | 12487 isolate->heap()->CollectAllGarbage(false); |
12487 } | 12488 } |
12488 } | 12489 } |
12489 | 12490 |
12490 | 12491 |
12491 } } // namespace v8::internal | 12492 } } // namespace v8::internal |
OLD | NEW |