Ignore:
Timestamp:
Dec 10, 2009, 2:13:15 PM (15 years ago)
Author:
[email protected]
Message:

https://bugs.webkit.org/show_bug.cgi?id=32367
Add support for short Ropes (up to 3 entries) inline within JSString.
(rather than externally allocating an object to hold the rope).
Switch jsAdd of (JSString* + JSString*) to now make use of Ropes.

Reviewed by Oliver Hunt & Mark Rowe.

~1% progression on Sunspidey.

  • interpreter/Interpreter.cpp:

(JSC::Interpreter::privateExecute):

  • jit/JITOpcodes.cpp:

(JSC::JIT::privateCompileCTIMachineTrampolines):

  • jit/JITStubs.cpp:

(JSC::DEFINE_STUB_FUNCTION):

  • runtime/JSString.cpp:

(JSC::JSString::resolveRope):
(JSC::JSString::toBoolean):
(JSC::JSString::getStringPropertyDescriptor):

  • runtime/JSString.h:

(JSC::JSString::Rope::Fiber::deref):
(JSC::JSString::Rope::Fiber::ref):
(JSC::JSString::Rope::Fiber::refAndGetLength):
(JSC::JSString::Rope::append):
(JSC::JSString::JSString):
(JSC::JSString::~JSString):
(JSC::JSString::value):
(JSC::JSString::tryGetValue):
(JSC::JSString::length):
(JSC::JSString::canGetIndex):
(JSC::JSString::appendStringInConstruct):
(JSC::JSString::appendValueInConstructAndIncrementLength):
(JSC::JSString::isRope):
(JSC::JSString::string):
(JSC::JSString::ropeLength):
(JSC::JSString::getStringPropertySlot):

  • runtime/Operations.h:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/jit/JITStubs.cpp

    r51801 r51964  
    10441044    bool leftIsString = v1.isString();
    10451045    if (leftIsString && v2.isString()) {
    1046         if (asString(v1)->isRope() || asString(v2)->isRope()) {
    1047             RefPtr<JSString::Rope> rope = JSString::Rope::createOrNull(2);
    1048             if (UNLIKELY(!rope)) {
    1049                 throwOutOfMemoryError(callFrame);
    1050                 VM_THROW_EXCEPTION();
    1051             }
    1052             rope->initializeFiber(0, asString(v1));
    1053             rope->initializeFiber(1, asString(v2));
    1054             JSGlobalData* globalData = &callFrame->globalData();
    1055             return JSValue::encode(new (globalData) JSString(globalData, rope.release()));
    1056         }
    1057 
    1058         RefPtr<UString::Rep> value = concatenate(asString(v1)->value(callFrame).rep(), asString(v2)->value(callFrame).rep());
    1059         if (UNLIKELY(!value)) {
    1060             throwOutOfMemoryError(callFrame);
    1061             VM_THROW_EXCEPTION();
    1062         }
    1063 
    1064         return JSValue::encode(jsString(stackFrame.globalData, value.release()));
     1046        JSValue result = jsString(callFrame, asString(v1), asString(v2));
     1047        CHECK_FOR_EXCEPTION_AT_END();
     1048        return JSValue::encode(result);
    10651049    }
    10661050
     
    28522836    STUB_INIT_STACK_FRAME(stackFrame);
    28532837
    2854     JSValue result = concatenateStrings(stackFrame.callFrame, &stackFrame.callFrame->registers()[stackFrame.args[0].int32()], stackFrame.args[1].int32());
     2838    JSValue result = jsString(stackFrame.callFrame, &stackFrame.callFrame->registers()[stackFrame.args[0].int32()], stackFrame.args[1].int32());
    28552839    CHECK_FOR_EXCEPTION_AT_END();
    28562840    return JSValue::encode(result);
Note: See TracChangeset for help on using the changeset viewer.