Commit 33ff3b05 authored by Dan Elphick's avatar Dan Elphick Committed by Commit Bot

[cleanup] Move many builtin String related functions out of CSA

Moves the following functions only used in string builtins out of
CodeStubAssembler:

StringAdd
AllocateConsString
StringFromSingleUTF16EncodedCodePoint
BranchIfCanDerefIndirectString
DerefIndirectString
MaybeDerefIndirectString
MaybeDerefIndirectStrings

Bug: v8:9396
Change-Id: Ib89966b9c170ca23dd7535a0f550c69966a6e21c
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1817608
Commit-Queue: Dan Elphick <delphick@chromium.org>
Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
Cr-Commit-Position: refs/heads/master@{#63932}
parent 3616229f
This diff is collapsed.
......@@ -33,6 +33,8 @@ class StringBuiltinsAssembler : public CodeStubAssembler {
SloppyTNode<IntPtrT> index,
UnicodeEncoding encoding);
TNode<String> StringFromSingleUTF16EncodedCodePoint(TNode<Int32T> codepoint);
protected:
void StringEqual_Loop(Node* lhs, Node* lhs_instance_type,
MachineType lhs_type, Node* rhs,
......@@ -82,6 +84,38 @@ class StringBuiltinsAssembler : public CodeStubAssembler {
return SmiLessThan(value, SmiConstant(0));
}
TNode<String> AllocateConsString(TNode<Uint32T> length, TNode<String> left,
TNode<String> right);
TNode<String> StringAdd(Node* context, TNode<String> left,
TNode<String> right);
// Check if |string| is an indirect (thin or flat cons) string type that can
// be dereferenced by DerefIndirectString.
void BranchIfCanDerefIndirectString(TNode<String> string,
TNode<Int32T> instance_type,
Label* can_deref, Label* cannot_deref);
// Allocate an appropriate one- or two-byte ConsString with the first and
// second parts specified by |left| and |right|.
// Unpack an indirect (thin or flat cons) string type.
void DerefIndirectString(TVariable<String>* var_string,
TNode<Int32T> instance_type);
// Check if |var_string| has an indirect (thin or flat cons) string type, and
// unpack it if so.
void MaybeDerefIndirectString(TVariable<String>* var_string,
TNode<Int32T> instance_type, Label* did_deref,
Label* cannot_deref);
// Check if |var_left| or |var_right| has an indirect (thin or flat cons)
// string type, and unpack it/them if so. Fall through if nothing was done.
void MaybeDerefIndirectStrings(TVariable<String>* var_left,
TNode<Int32T> left_instance_type,
TVariable<String>* var_right,
TNode<Int32T> right_instance_type,
Label* did_something);
TNode<String> DerefIndirectString(TNode<String> string,
TNode<Int32T> instance_type,
Label* cannot_deref);
// Implements boilerplate logic for {match, split, replace, search} of the
// form:
//
......
......@@ -21,7 +21,8 @@ namespace string {
extern macro StringBuiltinsAssembler::LoadSurrogatePairAt(
String, intptr, intptr, constexpr UnicodeEncoding): int32;
extern macro StringFromSingleUTF16EncodedCodePoint(int32): String;
extern macro StringBuiltinsAssembler::StringFromSingleUTF16EncodedCodePoint(
int32): String;
// This function assumes StringPrimitiveWithNoCustomIteration is true.
transitioning builtin StringToList(implicit context: Context)(string: String):
......
This diff is collapsed.
......@@ -1739,11 +1739,6 @@ class V8_EXPORT_PRIVATE CodeStubAssembler
TNode<String> parent,
TNode<Smi> offset);
// Allocate an appropriate one- or two-byte ConsString with the first and
// second parts specified by |left| and |right|.
TNode<String> AllocateConsString(TNode<Uint32T> length, TNode<String> left,
TNode<String> right);
TNode<NameDictionary> AllocateNameDictionary(int at_least_space_for);
TNode<NameDictionary> AllocateNameDictionary(
TNode<IntPtrT> at_least_space_for, AllocationFlags = kNone);
......@@ -2617,36 +2612,6 @@ class V8_EXPORT_PRIVATE CodeStubAssembler
TNode<String> SubString(TNode<String> string, TNode<IntPtrT> from,
TNode<IntPtrT> to);
// Return a new string object produced by concatenating |first| with |second|.
TNode<String> StringAdd(Node* context, TNode<String> first,
TNode<String> second);
// Check if |string| is an indirect (thin or flat cons) string type that can
// be dereferenced by DerefIndirectString.
void BranchIfCanDerefIndirectString(TNode<String> string,
TNode<Int32T> instance_type,
Label* can_deref, Label* cannot_deref);
// Unpack an indirect (thin or flat cons) string type.
void DerefIndirectString(TVariable<String>* var_string,
TNode<Int32T> instance_type);
// Check if |var_string| has an indirect (thin or flat cons) string type,
// and unpack it if so.
void MaybeDerefIndirectString(TVariable<String>* var_string,
TNode<Int32T> instance_type, Label* did_deref,
Label* cannot_deref);
// Check if |var_left| or |var_right| has an indirect (thin or flat cons)
// string type, and unpack it/them if so. Fall through if nothing was done.
void MaybeDerefIndirectStrings(TVariable<String>* var_left,
TNode<Int32T> left_instance_type,
TVariable<String>* var_right,
TNode<Int32T> right_instance_type,
Label* did_something);
TNode<String> DerefIndirectString(TNode<String> string,
TNode<Int32T> instance_type,
Label* cannot_deref);
TNode<String> StringFromSingleUTF16EncodedCodePoint(TNode<Int32T> codepoint);
// Type conversion helpers.
enum class BigIntHandling { kConvertToNumber, kThrow };
// Convert a String to a Number.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment