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 6073 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6084 for (int i = 0; i < part_count; i++) { | 6084 for (int i = 0; i < part_count; i++) { |
6085 HandleScope local_loop_handle; | 6085 HandleScope local_loop_handle; |
6086 int part_end = indices.at(i); | 6086 int part_end = indices.at(i); |
6087 Handle<String> substring = | 6087 Handle<String> substring = |
6088 isolate->factory()->NewProperSubString(subject, part_start, part_end); | 6088 isolate->factory()->NewProperSubString(subject, part_start, part_end); |
6089 elements->set(i, *substring); | 6089 elements->set(i, *substring); |
6090 part_start = part_end + pattern_length; | 6090 part_start = part_end + pattern_length; |
6091 } | 6091 } |
6092 | 6092 |
6093 if (limit == 0xffffffffu) { | 6093 if (limit == 0xffffffffu) { |
6094 StringSplitCache::Enter(isolate->heap(), | 6094 if (result->HasFastElements()) { |
6095 isolate->heap()->string_split_cache(), | 6095 StringSplitCache::Enter(isolate->heap(), |
6096 *subject, | 6096 isolate->heap()->string_split_cache(), |
6097 *pattern, | 6097 *subject, |
6098 *elements); | 6098 *pattern, |
| 6099 *elements); |
| 6100 } |
6099 } | 6101 } |
6100 | 6102 |
6101 return *result; | 6103 return *result; |
6102 } | 6104 } |
6103 | 6105 |
6104 | 6106 |
6105 // Copies ascii characters to the given fixed array looking up | 6107 // Copies ascii characters to the given fixed array looking up |
6106 // one-char strings in the cache. Gives up on the first char that is | 6108 // one-char strings in the cache. Gives up on the first char that is |
6107 // not in the cache and fills the remainder with smi zeros. Returns | 6109 // not in the cache and fills the remainder with smi zeros. Returns |
6108 // the length of the successfully copied prefix. | 6110 // the length of the successfully copied prefix. |
(...skipping 6913 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13022 } else { | 13024 } else { |
13023 // Handle last resort GC and make sure to allow future allocations | 13025 // Handle last resort GC and make sure to allow future allocations |
13024 // to grow the heap without causing GCs (if possible). | 13026 // to grow the heap without causing GCs (if possible). |
13025 isolate->counters()->gc_last_resort_from_js()->Increment(); | 13027 isolate->counters()->gc_last_resort_from_js()->Increment(); |
13026 isolate->heap()->CollectAllGarbage(false); | 13028 isolate->heap()->CollectAllGarbage(false); |
13027 } | 13029 } |
13028 } | 13030 } |
13029 | 13031 |
13030 | 13032 |
13031 } } // namespace v8::internal | 13033 } } // namespace v8::internal |
OLD | NEW |