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:
parent
8e283057aa
commit
da27e0c886
@ -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;
|
||||
}
|
||||
|
8
test/mjsunit/regress/regress-5440.js
Normal file
8
test/mjsunit/regress/regress-5440.js
Normal 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 (_) {}"));
|
Loading…
Reference in New Issue
Block a user