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

Side by Side Diff: src/runtime.cc

Issue 239113002: Handlifying clients of StringTable, step 1. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressing review notes 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
« no previous file with comments | « 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 1988 matching lines...) Expand 10 before | Expand all | Expand 10 after
6735 HandleScope local_loop_handle(isolate); 6735 HandleScope local_loop_handle(isolate);
6736 int part_end = indices.at(i); 6736 int part_end = indices.at(i);
6737 Handle<String> substring = 6737 Handle<String> substring =
6738 isolate->factory()->NewProperSubString(subject, part_start, part_end); 6738 isolate->factory()->NewProperSubString(subject, part_start, part_end);
6739 elements->set(i, *substring); 6739 elements->set(i, *substring);
6740 part_start = part_end + pattern_length; 6740 part_start = part_end + pattern_length;
6741 } 6741 }
6742 6742
6743 if (limit == 0xffffffffu) { 6743 if (limit == 0xffffffffu) {
6744 if (result->HasFastObjectElements()) { 6744 if (result->HasFastObjectElements()) {
6745 RegExpResultsCache::Enter(isolate->heap(), 6745 RegExpResultsCache::Enter(isolate,
6746 *subject, 6746 subject,
6747 *pattern, 6747 pattern,
6748 *elements, 6748 elements,
6749 RegExpResultsCache::STRING_SPLIT_SUBSTRINGS); 6749 RegExpResultsCache::STRING_SPLIT_SUBSTRINGS);
6750 } 6750 }
6751 } 6751 }
6752 6752
6753 return *result; 6753 return *result;
6754 } 6754 }
6755 6755
6756 6756
6757 // Copies ASCII characters to the given fixed array looking up 6757 // Copies ASCII characters to the given fixed array looking up
6758 // one-char strings in the cache. Gives up on the first char that is 6758 // one-char strings in the cache. Gives up on the first char that is
(...skipping 8318 matching lines...) Expand 10 before | Expand all | Expand 10 after
15077 } 15077 }
15078 } 15078 }
15079 15079
15080 15080
15081 void Runtime::OutOfMemory() { 15081 void Runtime::OutOfMemory() {
15082 Heap::FatalProcessOutOfMemory("CALL_AND_RETRY_LAST", true); 15082 Heap::FatalProcessOutOfMemory("CALL_AND_RETRY_LAST", true);
15083 UNREACHABLE(); 15083 UNREACHABLE();
15084 } 15084 }
15085 15085
15086 } } // namespace v8::internal 15086 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/objects.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698