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

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

Issue 2599683002: [turbofan] Introduce a dedicated StringCharAt operator. (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 unified diff | Download patch
« no previous file with comments | « src/builtins/builtins.h ('k') | src/code-factory.h » ('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-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 445 matching lines...) Expand 10 before | Expand all | Expand 10 after
456 } 456 }
457 457
458 // static 458 // static
459 void Builtins::Generate_StringGreaterThanOrEqual( 459 void Builtins::Generate_StringGreaterThanOrEqual(
460 compiler::CodeAssemblerState* state) { 460 compiler::CodeAssemblerState* state) {
461 CodeStubAssembler assembler(state); 461 CodeStubAssembler assembler(state);
462 GenerateStringRelationalComparison( 462 GenerateStringRelationalComparison(
463 &assembler, RelationalComparisonMode::kGreaterThanOrEqual); 463 &assembler, RelationalComparisonMode::kGreaterThanOrEqual);
464 } 464 }
465 465
466 // static
467 void Builtins::Generate_StringCharAt(compiler::CodeAssemblerState* state) {
468 typedef compiler::Node Node;
469 CodeStubAssembler assembler(state);
470
471 Node* receiver = assembler.Parameter(0);
472 Node* position = assembler.Parameter(1);
473
474 // Load the character code at the {position} from the {receiver}.
475 Node* code = assembler.StringCharCodeAt(receiver, position,
476 CodeStubAssembler::INTPTR_PARAMETERS);
477
478 // And return the single character string with only that {code}
479 Node* result = assembler.StringFromCharCode(code);
480 assembler.Return(result);
481 }
482
466 // ----------------------------------------------------------------------------- 483 // -----------------------------------------------------------------------------
467 // ES6 section 21.1 String Objects 484 // ES6 section 21.1 String Objects
468 485
469 // ES6 section 21.1.2.1 String.fromCharCode ( ...codeUnits ) 486 // ES6 section 21.1.2.1 String.fromCharCode ( ...codeUnits )
470 void Builtins::Generate_StringFromCharCode( 487 void Builtins::Generate_StringFromCharCode(
471 compiler::CodeAssemblerState* state) { 488 compiler::CodeAssemblerState* state) {
472 typedef CodeStubAssembler::Label Label; 489 typedef CodeStubAssembler::Label Label;
473 typedef compiler::Node Node; 490 typedef compiler::Node Node;
474 typedef CodeStubAssembler::Variable Variable; 491 typedef CodeStubAssembler::Variable Variable;
475 CodeStubAssembler assembler(state); 492 CodeStubAssembler assembler(state);
(...skipping 1138 matching lines...) Expand 10 before | Expand all | Expand 10 after
1614 Runtime::kThrowIncompatibleMethodReceiver, context, 1631 Runtime::kThrowIncompatibleMethodReceiver, context,
1615 assembler.HeapConstant(assembler.factory()->NewStringFromAsciiChecked( 1632 assembler.HeapConstant(assembler.factory()->NewStringFromAsciiChecked(
1616 "String Iterator.prototype.next", TENURED)), 1633 "String Iterator.prototype.next", TENURED)),
1617 iterator); 1634 iterator);
1618 assembler.Return(result); // Never reached. 1635 assembler.Return(result); // Never reached.
1619 } 1636 }
1620 } 1637 }
1621 1638
1622 } // namespace internal 1639 } // namespace internal
1623 } // namespace v8 1640 } // namespace v8
OLDNEW
« no previous file with comments | « src/builtins/builtins.h ('k') | src/code-factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698