Commit c3d7f5f1 authored by Dan Elphick's avatar Dan Elphick Committed by Commit Bot

[csa] Tnodify builtins-intl-gen.cc

This moves PointerToSeqStringData from CSA to IntlBuiltinsAssembler
since that the only place it's used and converts a few Node*s to TNodes.

Bug: v8:6949, v8:9396
Change-Id: I2511c9f807fa0bc3101dd531f6724a170fed6bd9
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1807372
Commit-Queue: Dan Elphick <delphick@chromium.org>
Reviewed-by: 's avatarLeszek Swirski <leszeks@chromium.org>
Cr-Commit-Position: refs/heads/master@{#63847}
parent 29bdb26b
......@@ -27,6 +27,16 @@ class IntlBuiltinsAssembler : public CodeStubAssembler {
const char* method_name);
TNode<JSArray> AllocateEmptyJSArray(TNode<Context> context);
TNode<IntPtrT> PointerToSeqStringData(TNode<String> seq_string) {
CSA_ASSERT(this,
IsSequentialStringInstanceType(LoadInstanceType(seq_string)));
STATIC_ASSERT(SeqOneByteString::kHeaderSize ==
SeqTwoByteString::kHeaderSize);
return IntPtrAdd(
BitcastTaggedToWord(seq_string),
IntPtrConstant(SeqOneByteString::kHeaderSize - kHeapObjectTag));
}
};
TF_BUILTIN(StringToLowerCaseIntl, IntlBuiltinsAssembler) {
......@@ -58,7 +68,7 @@ TF_BUILTIN(StringToLowerCaseIntl, IntlBuiltinsAssembler) {
&call_c);
{
Node* const dst_ptr = PointerToSeqStringData(dst);
const TNode<IntPtrT> dst_ptr = PointerToSeqStringData(dst);
TVARIABLE(IntPtrT, var_cursor, IntPtrConstant(0));
TNode<IntPtrT> const start_address =
......@@ -69,7 +79,7 @@ TF_BUILTIN(StringToLowerCaseIntl, IntlBuiltinsAssembler) {
TNode<ExternalReference> const to_lower_table_addr =
ExternalConstant(ExternalReference::intl_to_latin1_lower_table());
VARIABLE(var_did_change, MachineRepresentation::kWord32, Int32Constant(0));
TVARIABLE(Word32T, var_did_change, Int32Constant(0));
VariableList push_vars({&var_cursor, &var_did_change}, zone());
BuildFastLoop<IntPtrT>(
......@@ -81,8 +91,8 @@ TF_BUILTIN(StringToLowerCaseIntl, IntlBuiltinsAssembler) {
StoreNoWriteBarrier(MachineRepresentation::kWord8, dst_ptr,
var_cursor.value(), lower);
var_did_change.Bind(
Word32Or(Word32NotEqual(c, lower), var_did_change.value()));
var_did_change =
Word32Or(Word32NotEqual(c, lower), var_did_change.value());
Increment(&var_cursor);
},
......@@ -107,9 +117,9 @@ TF_BUILTIN(StringToLowerCaseIntl, IntlBuiltinsAssembler) {
MachineType type_tagged = MachineType::AnyTagged();
Node* const result = CallCFunction(function_addr, type_tagged,
std::make_pair(type_tagged, src),
std::make_pair(type_tagged, dst));
const TNode<String> result = CAST(CallCFunction(
function_addr, type_tagged, std::make_pair(type_tagged, src),
std::make_pair(type_tagged, dst)));
Return(result);
}
......
......@@ -1995,16 +1995,6 @@ TNode<Uint32T> CodeStubAssembler::LoadStringLengthAsWord32(
return LoadObjectField<Uint32T>(string, String::kLengthOffset);
}
Node* CodeStubAssembler::PointerToSeqStringData(Node* seq_string) {
CSA_ASSERT(this, IsString(seq_string));
CSA_ASSERT(this,
IsSequentialStringInstanceType(LoadInstanceType(seq_string)));
STATIC_ASSERT(SeqOneByteString::kHeaderSize == SeqTwoByteString::kHeaderSize);
return IntPtrAdd(
BitcastTaggedToWord(seq_string),
IntPtrConstant(SeqOneByteString::kHeaderSize - kHeapObjectTag));
}
TNode<Object> CodeStubAssembler::LoadJSPrimitiveWrapperValue(
TNode<JSPrimitiveWrapper> object) {
return LoadObjectField(object, JSPrimitiveWrapper::kValueOffset);
......
......@@ -1195,8 +1195,6 @@ class V8_EXPORT_PRIVATE CodeStubAssembler
TNode<IntPtrT> LoadStringLengthAsWord(SloppyTNode<String> string);
// Load length field of a String object as uint32_t value.
TNode<Uint32T> LoadStringLengthAsWord32(SloppyTNode<String> string);
// Loads a pointer to the sequential String char array.
Node* PointerToSeqStringData(Node* seq_string);
// Load value field of a JSPrimitiveWrapper object.
TNode<Object> LoadJSPrimitiveWrapperValue(TNode<JSPrimitiveWrapper> object);
......
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