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); |
} |