Commit d8ce7cd3 authored by Santiago Aboy Solanes's avatar Santiago Aboy Solanes Committed by Commit Bot

[CSA][cleanup] TNodified some CSA methods relating to Strings

This is a CL in a string of CLs that aims to TNodify CSA. In particular,
there were some loads that were done in AnyTagged instead of
TaggedPointer. TNode-ifying them brings improvement in pointer
compression since we are able to decompress using the Pointer
decompression.

Bug: v8:6949, v8:9396
Change-Id: I368d4f85348f3560a7f71bf66ebc7c4dd978a8dd
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1752854Reviewed-by: 's avatarRoss McIlroy <rmcilroy@chromium.org>
Commit-Queue: Santiago Aboy Solanes <solanes@chromium.org>
Cr-Commit-Position: refs/heads/master@{#63274}
parent 017a68c0
......@@ -33,9 +33,7 @@ class IntlBuiltinsAssembler : public CodeStubAssembler {
};
TF_BUILTIN(StringToLowerCaseIntl, IntlBuiltinsAssembler) {
Node* const string = Parameter(Descriptor::kString);
CSA_ASSERT(this, IsString(string));
TNode<String> const string = CAST(Parameter(Descriptor::kString));
Label call_c(this), return_string(this), runtime(this, Label::kDeferred);
......@@ -49,7 +47,7 @@ TF_BUILTIN(StringToLowerCaseIntl, IntlBuiltinsAssembler) {
state(), string, ToDirectStringAssembler::kDontUnpackSlicedStrings);
to_direct.TryToDirect(&runtime);
Node* const instance_type = to_direct.instance_type();
TNode<Int32T> const instance_type = to_direct.instance_type();
CSA_ASSERT(this,
Word32BinaryNot(IsIndirectStringInstanceType(instance_type)));
GotoIfNot(IsOneByteStringInstanceType(instance_type), &runtime);
......@@ -67,7 +65,7 @@ TF_BUILTIN(StringToLowerCaseIntl, IntlBuiltinsAssembler) {
VARIABLE(var_cursor, MachineType::PointerRepresentation(),
IntPtrConstant(0));
Node* const start_address = to_direct.PointerToData(&call_c);
TNode<RawPtrT> const start_address = to_direct.PointerToData(&call_c);
TNode<IntPtrT> const end_address =
Signed(IntPtrAdd(start_address, ChangeUint32ToWord(length)));
......@@ -105,7 +103,7 @@ TF_BUILTIN(StringToLowerCaseIntl, IntlBuiltinsAssembler) {
// String ConvertOneByteToLower(String src, String dst);
BIND(&call_c);
{
Node* const src = to_direct.string();
TNode<String> const src = to_direct.string();
Node* const function_addr =
ExternalConstant(ExternalReference::intl_convert_one_byte_to_lower());
......
This diff is collapsed.
......@@ -58,16 +58,17 @@ class StringBuiltinsAssembler : public CodeStubAssembler {
void ConvertAndBoundsCheckStartArgument(Node* context, Variable* var_start,
Node* start, Node* string_length);
void GenerateStringEqual(Node* left, Node* right);
void GenerateStringRelationalComparison(Node* left, Node* right,
Operation op);
void GenerateStringEqual(TNode<String> left, TNode<String> right);
void GenerateStringRelationalComparison(TNode<String> left,
TNode<String> right, Operation op);
using StringAtAccessor = std::function<TNode<Object>(
TNode<String> receiver, TNode<IntPtrT> length, TNode<IntPtrT> index)>;
void StringIndexOf(Node* const subject_string, Node* const search_string,
Node* const position,
const std::function<void(Node*)>& f_return);
void StringIndexOf(TNode<String> const subject_string,
TNode<String> const search_string,
TNode<Smi> const position,
const std::function<void(TNode<Smi>)>& f_return);
TNode<Smi> IndexOfDollarChar(Node* const context, Node* const string);
......
This diff is collapsed.
......@@ -2422,21 +2422,27 @@ class V8_EXPORT_PRIVATE CodeStubAssembler
// Check if |string| is an indirect (thin or flat cons) string type that can
// be dereferenced by DerefIndirectString.
void BranchIfCanDerefIndirectString(Node* string, Node* instance_type,
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(Variable* var_string, Node* instance_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(Variable* var_string, Node* instance_type,
Label* did_deref, Label* cannot_deref);
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(Variable* var_left, Node* left_instance_type,
Variable* var_right, Node* right_instance_type,
void MaybeDerefIndirectStrings(TVariable<String>* var_left,
TNode<Int32T> left_instance_type,
TVariable<String>* var_right,
TNode<Int32T> right_instance_type,
Label* did_something);
Node* DerefIndirectString(TNode<String> string, TNode<Int32T> instance_type,
Label* cannot_deref);
TNode<String> DerefIndirectString(TNode<String> string,
TNode<Int32T> instance_type,
Label* cannot_deref);
TNode<String> StringFromSingleUTF16EncodedCodePoint(TNode<Int32T> codepoint);
......@@ -3705,8 +3711,8 @@ class ToDirectStringAssembler : public CodeStubAssembler {
};
using Flags = base::Flags<Flag>;
ToDirectStringAssembler(compiler::CodeAssemblerState* state, Node* string,
Flags flags = Flags());
ToDirectStringAssembler(compiler::CodeAssemblerState* state,
TNode<String> string, Flags flags = Flags());
// Converts flat cons, thin, and sliced strings and returns the direct
// string. The result can be either a sequential or external string.
......@@ -3726,20 +3732,18 @@ class ToDirectStringAssembler : public CodeStubAssembler {
return TryToSequential(PTR_TO_STRING, if_bailout);
}
Node* string() { return var_string_.value(); }
Node* instance_type() { return var_instance_type_.value(); }
TNode<IntPtrT> offset() {
return UncheckedCast<IntPtrT>(var_offset_.value());
}
Node* is_external() { return var_is_external_.value(); }
TNode<String> string() { return var_string_.value(); }
TNode<Int32T> instance_type() { return var_instance_type_.value(); }
TNode<IntPtrT> offset() { return var_offset_.value(); }
TNode<Word32T> is_external() { return var_is_external_.value(); }
private:
TNode<RawPtrT> TryToSequential(StringPointerKind ptr_kind, Label* if_bailout);
Variable var_string_;
Variable var_instance_type_;
Variable var_offset_;
Variable var_is_external_;
TVariable<String> var_string_;
TVariable<Int32T> var_instance_type_;
TVariable<IntPtrT> var_offset_;
TVariable<Word32T> var_is_external_;
const Flags flags_;
};
......
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