Allow empty first parts of ConsStrings

TurboFan lowering (see [0]) of ConsString creation cannot ensure that
the first part of the cons string is non-empty without introducing a phi
and negatively impacting performance.

This modifies ConsStringIterator to allow empty first parts of
ConsStrings.

BUG=v8:5440

Review-Url: https://codereview.chromium.org/2377983002
Cr-Commit-Position: refs/heads/master@{#39817}
This commit is contained in:
jgruber 2016-09-28 02:46:39 -07:00 committed by Commit bot
parent 8e283057aa
commit da27e0c886
2 changed files with 9 additions and 1 deletions

View File

@ -11092,7 +11092,7 @@ String* ConsStringIterator::NextLeaf(bool* blew_stack) {
if ((type & kStringRepresentationMask) != kConsStringTag) {
AdjustMaximumDepth();
int length = string->length();
DCHECK(length != 0);
if (length == 0) break; // Skip empty left-hand sides of ConsStrings.
consumed_ += length;
return string;
}

View File

@ -0,0 +1,8 @@
// Copyright 2016 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --turbo --always-opt
// The rightmost cons string is created first, resulting in an empty left part.
eval(" " + ("" + "try {;} catch (_) {}"));