Ignore:
Timestamp:
May 7, 2009, 1:27:58 AM (16 years ago)
Author:
[email protected]
Message:

2009-05-07 Gavin Barraclough <[email protected]>

Reviewed by NOBODY (OOPS!).

Enable op_strcat across += assignments. This patch allows the lhs of a read/modify node
to be included within the concatenation operation, and also modifies the implementation
of the concatenation to attempt to reuse and cat onto the leftmost string, rather than
always allocating a new empty output string to copy into (as was previously the behaviour).

~0.5% progression, due to a 3%-3.5% progression on the string tests (particularly validate).

  • parser/Nodes.cpp: (JSC::BinaryOpNode::emitStrcat): (JSC::emitReadModifyAssignment): (JSC::ReadModifyResolveNode::emitBytecode): (JSC::ReadModifyDotNode::emitBytecode): (JSC::ReadModifyBracketNode::emitBytecode):
  • parser/Nodes.h:
  • runtime/Operations.h: (JSC::concatenateStrings):
  • runtime/UString.cpp: (JSC::UString::reserveCapacity):
  • runtime/UString.h:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/runtime/UString.h

    r43331 r43339  
    143143            static BaseString& empty() { return *emptyBaseString; }
    144144
     145            bool reserveCapacity(int capacity);
     146
    145147        protected:
    146148            // constructor for use by BaseString subclass; they are their own bases
     
    327329        size_t cost() const;
    328330
     331        // Attempt to grow this string such that it can grow to a total length of 'capacity'
     332        // without reallocation.  This may fail a number of reasons - if the BasicString is
     333        // shared and another string is using part of the capacity beyond our end point, if
     334        // the realloc fails, or if this string is empty and has no storage.
     335        //
     336        // This method returns a boolean indicating success.
     337        bool reserveCapacity(int capacity)
     338        {
     339            return m_rep->reserveCapacity(capacity);
     340        }
     341
    329342    private:
    330343        void expandCapacity(int requiredLength);
Note: See TracChangeset for help on using the changeset viewer.