Ignore:
Timestamp:
Apr 28, 2022, 1:13:57 PM (3 years ago)
Author:
Chris Dumez
Message:

Leverage the known length of an ASCIILiteral when comparing it to a String / AtomString
https://bugs.webkit.org/show_bug.cgi?id=239798

Reviewed by Yusuke Suzuki and Darin Adler.

Leverage the known length of an ASCIILiteral when comparing it to a String / AtomString.
Make sure we call ASCIILiteral::length() inline to allow the compiler to optimize out
the strlen() call, then call the more efficient equal(StringImpl*, const LChar*, unsigned)
instead of equal(StringImpl*, const LChar*).

  • Source/JavaScriptCore/jsc.cpp:

(printInternal):

  • Source/JavaScriptCore/runtime/JSCJSValueInlines.h:

(JSC::toPreferredPrimitiveType):

  • Source/JavaScriptCore/runtime/PropertyName.h:

(JSC::isCanonicalNumericIndexString):

  • Source/WTF/wtf/text/AtomString.h:

(WTF::operator==):

  • Source/WTF/wtf/text/StringImpl.h:

(WTF::equal):

  • Source/WTF/wtf/text/WTFString.h:

(WTF::operator==):
(WTF::operator!=):

Canonical link: https://commits.webkit.org/250097@main

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/jsc.cpp

    r292929 r293588  
    12791279    if (asyncTestExpectedPasses) {
    12801280        JSValue value = callFrame->argument(0);
    1281         if (value.isString() && WTF::equal(asString(value)->value(globalObject).impl(), "Test262:AsyncTestComplete")) {
     1281        if (value.isString() && WTF::equal(asString(value)->value(globalObject).impl(), "Test262:AsyncTestComplete"_s)) {
    12821282            asyncTestPasses++;
    12831283            return JSValue::encode(jsUndefined());
Note: See TracChangeset for help on using the changeset viewer.