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

Unified Diff: src/builtins/builtins-string.cc

Issue 2600443002: [turbofan] Lower StringCharCodeAt to a dedicated builtin. (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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/builtins/builtins.h ('k') | src/code-factory.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/builtins/builtins-string.cc
diff --git a/src/builtins/builtins-string.cc b/src/builtins/builtins-string.cc
index 3fbff571a6b5031f8a88671a350b82f2409e0836..2e0fd29cf625cc1cf2760eee303939ea4b216289 100644
--- a/src/builtins/builtins-string.cc
+++ b/src/builtins/builtins-string.cc
@@ -480,6 +480,24 @@ void Builtins::Generate_StringCharAt(compiler::CodeAssemblerState* state) {
assembler.Return(result);
}
+// static
+void Builtins::Generate_StringCharCodeAt(compiler::CodeAssemblerState* state) {
+ typedef compiler::Node Node;
+ CodeStubAssembler assembler(state);
+
+ Node* receiver = assembler.Parameter(0);
+ Node* position = assembler.Parameter(1);
+
+ // Load the character code at the {position} from the {receiver}.
+ Node* code = assembler.StringCharCodeAt(receiver, position,
+ CodeStubAssembler::INTPTR_PARAMETERS);
+
+ // And return it as TaggedSigned value.
+ // TODO(turbofan): Allow builtins to return values untagged.
+ Node* result = assembler.SmiFromWord32(code);
+ assembler.Return(result);
+}
+
// -----------------------------------------------------------------------------
// ES6 section 21.1 String Objects
« 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