From c3d7f5f1880592964c488ad527e4d8990c21c60e Mon Sep 17 00:00:00 2001 From: Dan Elphick Date: Tue, 17 Sep 2019 15:40:56 +0100 Subject: [PATCH] [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 Reviewed-by: Leszek Swirski Cr-Commit-Position: refs/heads/master@{#63847} --- src/builtins/builtins-intl-gen.cc | 24 +++++++++++++++++------- src/codegen/code-stub-assembler.cc | 10 ---------- src/codegen/code-stub-assembler.h | 2 -- 3 files changed, 17 insertions(+), 19 deletions(-) diff --git a/src/builtins/builtins-intl-gen.cc b/src/builtins/builtins-intl-gen.cc index e7b918958e..eb0de3330d 100644 --- a/src/builtins/builtins-intl-gen.cc +++ b/src/builtins/builtins-intl-gen.cc @@ -27,6 +27,16 @@ class IntlBuiltinsAssembler : public CodeStubAssembler { const char* method_name); TNode AllocateEmptyJSArray(TNode context); + + TNode PointerToSeqStringData(TNode 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 dst_ptr = PointerToSeqStringData(dst); TVARIABLE(IntPtrT, var_cursor, IntPtrConstant(0)); TNode const start_address = @@ -69,7 +79,7 @@ TF_BUILTIN(StringToLowerCaseIntl, IntlBuiltinsAssembler) { TNode 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( @@ -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 result = CAST(CallCFunction( + function_addr, type_tagged, std::make_pair(type_tagged, src), + std::make_pair(type_tagged, dst))); Return(result); } diff --git a/src/codegen/code-stub-assembler.cc b/src/codegen/code-stub-assembler.cc index 2570392f98..bd7958ac17 100644 --- a/src/codegen/code-stub-assembler.cc +++ b/src/codegen/code-stub-assembler.cc @@ -1995,16 +1995,6 @@ TNode CodeStubAssembler::LoadStringLengthAsWord32( return LoadObjectField(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 CodeStubAssembler::LoadJSPrimitiveWrapperValue( TNode object) { return LoadObjectField(object, JSPrimitiveWrapper::kValueOffset); diff --git a/src/codegen/code-stub-assembler.h b/src/codegen/code-stub-assembler.h index 9e4ea83435..f70fb28fb2 100644 --- a/src/codegen/code-stub-assembler.h +++ b/src/codegen/code-stub-assembler.h @@ -1195,8 +1195,6 @@ class V8_EXPORT_PRIVATE CodeStubAssembler TNode LoadStringLengthAsWord(SloppyTNode string); // Load length field of a String object as uint32_t value. TNode LoadStringLengthAsWord32(SloppyTNode string); - // Loads a pointer to the sequential String char array. - Node* PointerToSeqStringData(Node* seq_string); // Load value field of a JSPrimitiveWrapper object. TNode LoadJSPrimitiveWrapperValue(TNode object);