diff options
Diffstat (limited to 'deps/v8/src/builtins/builtins-string-gen.h')
-rw-r--r-- | deps/v8/src/builtins/builtins-string-gen.h | 61 |
1 files changed, 59 insertions, 2 deletions
diff --git a/deps/v8/src/builtins/builtins-string-gen.h b/deps/v8/src/builtins/builtins-string-gen.h index 64d5a77615..0dfcf88a8c 100644 --- a/deps/v8/src/builtins/builtins-string-gen.h +++ b/deps/v8/src/builtins/builtins-string-gen.h @@ -33,6 +33,25 @@ class StringBuiltinsAssembler : public CodeStubAssembler { SloppyTNode<IntPtrT> index, UnicodeEncoding encoding); + TNode<String> StringFromSingleUTF16EncodedCodePoint(TNode<Int32T> codepoint); + + // Return a new string object which holds a substring containing the range + // [from,to[ of string. + TNode<String> SubString(TNode<String> string, TNode<IntPtrT> from, + TNode<IntPtrT> to); + + // Copies |character_count| elements from |from_string| to |to_string| + // starting at the |from_index|'th character. |from_string| and |to_string| + // can either be one-byte strings or two-byte strings, although if + // |from_string| is two-byte, then |to_string| must be two-byte. + // |from_index|, |to_index| and |character_count| must be intptr_ts s.t. 0 <= + // |from_index| <= |from_index| + |character_count| <= from_string.length and + // 0 <= |to_index| <= |to_index| + |character_count| <= to_string.length. + V8_EXPORT_PRIVATE void CopyStringCharacters( + Node* from_string, Node* to_string, TNode<IntPtrT> from_index, + TNode<IntPtrT> to_index, TNode<IntPtrT> character_count, + String::Encoding from_encoding, String::Encoding to_encoding); + protected: void StringEqual_Loop(Node* lhs, Node* lhs_instance_type, MachineType lhs_type, Node* rhs, @@ -51,8 +70,8 @@ class StringBuiltinsAssembler : public CodeStubAssembler { Node* const search_ptr, Node* const search_length, Node* const start_position); - TNode<IntPtrT> PointerToStringDataAtIndex(Node* const string_data, - Node* const index, + TNode<RawPtrT> PointerToStringDataAtIndex(TNode<RawPtrT> string_data, + TNode<IntPtrT> index, String::Encoding encoding); // substr and slice have a common way of handling the {start} argument. @@ -82,6 +101,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: // @@ -103,6 +154,12 @@ class StringBuiltinsAssembler : public CodeStubAssembler { Handle<Symbol> symbol, DescriptorIndexNameValue additional_property_to_check, const NodeFunction0& regexp_call, const NodeFunction1& generic_call); + + private: + TNode<String> AllocAndCopyStringCharacters(Node* from, + Node* from_instance_type, + TNode<IntPtrT> from_index, + TNode<IntPtrT> character_count); }; class StringIncludesIndexOfAssembler : public StringBuiltinsAssembler { |