Changeset 184860 in webkit for trunk/Source/JavaScriptCore


Ignore:
Timestamp:
May 26, 2015, 10:28:32 AM (10 years ago)
Author:
[email protected]
Message:

Try to use StringView when comparing JSStrings for equality.
<https://webkit.org/b/145379>

Reviewed by Darin Adler.

Use JSString::view() when sending two JSStrings to WTF::equal()
for comparison. This avoids creating new objects in the case where
the strings are actually substrings.

  • jit/JITOperations.cpp:
  • runtime/JSCJSValueInlines.h:

(JSC::JSValue::equalSlowCaseInline):
(JSC::JSValue::strictEqualSlowCaseInline):

Location:
trunk/Source/JavaScriptCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r184859 r184860  
     12015-05-26  Andreas Kling  <[email protected]>
     2
     3        Try to use StringView when comparing JSStrings for equality.
     4        <https://webkit.org/b/145379>
     5
     6        Reviewed by Darin Adler.
     7
     8        Use JSString::view() when sending two JSStrings to WTF::equal()
     9        for comparison. This avoids creating new objects in the case where
     10        the strings are actually substrings.
     11
     12        * jit/JITOperations.cpp:
     13        * runtime/JSCJSValueInlines.h:
     14        (JSC::JSValue::equalSlowCaseInline):
     15        (JSC::JSValue::strictEqualSlowCaseInline):
     16
    1172015-05-26  Yusuke Suzuki  <[email protected]>
    218
  • trunk/Source/JavaScriptCore/jit/JITOperations.cpp

    r184828 r184860  
    924924    NativeCallFrameTracer tracer(vm, exec);
    925925
    926     bool result = WTF::equal(*asString(left)->value(exec).impl(), *asString(right)->value(exec).impl());
     926    bool result = WTF::equal(asString(left)->view(exec), asString(right)->view(exec));
    927927#if USE(JSVALUE64)
    928928    return JSValue::encode(jsBoolean(result));
  • trunk/Source/JavaScriptCore/runtime/JSCJSValueInlines.h

    r182205 r184860  
    787787        bool s2 = v2.isString();
    788788        if (s1 && s2)
    789             return WTF::equal(*asString(v1)->value(exec).impl(), *asString(v2)->value(exec).impl());
     789            return WTF::equal(asString(v1)->view(exec), asString(v2)->view(exec));
    790790
    791791        if (v1.isUndefinedOrNull()) {
     
    857857
    858858    if (v1.asCell()->isString() && v2.asCell()->isString())
    859         return WTF::equal(*asString(v1)->value(exec).impl(), *asString(v2)->value(exec).impl());
     859        return WTF::equal(asString(v1)->view(exec), asString(v2)->view(exec));
    860860    if (v1.asCell()->isSymbol() && v2.asCell()->isSymbol())
    861861        return asSymbol(v1)->privateName() == asSymbol(v2)->privateName();
Note: See TracChangeset for help on using the changeset viewer.