Skip to content

Commit 50e60e9

Browse files
hashseedtargos
authored andcommitted
deps: backport dd310b4341 from upstream V8
Original commit message: [crankshaft] Fix string addition to check for max length of cons string. BUG=chromium:678917 Review-Url: https://codereview.chromium.org/2653623002 Cr-Commit-Position: refs/heads/master@{#42621} PR-URL: #12696 Fixes: #12573 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Michaël Zasso <targos@protonmail.com>
1 parent 3e80fc8 commit 50e60e9

3 files changed

Lines changed: 28 additions & 1 deletion

File tree

deps/v8/include/v8-version.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#define V8_MAJOR_VERSION 5
1212
#define V8_MINOR_VERSION 5
1313
#define V8_BUILD_NUMBER 372
14-
#define V8_PATCH_LEVEL 44
14+
#define V8_PATCH_LEVEL 45
1515

1616
// Use 1 for candidates and 0 otherwise.
1717
// (Boolean macro values are not supported by all preprocessors.)

deps/v8/src/crankshaft/hydrogen.cc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2541,6 +2541,9 @@ HValue* HGraphBuilder::BuildUncheckedStringAdd(
25412541
IfBuilder if_createcons(this);
25422542
if_createcons.If<HCompareNumericAndBranch>(
25432543
length, Add<HConstant>(ConsString::kMinLength), Token::GTE);
2544+
if_createcons.And();
2545+
if_createcons.If<HCompareNumericAndBranch>(
2546+
length, Add<HConstant>(ConsString::kMaxLength), Token::LTE);
25442547
if_createcons.Then();
25452548
{
25462549
// Create a cons string.
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// Copyright 2017 the V8 project authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style license that can be
3+
// found in the LICENSE file.
4+
5+
s1 = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';
6+
s1 += s1;
7+
s1 += s1;
8+
s1 += s1;
9+
s1 += s1;
10+
11+
s0 = 'a';
12+
13+
function g() {
14+
for (var j = 0; j < 1000000; j++) {
15+
s0 += s1;
16+
}
17+
}
18+
19+
try {
20+
g();
21+
} catch (e) {
22+
}
23+
24+
assertEquals('x', s0[10]);

0 commit comments

Comments
 (0)