Revision: 20433
Author: [email protected]
Date: Wed Apr 2 12:24:42 2014 UTC
Log: Fix HGraphBuilder::BuildAddStringLengths
length == String::kMaxLength is fine and should not bail out.
BUG=chromium:357052
LOG=n
[email protected]
Review URL: https://codereview.chromium.org/222113002
http://code.google.com/p/v8/source/detail?r=20433
Added:
/branches/bleeding_edge/test/mjsunit/regress/regress-crbug-357052.js
Modified:
/branches/bleeding_edge/src/hydrogen.cc
=======================================
--- /dev/null
+++ /branches/bleeding_edge/test/mjsunit/regress/regress-crbug-357052.js
Wed Apr 2 12:24:42 2014 UTC
@@ -0,0 +1,11 @@
+// Copyright 2014 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.
+
+function f() {
+ var str = "";
+ for (var i = 0; i < 30; i++) {
+ str += "abcdefgh12345678" + str;
+ }
+}
+assertThrows(f);
=======================================
--- /branches/bleeding_edge/src/hydrogen.cc Tue Apr 1 11:21:20 2014 UTC
+++ /branches/bleeding_edge/src/hydrogen.cc Wed Apr 2 12:24:42 2014 UTC
@@ -1794,7 +1794,8 @@
HValue* right_length) {
// Compute the combined string length and check against max string
length.
HValue* length = AddUncasted<HAdd>(left_length, right_length);
- HValue* max_length = Add<HConstant>(String::kMaxLength);
+ // Check that length <= kMaxLength <=> length < MaxLength + 1.
+ HValue* max_length = Add<HConstant>(String::kMaxLength + 1);
Add<HBoundsCheck>(length, max_length);
return length;
}
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.