OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 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 #include "src/builtins/builtins-utils.h" | 5 #include "src/builtins/builtins-utils.h" |
6 #include "src/builtins/builtins.h" | 6 #include "src/builtins/builtins.h" |
7 #include "src/code-factory.h" | 7 #include "src/code-factory.h" |
8 #include "src/code-stub-assembler.h" | 8 #include "src/code-stub-assembler.h" |
9 #include "src/regexp/regexp-utils.h" | 9 #include "src/regexp/regexp-utils.h" |
10 | 10 |
(...skipping 888 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
899 search_string.Bind(arguments.AtIndex(0)); | 899 search_string.Bind(arguments.AtIndex(0)); |
900 position.Bind(SmiConstant(0)); | 900 position.Bind(SmiConstant(0)); |
901 Goto(&fast_path); | 901 Goto(&fast_path); |
902 } | 902 } |
903 Bind(&argc_2); | 903 Bind(&argc_2); |
904 { | 904 { |
905 Comment("2 Argument case"); | 905 Comment("2 Argument case"); |
906 search_string.Bind(arguments.AtIndex(0)); | 906 search_string.Bind(arguments.AtIndex(0)); |
907 position.Bind(arguments.AtIndex(1)); | 907 position.Bind(arguments.AtIndex(1)); |
908 GotoUnless(TaggedIsSmi(position.value()), &call_runtime); | 908 GotoUnless(TaggedIsSmi(position.value()), &call_runtime); |
| 909 position.Bind(SmiMax(position.value(), SmiConstant(0))); |
909 Goto(&fast_path); | 910 Goto(&fast_path); |
910 } | 911 } |
911 | 912 |
912 Bind(&fast_path); | 913 Bind(&fast_path); |
913 { | 914 { |
914 Comment("Fast Path"); | 915 Comment("Fast Path"); |
915 Label zero_length_needle(this); | 916 Label zero_length_needle(this); |
916 GotoIf(TaggedIsSmi(receiver), &call_runtime); | 917 GotoIf(TaggedIsSmi(receiver), &call_runtime); |
917 Node* needle = search_string.value(); | 918 Node* needle = search_string.value(); |
918 GotoIf(TaggedIsSmi(needle), &call_runtime); | 919 GotoIf(TaggedIsSmi(needle), &call_runtime); |
(...skipping 694 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1613 Runtime::kThrowIncompatibleMethodReceiver, context, | 1614 Runtime::kThrowIncompatibleMethodReceiver, context, |
1614 assembler.HeapConstant(assembler.factory()->NewStringFromAsciiChecked( | 1615 assembler.HeapConstant(assembler.factory()->NewStringFromAsciiChecked( |
1615 "String Iterator.prototype.next", TENURED)), | 1616 "String Iterator.prototype.next", TENURED)), |
1616 iterator); | 1617 iterator); |
1617 assembler.Return(result); // Never reached. | 1618 assembler.Return(result); // Never reached. |
1618 } | 1619 } |
1619 } | 1620 } |
1620 | 1621 |
1621 } // namespace internal | 1622 } // namespace internal |
1622 } // namespace v8 | 1623 } // namespace v8 |
OLD | NEW |