Ignore:
Timestamp:
Oct 30, 2019, 5:37:03 PM (6 years ago)
Author:
[email protected]
Message:

[JSC] Date functions should have intrinsic
https://bugs.webkit.org/show_bug.cgi?id=202187

Reviewed by Keith Miller.

JSTests:

  • stress/date-cse.js: Added.

(shouldBe):
(test):
(test2):
(test3):

  • stress/date-get-date-jit.js: Added.

(shouldBe):
(test):

  • stress/date-get-day-jit.js: Added.

(shouldBe):
(test):

  • stress/date-get-full-year-jit.js: Added.

(shouldBe):
(test):

  • stress/date-get-hours-jit.js: Added.

(shouldBe):
(test):

  • stress/date-get-milliseconds-jit.js: Added.

(shouldBe):
(test):

  • stress/date-get-minutes-jit.js: Added.

(shouldBe):
(test):

  • stress/date-get-month-jit.js: Added.

(shouldBe):
(test):

  • stress/date-get-seconds-jit.js: Added.

(shouldBe):
(test):

  • stress/date-get-time-jit.js: Added.

(shouldBe):
(test):

  • stress/date-get-timezone-offset-jit.js: Added.

(shouldBe):
(test):

  • stress/date-get-utc-date-jit.js: Added.

(shouldBe):
(test):

  • stress/date-get-utc-day-jit.js: Added.

(shouldBe):
(test):

  • stress/date-get-utc-full-year-jit.js: Added.

(shouldBe):
(test):

  • stress/date-get-utc-hours-jit.js: Added.

(shouldBe):
(test):

  • stress/date-get-utc-milliseconds-jit.js: Added.

(shouldBe):
(test):

  • stress/date-get-utc-minutes-jit.js: Added.

(shouldBe):
(test):

  • stress/date-get-utc-month-jit.js: Added.

(shouldBe):
(test):

  • stress/date-get-utc-seconds-jit.js: Added.

(shouldBe):
(test):

  • stress/date-get-year-jit.js: Added.

(shouldBe):
(test):

  • stress/date-value-of-jit.js: Added.

(shouldBe):
(test):

Source/JavaScriptCore:

This patch adds intrinsic to Date object getter functions to make it inlined in DFG and FTL.
We add two DFG nodes, DateGetInt32OrNaN and DateGetTime. DateGetTime is used when we know
that the result is always machine double. On the other hand, DateGetInt32OrNaN is used when the result is Int32 or NaN.

Run SunSpider 100 times and get the solid improvement in Date related benchmarks.

ToT Patched

date-format-tofte 5.3511+-0.0260 5.2747+-0.0273 definitely 1.0145x faster
date-format-xparb 4.9196+-0.0265 4.7067+-0.0200 definitely 1.0452x faster

  • bytecode/SpeculatedType.cpp:

(JSC::dumpSpeculation):
(JSC::speculationFromClassInfo):
(JSC::speculationFromJSType):
(JSC::speculationFromString):

  • bytecode/SpeculatedType.h:
  • dfg/DFGAbstractHeap.h:
  • dfg/DFGAbstractInterpreterInlines.h:

(JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects):

  • dfg/DFGByteCodeParser.cpp:

(JSC::DFG::ByteCodeParser::handleIntrinsicCall):

  • dfg/DFGClobberize.h:

(JSC::DFG::clobberize):

  • dfg/DFGDoesGC.cpp:

(JSC::DFG::doesGC):

  • dfg/DFGFixupPhase.cpp:

(JSC::DFG::FixupPhase::fixupNode):

  • dfg/DFGGraph.cpp:

(JSC::DFG::Graph::dump):

  • dfg/DFGHeapLocation.cpp:

(WTF::printInternal):

  • dfg/DFGHeapLocation.h:
  • dfg/DFGNode.h:

(JSC::DFG::Node::hasIntrinsic):
(JSC::DFG::Node::intrinsic):
(JSC::DFG::Node::hasHeapPrediction):

  • dfg/DFGNodeType.h:
  • dfg/DFGOperations.cpp:
  • dfg/DFGOperations.h:
  • dfg/DFGPredictionPropagationPhase.cpp:
  • dfg/DFGSafeToExecute.h:

(JSC::DFG::SafeToExecuteEdge::operator()):
(JSC::DFG::safeToExecute):

  • dfg/DFGSpeculativeJIT.cpp:

(JSC::DFG::SpeculativeJIT::speculateDateObject):
(JSC::DFG::SpeculativeJIT::speculate):

  • dfg/DFGSpeculativeJIT.h:
  • dfg/DFGSpeculativeJIT32_64.cpp:

(JSC::DFG::SpeculativeJIT::compile):

  • dfg/DFGSpeculativeJIT64.cpp:

(JSC::DFG::SpeculativeJIT::compile):
(JSC::DFG::SpeculativeJIT::compileDateGet):

  • dfg/DFGUseKind.cpp:

(WTF::printInternal):

  • dfg/DFGUseKind.h:

(JSC::DFG::typeFilterFor):
(JSC::DFG::isCell):

  • ftl/FTLAbstractHeapRepository.cpp:
  • ftl/FTLAbstractHeapRepository.h:
  • ftl/FTLCapabilities.cpp:

(JSC::FTL::canCompile):

  • ftl/FTLLowerDFGToB3.cpp:

(JSC::FTL::DFG::LowerDFGToB3::compileNode):
(JSC::FTL::DFG::LowerDFGToB3::compileDateGet):
(JSC::FTL::DFG::LowerDFGToB3::lowDateObject):
(JSC::FTL::DFG::LowerDFGToB3::speculate):
(JSC::FTL::DFG::LowerDFGToB3::speculateDateObject):

  • runtime/DateConversion.cpp:

(JSC::formatDateTime):

  • runtime/DateInstance.cpp:

(JSC::DateInstance::calculateGregorianDateTime const):
(JSC::DateInstance::calculateGregorianDateTimeUTC const):

  • runtime/DateInstance.h:
  • runtime/DateInstanceCache.h:

(JSC::DateInstanceData::offsetOfGregorianDateTimeCachedForMS):
(JSC::DateInstanceData::offsetOfCachedGregorianDateTime):
(JSC::DateInstanceData::offsetOfGregorianDateTimeUTCCachedForMS):
(JSC::DateInstanceData::offsetOfCachedGregorianDateTimeUTC):
(JSC::DateInstanceData::DateInstanceData): Deleted.

  • runtime/DatePrototype.cpp:

(JSC::formatLocaleDate):
(JSC::formateDateInstance):
(JSC::dateProtoFuncToISOString):
(JSC::dateProtoFuncGetFullYear):
(JSC::dateProtoFuncGetUTCFullYear):
(JSC::dateProtoFuncGetMonth):
(JSC::dateProtoFuncGetUTCMonth):
(JSC::dateProtoFuncGetDate):
(JSC::dateProtoFuncGetUTCDate):
(JSC::dateProtoFuncGetDay):
(JSC::dateProtoFuncGetUTCDay):
(JSC::dateProtoFuncGetHours):
(JSC::dateProtoFuncGetUTCHours):
(JSC::dateProtoFuncGetMinutes):
(JSC::dateProtoFuncGetUTCMinutes):
(JSC::dateProtoFuncGetSeconds):
(JSC::dateProtoFuncGetUTCSeconds):
(JSC::dateProtoFuncGetMilliSeconds):
(JSC::dateProtoFuncGetUTCMilliseconds):
(JSC::dateProtoFuncGetTimezoneOffset):
(JSC::setNewValueFromTimeArgs):
(JSC::setNewValueFromDateArgs):
(JSC::dateProtoFuncSetYear):
(JSC::dateProtoFuncGetYear):

  • runtime/Intrinsic.cpp:

(JSC::intrinsicName):

  • runtime/Intrinsic.h:
  • runtime/JSDateMath.cpp:

(JSC::msToGregorianDateTime):

  • runtime/JSType.cpp:

(WTF::printInternal):

  • runtime/JSType.h:

Source/WebCore:

  • loader/archive/mhtml/MHTMLArchive.cpp:

(WebCore::MHTMLArchive::generateMHTMLData):

Source/WTF:

  • wtf/DateMath.h:
  • wtf/GregorianDateTime.cpp:

(WTF::GregorianDateTime::setToCurrentLocalTime):

  • wtf/GregorianDateTime.h:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp

    r251468 r251826  
    31933193            addToGraph(Node::VarArg, WeakMapSet, OpInfo(0), OpInfo(0));
    31943194            setResult(base);
     3195            return true;
     3196        }
     3197
     3198        case DatePrototypeGetTimeIntrinsic: {
     3199            if (!is64Bit())
     3200                return false;
     3201            insertChecks();
     3202            Node* base = get(virtualRegisterForArgument(0, registerOffset));
     3203            setResult(addToGraph(DateGetTime, OpInfo(intrinsic), OpInfo(), base));
     3204            return true;
     3205        }
     3206
     3207        case DatePrototypeGetFullYearIntrinsic:
     3208        case DatePrototypeGetUTCFullYearIntrinsic:
     3209        case DatePrototypeGetMonthIntrinsic:
     3210        case DatePrototypeGetUTCMonthIntrinsic:
     3211        case DatePrototypeGetDateIntrinsic:
     3212        case DatePrototypeGetUTCDateIntrinsic:
     3213        case DatePrototypeGetDayIntrinsic:
     3214        case DatePrototypeGetUTCDayIntrinsic:
     3215        case DatePrototypeGetHoursIntrinsic:
     3216        case DatePrototypeGetUTCHoursIntrinsic:
     3217        case DatePrototypeGetMinutesIntrinsic:
     3218        case DatePrototypeGetUTCMinutesIntrinsic:
     3219        case DatePrototypeGetSecondsIntrinsic:
     3220        case DatePrototypeGetUTCSecondsIntrinsic:
     3221        case DatePrototypeGetMillisecondsIntrinsic:
     3222        case DatePrototypeGetUTCMillisecondsIntrinsic:
     3223        case DatePrototypeGetTimezoneOffsetIntrinsic:
     3224        case DatePrototypeGetYearIntrinsic: {
     3225            if (!is64Bit())
     3226                return false;
     3227            insertChecks();
     3228            Node* base = get(virtualRegisterForArgument(0, registerOffset));
     3229            setResult(addToGraph(DateGetInt32OrNaN, OpInfo(intrinsic), OpInfo(prediction), base));
    31953230            return true;
    31963231        }
Note: See TracChangeset for help on using the changeset viewer.