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

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

Issue 2367593003: [turbofan] ChangeFloat64ToTagged shouldn't canonicalize. (Closed)
Patch Set: REBASE Created 4 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 | « src/compiler/simplified-operator.cc ('k') | src/runtime/runtime-test.cc » ('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 'use strict'; 7 'use strict';
8 8
9 %CheckIsBootstrapping(); 9 %CheckIsBootstrapping();
10 10
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 'RegExp.prototype.exec', this); 171 'RegExp.prototype.exec', this);
172 } 172 }
173 173
174 string = TO_STRING(string); 174 string = TO_STRING(string);
175 175
176 var lastIndex; 176 var lastIndex;
177 var global = TO_BOOLEAN(REGEXP_GLOBAL(this)); 177 var global = TO_BOOLEAN(REGEXP_GLOBAL(this));
178 var sticky = TO_BOOLEAN(REGEXP_STICKY(this)); 178 var sticky = TO_BOOLEAN(REGEXP_STICKY(this));
179 var updateLastIndex = global || sticky; 179 var updateLastIndex = global || sticky;
180 if (updateLastIndex) { 180 if (updateLastIndex) {
181 lastIndex = TO_LENGTH(this.lastIndex); 181 // TODO(jgruber): This is actually ToLength in the spec, but we bailout
182 // to the runtime in %_RegExpExec if lastIndex is not a Smi, so we are
183 // smart here and trick both TurboFan and Crankshaft to produce a Smi.
184 // This is a terrible hack, and correct for subtle reasons; it's a clear
185 // indicator that we need a predictable RegExp implementation where we
186 // don't need to add specific work-arounds for certain compiler issues.
187 lastIndex = +this.lastIndex;
182 if (lastIndex > string.length) { 188 if (lastIndex > string.length) {
183 this.lastIndex = 0; 189 this.lastIndex = 0;
184 return null; 190 return null;
191 } else if (lastIndex <= 0) {
192 lastIndex = 0;
185 } 193 }
194 lastIndex = lastIndex|0;
186 } else { 195 } else {
187 lastIndex = 0; 196 lastIndex = 0;
188 } 197 }
189 198
190 // matchIndices is either null or the RegExpLastMatchInfo array. 199 // matchIndices is either null or the RegExpLastMatchInfo array.
191 var matchIndices = %_RegExpExec(this, string, lastIndex, RegExpLastMatchInfo); 200 var matchIndices = %_RegExpExec(this, string, lastIndex, RegExpLastMatchInfo);
192 201
193 if (IS_NULL(matchIndices)) { 202 if (IS_NULL(matchIndices)) {
194 if (updateLastIndex) this.lastIndex = 0; 203 if (updateLastIndex) this.lastIndex = 0;
195 return null; 204 return null;
(...skipping 929 matching lines...) Expand 10 before | Expand all | Expand 10 after
1125 to.GetSubstitution = GetSubstitution; 1134 to.GetSubstitution = GetSubstitution;
1126 to.InternalRegExpMatch = InternalRegExpMatch; 1135 to.InternalRegExpMatch = InternalRegExpMatch;
1127 to.InternalRegExpReplace = InternalRegExpReplace; 1136 to.InternalRegExpReplace = InternalRegExpReplace;
1128 to.IsRegExp = IsRegExp; 1137 to.IsRegExp = IsRegExp;
1129 to.RegExpExec = DoRegExpExec; 1138 to.RegExpExec = DoRegExpExec;
1130 to.RegExpInitialize = RegExpInitialize; 1139 to.RegExpInitialize = RegExpInitialize;
1131 to.RegExpLastMatchInfo = RegExpLastMatchInfo; 1140 to.RegExpLastMatchInfo = RegExpLastMatchInfo;
1132 }); 1141 });
1133 1142
1134 }) 1143 })
OLDNEW
« no previous file with comments | « src/compiler/simplified-operator.cc ('k') | src/runtime/runtime-test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698