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

Side by Side Diff: src/regexp.js

Issue 1378693004: RegExp: Fix update of lastIndex on non-global sticky (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 2 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/harmony/regexp-sticky.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 var $regexpLastMatchInfoOverride; 5 var $regexpLastMatchInfoOverride;
6 6
7 (function(global, utils) { 7 (function(global, utils) {
8 8
9 %CheckIsBootstrapping(); 9 %CheckIsBootstrapping();
10 10
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 } 136 }
137 return result; 137 return result;
138 endmacro 138 endmacro
139 139
140 140
141 function RegExpExecNoTests(regexp, string, start) { 141 function RegExpExecNoTests(regexp, string, start) {
142 // Must be called with RegExp, string and positive integer as arguments. 142 // Must be called with RegExp, string and positive integer as arguments.
143 var matchInfo = %_RegExpExec(regexp, string, start, RegExpLastMatchInfo); 143 var matchInfo = %_RegExpExec(regexp, string, start, RegExpLastMatchInfo);
144 if (matchInfo !== null) { 144 if (matchInfo !== null) {
145 $regexpLastMatchInfoOverride = null; 145 $regexpLastMatchInfoOverride = null;
146 // ES6 21.2.5.2.2 step 18.
147 if (FLAG_harmony_regexps && regexp.sticky) {
148 regexp.lastIndex = matchInfo[CAPTURE1];
149 }
146 RETURN_NEW_RESULT_FROM_MATCH_INFO(matchInfo, string); 150 RETURN_NEW_RESULT_FROM_MATCH_INFO(matchInfo, string);
147 } 151 }
148 regexp.lastIndex = 0; 152 regexp.lastIndex = 0;
149 return null; 153 return null;
150 } 154 }
151 155
152 156
153 function RegExpExecJS(string) { 157 function RegExpExecJS(string) {
154 if (!IS_REGEXP(this)) { 158 if (!IS_REGEXP(this)) {
155 throw MakeTypeError(kIncompatibleMethodReceiver, 159 throw MakeTypeError(kIncompatibleMethodReceiver,
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
449 // Exports 453 // Exports
450 454
451 utils.Export(function(to) { 455 utils.Export(function(to) {
452 to.RegExpExec = DoRegExpExec; 456 to.RegExpExec = DoRegExpExec;
453 to.RegExpExecNoTests = RegExpExecNoTests; 457 to.RegExpExecNoTests = RegExpExecNoTests;
454 to.RegExpLastMatchInfo = RegExpLastMatchInfo; 458 to.RegExpLastMatchInfo = RegExpLastMatchInfo;
455 to.RegExpTest = RegExpTest; 459 to.RegExpTest = RegExpTest;
456 }); 460 });
457 461
458 }) 462 })
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/harmony/regexp-sticky.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698