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

Side by Side Diff: src/builtins/builtins-string.cc

Issue 2350963004: [builtins] Move StringIndexOf to a C++ builtin. (Closed)
Patch Set: Fix formatting errors Created 4 years, 2 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 unified diff | Download patch
« no previous file with comments | « src/builtins/builtins.h ('k') | src/js/i18n.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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.h" 5 #include "src/builtins/builtins.h"
6 #include "src/builtins/builtins-utils.h" 6 #include "src/builtins/builtins-utils.h"
7 7
8 #include "src/code-factory.h" 8 #include "src/code-factory.h"
9 9
10 namespace v8 { 10 namespace v8 {
(...skipping 763 matching lines...) Expand 10 before | Expand all | Expand 10 after
774 774
775 assembler->Bind(&if_positioninbounds); 775 assembler->Bind(&if_positioninbounds);
776 } 776 }
777 777
778 // Load the character at the {position} from the {receiver}. 778 // Load the character at the {position} from the {receiver}.
779 Node* value = assembler->StringCharCodeAt(receiver, position); 779 Node* value = assembler->StringCharCodeAt(receiver, position);
780 Node* result = assembler->SmiFromWord32(value); 780 Node* result = assembler->SmiFromWord32(value);
781 assembler->Return(result); 781 assembler->Return(result);
782 } 782 }
783 783
784 // ES6 section 21.1.3.8 String.prototype.indexOf ( searchString [ , position ] )
785 BUILTIN(StringPrototypeIndexOf) {
786 HandleScope handle_scope(isolate);
787
788 return String::IndexOf(isolate, args.receiver(),
789 args.atOrUndefined(isolate, 1),
790 args.atOrUndefined(isolate, 2));
791 }
792
784 // ES6 section 21.1.3.9 793 // ES6 section 21.1.3.9
785 // String.prototype.lastIndexOf ( searchString [ , position ] ) 794 // String.prototype.lastIndexOf ( searchString [ , position ] )
786 BUILTIN(StringPrototypeLastIndexOf) { 795 BUILTIN(StringPrototypeLastIndexOf) {
787 HandleScope handle_scope(isolate); 796 HandleScope handle_scope(isolate);
788 return String::LastIndexOf(isolate, args.receiver(), 797 return String::LastIndexOf(isolate, args.receiver(),
789 args.atOrUndefined(isolate, 1), 798 args.atOrUndefined(isolate, 1),
790 args.atOrUndefined(isolate, 2)); 799 args.atOrUndefined(isolate, 2));
791 } 800 }
792 801
793 // ES6 section 21.1.3.10 String.prototype.localeCompare ( that ) 802 // ES6 section 21.1.3.10 String.prototype.localeCompare ( that )
(...skipping 547 matching lines...) Expand 10 before | Expand all | Expand 10 after
1341 Runtime::kThrowIncompatibleMethodReceiver, context, 1350 Runtime::kThrowIncompatibleMethodReceiver, context,
1342 assembler->HeapConstant(assembler->factory()->NewStringFromAsciiChecked( 1351 assembler->HeapConstant(assembler->factory()->NewStringFromAsciiChecked(
1343 "String Iterator.prototype.next", TENURED)), 1352 "String Iterator.prototype.next", TENURED)),
1344 iterator); 1353 iterator);
1345 assembler->Return(result); // Never reached. 1354 assembler->Return(result); // Never reached.
1346 } 1355 }
1347 } 1356 }
1348 1357
1349 } // namespace internal 1358 } // namespace internal
1350 } // namespace v8 1359 } // namespace v8
OLDNEW
« no previous file with comments | « src/builtins/builtins.h ('k') | src/js/i18n.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698