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

Side by Side Diff: src/js/regexp.js

Issue 2337763003: [regexp] Fix incorrect range checks in AtSurrogatePair (Closed)
Patch Set: Add testcase Created 4 years, 3 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 unified diff | Download patch
« no previous file with comments | « no previous file | test/mjsunit/regexp.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 (function(global, utils) { 5 (function(global, utils) {
6 6
7 %CheckIsBootstrapping(); 7 %CheckIsBootstrapping();
8 8
9 // ------------------------------------------------------------------- 9 // -------------------------------------------------------------------
10 // Imports 10 // Imports
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 } 289 }
290 return '/' + TO_STRING(this.source) + '/' + TO_STRING(this.flags); 290 return '/' + TO_STRING(this.source) + '/' + TO_STRING(this.flags);
291 } 291 }
292 292
293 293
294 function AtSurrogatePair(subject, index) { 294 function AtSurrogatePair(subject, index) {
295 if (index + 1 >= subject.length) return false; 295 if (index + 1 >= subject.length) return false;
296 var first = %_StringCharCodeAt(subject, index); 296 var first = %_StringCharCodeAt(subject, index);
297 if (first < 0xD800 || first > 0xDBFF) return false; 297 if (first < 0xD800 || first > 0xDBFF) return false;
298 var second = %_StringCharCodeAt(subject, index + 1); 298 var second = %_StringCharCodeAt(subject, index + 1);
299 return second >= 0xDC00 || second <= 0xDFFF; 299 return second >= 0xDC00 && second <= 0xDFFF;
300 } 300 }
301 301
302 302
303 // Fast path implementation of RegExp.prototype[Symbol.split] which 303 // Fast path implementation of RegExp.prototype[Symbol.split] which
304 // doesn't properly call the underlying exec, @@species methods 304 // doesn't properly call the underlying exec, @@species methods
305 function RegExpSplit(string, limit) { 305 function RegExpSplit(string, limit) {
306 if (!IS_REGEXP(this)) { 306 if (!IS_REGEXP(this)) {
307 throw %make_type_error(kIncompatibleMethodReceiver, 307 throw %make_type_error(kIncompatibleMethodReceiver,
308 "RegExp.prototype.@@split", this); 308 "RegExp.prototype.@@split", this);
309 } 309 }
(...skipping 827 matching lines...) Expand 10 before | Expand all | Expand 10 after
1137 utils.Export(function(to) { 1137 utils.Export(function(to) {
1138 to.InternalRegExpMatch = InternalRegExpMatch; 1138 to.InternalRegExpMatch = InternalRegExpMatch;
1139 to.InternalRegExpReplace = InternalRegExpReplace; 1139 to.InternalRegExpReplace = InternalRegExpReplace;
1140 to.IsRegExp = IsRegExp; 1140 to.IsRegExp = IsRegExp;
1141 to.RegExpExec = DoRegExpExec; 1141 to.RegExpExec = DoRegExpExec;
1142 to.RegExpInitialize = RegExpInitialize; 1142 to.RegExpInitialize = RegExpInitialize;
1143 to.RegExpLastMatchInfo = RegExpLastMatchInfo; 1143 to.RegExpLastMatchInfo = RegExpLastMatchInfo;
1144 }); 1144 });
1145 1145
1146 }) 1146 })
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/regexp.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698