Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(289)

Side by Side Diff: src/runtime.cc

Issue 7840031: JSArray can go slow case during String.split. Guard against (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 9 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/objects-debug.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « src/objects-debug.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698