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

Unified Diff: src/objects.cc

Issue 2489273002: Fast-path in SlowFlatten for ConsStrings with empty first part (Closed)
Patch Set: Ensure string length does not change in test Created 4 years, 1 month 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 | « no previous file | test/cctest/test-strings.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 fb31d83e31c602519965877be4b0cdc5c602768a..4ee90a7f953625fc76cfc492f539be6a1783729e 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -2215,8 +2215,12 @@ static bool AnWord(String* str) {
Handle<String> String::SlowFlatten(Handle<ConsString> cons,
PretenureFlag pretenure) {
- DCHECK(AllowHeapAllocation::IsAllowed());
DCHECK(cons->second()->length() != 0);
+
+ // TurboFan can create cons strings with empty first parts.
+ if (cons->first()->length() == 0) return handle(cons->second());
+
+ DCHECK(AllowHeapAllocation::IsAllowed());
Isolate* isolate = cons->GetIsolate();
int length = cons->length();
PretenureFlag tenure = isolate->heap()->InNewSpace(*cons) ? pretenure
« no previous file with comments | « no previous file | test/cctest/test-strings.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698