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

Side by Side Diff: src/runtime.cc

Issue 238263003: Reland r20772 "Handlifying clients of StringTable, step 1." (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: The fix Created 6 years, 8 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
« src/heap.cc ('K') | « src/objects.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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 4712 matching lines...) Expand 10 before | Expand all | Expand 10 after
4723 last_match_array, subject, capture_count, NULL); 4723 last_match_array, subject, capture_count, NULL);
4724 4724
4725 if (subject_length > kMinLengthToCache) { 4725 if (subject_length > kMinLengthToCache) {
4726 // Store the length of the result array into the last element of the 4726 // Store the length of the result array into the last element of the
4727 // backing FixedArray. 4727 // backing FixedArray.
4728 builder.EnsureCapacity(1); 4728 builder.EnsureCapacity(1);
4729 Handle<FixedArray> fixed_array = builder.array(); 4729 Handle<FixedArray> fixed_array = builder.array();
4730 fixed_array->set(fixed_array->length() - 1, 4730 fixed_array->set(fixed_array->length() - 1,
4731 Smi::FromInt(builder.length())); 4731 Smi::FromInt(builder.length()));
4732 // Cache the result and turn the FixedArray into a COW array. 4732 // Cache the result and turn the FixedArray into a COW array.
4733 RegExpResultsCache::Enter(isolate->heap(), 4733 RegExpResultsCache::Enter(isolate,
4734 *subject, 4734 subject,
4735 regexp->data(), 4735 handle(regexp->data(), isolate),
4736 *fixed_array, 4736 fixed_array,
4737 RegExpResultsCache::REGEXP_MULTIPLE_INDICES); 4737 RegExpResultsCache::REGEXP_MULTIPLE_INDICES);
4738 } 4738 }
4739 return *builder.ToJSArray(result_array); 4739 return *builder.ToJSArray(result_array);
4740 } else { 4740 } else {
4741 return isolate->heap()->null_value(); // No matches at all. 4741 return isolate->heap()->null_value(); // No matches at all.
4742 } 4742 }
4743 } 4743 }
4744 4744
4745 4745
4746 // This is only called for StringReplaceGlobalRegExpWithFunction. This sets 4746 // This is only called for StringReplaceGlobalRegExpWithFunction. This sets
(...skipping 2003 matching lines...) Expand 10 before | Expand all | Expand 10 after
6750 HandleScope local_loop_handle(isolate); 6750 HandleScope local_loop_handle(isolate);
6751 int part_end = indices.at(i); 6751 int part_end = indices.at(i);
6752 Handle<String> substring = 6752 Handle<String> substring =
6753 isolate->factory()->NewProperSubString(subject, part_start, part_end); 6753 isolate->factory()->NewProperSubString(subject, part_start, part_end);
6754 elements->set(i, *substring); 6754 elements->set(i, *substring);
6755 part_start = part_end + pattern_length; 6755 part_start = part_end + pattern_length;
6756 } 6756 }
6757 6757
6758 if (limit == 0xffffffffu) { 6758 if (limit == 0xffffffffu) {
6759 if (result->HasFastObjectElements()) { 6759 if (result->HasFastObjectElements()) {
6760 RegExpResultsCache::Enter(isolate->heap(), 6760 RegExpResultsCache::Enter(isolate,
6761 *subject, 6761 subject,
6762 *pattern, 6762 pattern,
6763 *elements, 6763 elements,
6764 RegExpResultsCache::STRING_SPLIT_SUBSTRINGS); 6764 RegExpResultsCache::STRING_SPLIT_SUBSTRINGS);
6765 } 6765 }
6766 } 6766 }
6767 6767
6768 return *result; 6768 return *result;
6769 } 6769 }
6770 6770
6771 6771
6772 // Copies ASCII characters to the given fixed array looking up 6772 // Copies ASCII characters to the given fixed array looking up
6773 // one-char strings in the cache. Gives up on the first char that is 6773 // one-char strings in the cache. Gives up on the first char that is
(...skipping 8320 matching lines...) Expand 10 before | Expand all | Expand 10 after
15094 } 15094 }
15095 } 15095 }
15096 15096
15097 15097
15098 void Runtime::OutOfMemory() { 15098 void Runtime::OutOfMemory() {
15099 Heap::FatalProcessOutOfMemory("CALL_AND_RETRY_LAST", true); 15099 Heap::FatalProcessOutOfMemory("CALL_AND_RETRY_LAST", true);
15100 UNREACHABLE(); 15100 UNREACHABLE();
15101 } 15101 }
15102 15102
15103 } } // namespace v8::internal 15103 } } // namespace v8::internal
OLDNEW
« src/heap.cc ('K') | « src/objects.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698