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

Unified Diff: src/js/regexp.js

Issue 2367593003: [turbofan] ChangeFloat64ToTagged shouldn't canonicalize. (Closed)
Patch Set: REBASE 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/compiler/simplified-operator.cc ('k') | src/runtime/runtime-test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/js/regexp.js
diff --git a/src/js/regexp.js b/src/js/regexp.js
index 266d6b6c529e62a4a31a034982f77c28f3b0ff32..71fe64f05930fdcb54fb02192d8a2e0ab9d5813e 100644
--- a/src/js/regexp.js
+++ b/src/js/regexp.js
@@ -178,11 +178,20 @@ function RegExpExecJS(string) {
var sticky = TO_BOOLEAN(REGEXP_STICKY(this));
var updateLastIndex = global || sticky;
if (updateLastIndex) {
- lastIndex = TO_LENGTH(this.lastIndex);
+ // TODO(jgruber): This is actually ToLength in the spec, but we bailout
+ // to the runtime in %_RegExpExec if lastIndex is not a Smi, so we are
+ // smart here and trick both TurboFan and Crankshaft to produce a Smi.
+ // This is a terrible hack, and correct for subtle reasons; it's a clear
+ // indicator that we need a predictable RegExp implementation where we
+ // don't need to add specific work-arounds for certain compiler issues.
+ lastIndex = +this.lastIndex;
if (lastIndex > string.length) {
this.lastIndex = 0;
return null;
+ } else if (lastIndex <= 0) {
+ lastIndex = 0;
}
+ lastIndex = lastIndex|0;
} else {
lastIndex = 0;
}
« 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