Ignore:
Timestamp:
Apr 9, 2020, 2:27:40 AM (5 years ago)
Author:
[email protected]
Message:

Implement a more efficient tagCFunction() tool.
https://bugs.webkit.org/show_bug.cgi?id=210254

Reviewed by Keith Miller.

Source/JavaScriptCore:

Putting tagCFunction() to use.

  • b3/B3LowerMacros.cpp:
  • b3/B3LowerMacrosAfterOptimizations.cpp:
  • b3/B3MathExtras.cpp:
  • b3/B3ReduceLoopStrength.cpp:

(JSC::B3::ReduceLoopStrength::reduceByteCopyLoopsToMemcpy):

  • b3/B3ReduceStrength.cpp:
  • b3/testb3_5.cpp:

(testCallSimple):
(testCallRare):
(testCallRareLive):
(testCallSimplePure):
(testCallFunctionWithHellaArguments):
(testCallFunctionWithHellaArguments2):
(testCallFunctionWithHellaArguments3):
(testCallSimpleDouble):
(testCallSimpleFloat):
(testCallFunctionWithHellaDoubleArguments):
(testCallFunctionWithHellaFloatArguments):
(testLinearScanWithCalleeOnStack):

  • b3/testb3_6.cpp:

(testInterpreter):

  • b3/testb3_7.cpp:

(testLICMPure):
(testLICMPureSideExits):
(testLICMPureWritesPinned):
(testLICMPureWrites):
(testLICMReadsLocalState):
(testLICMReadsPinned):
(testLICMReads):
(testLICMPureNotBackwardsDominant):
(testLICMPureFoiledByChild):
(testLICMPureNotBackwardsDominantFoiledByChild):
(testLICMExitsSideways):
(testLICMWritesLocalState):
(testLICMWrites):
(testLICMFence):
(testLICMWritesPinned):
(testLICMControlDependent):
(testLICMControlDependentNotBackwardsDominant):
(testLICMControlDependentSideExits):
(testLICMReadsPinnedWritesPinned):
(testLICMReadsWritesDifferentHeaps):
(testLICMReadsWritesOverlappingHeaps):
(testLICMDefaultCall):
(testShuffleDoesntTrashCalleeSaves):

  • dfg/DFGOSRExit.cpp:

(JSC::DFG::OSRExit::emitRestoreArguments):

  • dfg/DFGOSRExitCompilerCommon.cpp:

(JSC::DFG::handleExitCounts):
(JSC::DFG::osrWriteBarrier):

  • ftl/FTLLowerDFGToB3.cpp:

(JSC::FTL::DFG::LowerDFGToB3::compileCallOrConstructVarargsSpread):
(JSC::FTL::DFG::LowerDFGToB3::compileCallOrConstructVarargs):
(JSC::FTL::DFG::LowerDFGToB3::compileCallEval):

  • ftl/FTLOSRExitCompiler.cpp:

(JSC::FTL::compileStub):

  • jit/AssemblyHelpers.cpp:

(JSC::AssemblyHelpers::callExceptionFuzz):

  • jit/CCallHelpers.cpp:

(JSC::CCallHelpers::ensureShadowChickenPacket):

  • jit/JITOperations.cpp:
  • jit/ThunkGenerators.cpp:

(JSC::throwExceptionFromCallSlowPathGenerator):
(JSC::slowPathFor):
(JSC::nativeForGenerator):
(JSC::boundFunctionCallGenerator):

  • wasm/WasmB3IRGenerator.cpp:

(JSC::Wasm::B3IRGenerator::addTableGet):
(JSC::Wasm::B3IRGenerator::addTableSet):
(JSC::Wasm::B3IRGenerator::addRefFunc):
(JSC::Wasm::B3IRGenerator::addTableSize):
(JSC::Wasm::B3IRGenerator::addTableGrow):
(JSC::Wasm::B3IRGenerator::addTableFill):
(JSC::Wasm::B3IRGenerator::addGrowMemory):
(JSC::Wasm::B3IRGenerator::setGlobal):
(JSC::Wasm::B3IRGenerator::emitWriteBarrierForJSWrapper):
(JSC::Wasm::B3IRGenerator::addOp<OpType::I32Popcnt>):
(JSC::Wasm::B3IRGenerator::addOp<OpType::I64Popcnt>):

  • wasm/WasmThunks.cpp:

(JSC::Wasm::triggerOMGEntryTierUpThunkGenerator):

Source/WTF:

The current tagCFunctionPtr() tool does some extra work that is not needed if
we are tagging a known function and not a potentially arbitrary pointer. For
example,

  1. it doesn't need to do a null check.
  2. it doesn't need to authenticate the function address.
  3. The RELEASE_ASSERT used to enforce that authentication can also go away.

We should only use tagCFunction() (instead of tagCFunctionPtr()) if we know for
certain that we're operating on a C/C++ function, and not some arbitrary pointer.

  • wtf/PtrTag.h:

(WTF::tagCFunction):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/b3/B3ReduceLoopStrength.cpp

    r253994 r259786  
    11/*
    2  * Copyright (C) 2019 Apple Inc. All rights reserved.
     2 * Copyright (C) 2019-2020 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    445445        Effects effects = Effects::forCall();
    446446        memcpy->appendNew<CCallValue>(m_proc, B3::Void, origin, effects,
    447             memcpy->appendNew<ConstPtrValue>(m_proc, origin, tagCFunctionPtr<void*>(fastForwardCopy32, B3CCallPtrTag)),
     447            memcpy->appendNew<ConstPtrValue>(m_proc, origin, tagCFunction<B3CCallPtrTag>(fastForwardCopy32)),
    448448            destination->appendAddr(m_proc, memcpy, destination->arrayBase),
    449449            source->appendAddr(m_proc, memcpy, source->arrayBase),
Note: See TracChangeset for help on using the changeset viewer.