Index: src/builtins/builtins-string.cc |
diff --git a/src/builtins/builtins-string.cc b/src/builtins/builtins-string.cc |
index 967fc341093a73fcde5c35aabb7b0c7213e60999..3fbff571a6b5031f8a88671a350b82f2409e0836 100644 |
--- a/src/builtins/builtins-string.cc |
+++ b/src/builtins/builtins-string.cc |
@@ -463,6 +463,23 @@ void Builtins::Generate_StringGreaterThanOrEqual( |
&assembler, RelationalComparisonMode::kGreaterThanOrEqual); |
} |
+// static |
+void Builtins::Generate_StringCharAt(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 the single character string with only that {code} |
+ Node* result = assembler.StringFromCharCode(code); |
+ assembler.Return(result); |
+} |
+ |
// ----------------------------------------------------------------------------- |
// ES6 section 21.1 String Objects |