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

Unified Diff: src/builtins/builtins-string.cc

Issue 2593593002: [builtins] Fix String.prototype.indexOf with negative positions (Closed)
Patch Set: Created 4 years 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/mjsunit/string-indexof-1.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/builtins/builtins-string.cc
diff --git a/src/builtins/builtins-string.cc b/src/builtins/builtins-string.cc
index deed60056e10e7f58aeb03b4b725d33ff5e6e59d..967fc341093a73fcde5c35aabb7b0c7213e60999 100644
--- a/src/builtins/builtins-string.cc
+++ b/src/builtins/builtins-string.cc
@@ -906,6 +906,7 @@ TF_BUILTIN(StringPrototypeIndexOf, StringBuiltinsAssembler) {
search_string.Bind(arguments.AtIndex(0));
position.Bind(arguments.AtIndex(1));
GotoUnless(TaggedIsSmi(position.value()), &call_runtime);
+ position.Bind(SmiMax(position.value(), SmiConstant(0)));
Goto(&fast_path);
}
« no previous file with comments | « no previous file | test/mjsunit/string-indexof-1.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698