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

Unified Diff: src/string.js

Issue 1226143009: Fix limit calculation in String.prototype.split (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fixed test expectations Created 5 years, 5 months 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/test262-es6/test262-es6.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/string.js
diff --git a/src/string.js b/src/string.js
index 3ddd6d26cedfd9e49a5e624e071f0caeb005fba7..9a19258dd69388318e3e2686b8ed3b305277f6dd 100644
--- a/src/string.js
+++ b/src/string.js
@@ -10,6 +10,7 @@
// Imports
var GlobalRegExp = global.RegExp;
+var GlobalNumber = global.Number;
var GlobalString = global.String;
var InternalArray = utils.InternalArray;
var InternalPackedArray = utils.InternalPackedArray;
@@ -608,7 +609,8 @@ function StringSplitJS(separator, limit) {
CHECK_OBJECT_COERCIBLE(this, "String.prototype.split");
var subject = TO_STRING_INLINE(this);
- limit = (IS_UNDEFINED(limit)) ? 0xffffffff : TO_UINT32(limit);
+ limit = IS_UNDEFINED(limit) ? GlobalNumber.MAX_SAFE_INTEGER
Dan Ehrenberg 2015/07/13 23:19:13 Defined this way, a user could modify Number.MAX_S
adamk 2015/07/14 00:16:48 MAX_SAFE_INTEGER is non-configurable, non-writable
+ : $toLength(limit);
var length = subject.length;
if (!IS_REGEXP(separator)) {
« no previous file with comments | « no previous file | test/test262-es6/test262-es6.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698