Chromium Code Reviews| 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 5787 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5798 ASSERT(result->HasFastElements()); | 5798 ASSERT(result->HasFastElements()); |
| 5799 | 5799 |
| 5800 if (part_count == 1 && indices.at(0) == subject_length) { | 5800 if (part_count == 1 && indices.at(0) == subject_length) { |
| 5801 FixedArray::cast(result->elements())->set(0, *subject); | 5801 FixedArray::cast(result->elements())->set(0, *subject); |
| 5802 return *result; | 5802 return *result; |
| 5803 } | 5803 } |
| 5804 | 5804 |
| 5805 Handle<FixedArray> elements(FixedArray::cast(result->elements())); | 5805 Handle<FixedArray> elements(FixedArray::cast(result->elements())); |
| 5806 int part_start = 0; | 5806 int part_start = 0; |
| 5807 for (int i = 0; i < part_count; i++) { | 5807 for (int i = 0; i < part_count; i++) { |
| 5808 HandleScope local_loop_handle; | |
| 5809 int part_end = indices.at(i); | 5808 int part_end = indices.at(i); |
| 5810 Handle<String> substring = | 5809 Object* result; |
| 5811 isolate->factory()->NewSubString(subject, part_start, part_end); | 5810 { MaybeObject* maybe_result = isolate->heap()->AllocateSubString(*subject, |
| 5812 elements->set(i, *substring); | 5811 part_start, |
|
Lasse Reichstein
2011/06/10 07:32:17
This is an unpretty combination of handle and non-
sandholm
2011/06/10 10:13:31
Done.
| |
| 5812 part_end); | |
| 5813 if (!maybe_result->ToObject(&result)) return maybe_result; | |
| 5814 } | |
| 5815 elements->set(i, result); | |
| 5813 part_start = part_end + pattern_length; | 5816 part_start = part_end + pattern_length; |
| 5814 } | 5817 } |
| 5815 | 5818 |
| 5816 return *result; | 5819 return *result; |
| 5817 } | 5820 } |
| 5818 | 5821 |
| 5819 | 5822 |
| 5820 // Copies ascii characters to the given fixed array looking up | 5823 // Copies ascii characters to the given fixed array looking up |
| 5821 // one-char strings in the cache. Gives up on the first char that is | 5824 // one-char strings in the cache. Gives up on the first char that is |
| 5822 // not in the cache and fills the remainder with smi zeros. Returns | 5825 // not in the cache and fills the remainder with smi zeros. Returns |
| (...skipping 6540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 12363 } else { | 12366 } else { |
| 12364 // Handle last resort GC and make sure to allow future allocations | 12367 // Handle last resort GC and make sure to allow future allocations |
| 12365 // to grow the heap without causing GCs (if possible). | 12368 // to grow the heap without causing GCs (if possible). |
| 12366 isolate->counters()->gc_last_resort_from_js()->Increment(); | 12369 isolate->counters()->gc_last_resort_from_js()->Increment(); |
| 12367 isolate->heap()->CollectAllGarbage(false); | 12370 isolate->heap()->CollectAllGarbage(false); |
| 12368 } | 12371 } |
| 12369 } | 12372 } |
| 12370 | 12373 |
| 12371 | 12374 |
| 12372 } } // namespace v8::internal | 12375 } } // namespace v8::internal |
| OLD | NEW |