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

Unified Diff: src/objects.cc

Issue 2683903002: Fix missing cases of empty_string canonicalization (Closed)
Patch Set: make LSan happy Created 3 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/mips64/macro-assembler-mips64.cc ('k') | src/objects-debug.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects.cc
diff --git a/src/objects.cc b/src/objects.cc
index 41c3edc707095d860703378924a2ce85d83ea7c4..b53d167e5461d5abe5caa0844a84d6b27ca82f21 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -11708,6 +11708,9 @@ bool String::SlowAsArrayIndex(uint32_t* index) {
Handle<String> SeqString::Truncate(Handle<SeqString> string, int new_length) {
+ Heap* heap = string->GetHeap();
+ if (new_length == 0) return heap->isolate()->factory()->empty_string();
+
int new_size, old_size;
int old_length = string->length();
if (old_length <= new_length) return string;
@@ -11727,7 +11730,6 @@ Handle<String> SeqString::Truncate(Handle<SeqString> string, int new_length) {
DCHECK_OBJECT_ALIGNED(start_of_string);
DCHECK_OBJECT_ALIGNED(start_of_string + new_size);
- Heap* heap = string->GetHeap();
// Sizes are pointer size aligned, so that we can use filler objects
// that are a multiple of pointer size.
heap->CreateFillerObjectAt(start_of_string + new_size, delta,
@@ -11738,7 +11740,6 @@ Handle<String> SeqString::Truncate(Handle<SeqString> string, int new_length) {
// for the left-over space to avoid races with the sweeper thread.
string->synchronized_set_length(new_length);
- if (new_length == 0) return heap->isolate()->factory()->empty_string();
return string;
}
« no previous file with comments | « src/mips64/macro-assembler-mips64.cc ('k') | src/objects-debug.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698