Ignore:
Timestamp:
Dec 11, 2009, 2:57:39 PM (15 years ago)
Author:
[email protected]
Message:

https://bugs.webkit.org/show_bug.cgi?id=32400
Switch remaining cases of string addition to use ropes.

Reviewed by Oliver Hunt.

Re-landing r51975 - added toPrimitiveString method,
performs toPrimitive then subsequent toString operations.

~1% progression on Sunspidey.

  • jit/JITStubs.cpp:

(JSC::DEFINE_STUB_FUNCTION):

  • runtime/JSString.h:

(JSC::JSString::JSString):
(JSC::JSString::appendStringInConstruct):

  • runtime/Operations.cpp:

(JSC::jsAddSlowCase):

  • runtime/Operations.h:

(JSC::jsString):
(JSC::jsAdd):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/runtime/Operations.cpp

    r51978 r52026  
    5555    JSValue p2 = v2.toPrimitive(callFrame);
    5656
    57     if (p1.isString() || p2.isString()) {
    58         RefPtr<UString::Rep> value = concatenate(p1.toString(callFrame).rep(), p2.toString(callFrame).rep());
    59         if (!value)
    60             return throwOutOfMemoryError(callFrame);
    61         return jsString(callFrame, value.release());
     57    if (p1.isString()) {
     58        return p2.isString()
     59            ? jsString(callFrame, asString(p1), asString(p2))
     60            : jsString(callFrame, asString(p1), p2.toString(callFrame));
    6261    }
     62    if (p2.isString())
     63        return jsString(callFrame, p1.toString(callFrame), asString(p2));
    6364
    6465    return jsNumber(callFrame, p1.toNumber(callFrame) + p2.toNumber(callFrame));
Note: See TracChangeset for help on using the changeset viewer.