| Index: src/builtins/builtins-string.cc
|
| diff --git a/src/builtins/builtins-string.cc b/src/builtins/builtins-string.cc
|
| index 9ebd7cf0a79b3d5559407adf336ba6ae2de0905b..20ad423b144a5e0a12db3d9dc71a35d7cba2a547 100644
|
| --- a/src/builtins/builtins-string.cc
|
| +++ b/src/builtins/builtins-string.cc
|
| @@ -832,7 +832,7 @@ void StringBuiltinsAssembler::StringIndexOf(
|
| GotoIf(IntPtrLessThan(IntPtrConstant(1), needle_length),
|
| &call_runtime_unchecked);
|
| Node* string_length = SmiUntag(LoadStringLength(receiver));
|
| - Node* start_position = SmiUntag(position);
|
| + Node* start_position = IntPtrMax(SmiUntag(position), IntPtrConstant(0));
|
|
|
| GotoIf(IntPtrEqual(IntPtrConstant(0), needle_length), &zero_length_needle);
|
| // Check that the needle fits in the start position.
|
| @@ -940,7 +940,6 @@ 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);
|
| }
|
|
|
|
|