Changeset 259786 in webkit


Ignore:
Timestamp:
Apr 9, 2020 2:27:40 AM (4 years ago)
Author:
mark.lam@apple.com
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):

Location:
trunk/Source
Files:
21 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r259781 r259786  
     12020-04-09  Mark Lam  <mark.lam@apple.com>
     2
     3        Implement a more efficient tagCFunction() tool.
     4        https://bugs.webkit.org/show_bug.cgi?id=210254
     5
     6        Reviewed by Keith Miller.
     7
     8        Putting tagCFunction() to use.
     9
     10        * b3/B3LowerMacros.cpp:
     11        * b3/B3LowerMacrosAfterOptimizations.cpp:
     12        * b3/B3MathExtras.cpp:
     13        * b3/B3ReduceLoopStrength.cpp:
     14        (JSC::B3::ReduceLoopStrength::reduceByteCopyLoopsToMemcpy):
     15        * b3/B3ReduceStrength.cpp:
     16        * b3/testb3_5.cpp:
     17        (testCallSimple):
     18        (testCallRare):
     19        (testCallRareLive):
     20        (testCallSimplePure):
     21        (testCallFunctionWithHellaArguments):
     22        (testCallFunctionWithHellaArguments2):
     23        (testCallFunctionWithHellaArguments3):
     24        (testCallSimpleDouble):
     25        (testCallSimpleFloat):
     26        (testCallFunctionWithHellaDoubleArguments):
     27        (testCallFunctionWithHellaFloatArguments):
     28        (testLinearScanWithCalleeOnStack):
     29        * b3/testb3_6.cpp:
     30        (testInterpreter):
     31        * b3/testb3_7.cpp:
     32        (testLICMPure):
     33        (testLICMPureSideExits):
     34        (testLICMPureWritesPinned):
     35        (testLICMPureWrites):
     36        (testLICMReadsLocalState):
     37        (testLICMReadsPinned):
     38        (testLICMReads):
     39        (testLICMPureNotBackwardsDominant):
     40        (testLICMPureFoiledByChild):
     41        (testLICMPureNotBackwardsDominantFoiledByChild):
     42        (testLICMExitsSideways):
     43        (testLICMWritesLocalState):
     44        (testLICMWrites):
     45        (testLICMFence):
     46        (testLICMWritesPinned):
     47        (testLICMControlDependent):
     48        (testLICMControlDependentNotBackwardsDominant):
     49        (testLICMControlDependentSideExits):
     50        (testLICMReadsPinnedWritesPinned):
     51        (testLICMReadsWritesDifferentHeaps):
     52        (testLICMReadsWritesOverlappingHeaps):
     53        (testLICMDefaultCall):
     54        (testShuffleDoesntTrashCalleeSaves):
     55        * dfg/DFGOSRExit.cpp:
     56        (JSC::DFG::OSRExit::emitRestoreArguments):
     57        * dfg/DFGOSRExitCompilerCommon.cpp:
     58        (JSC::DFG::handleExitCounts):
     59        (JSC::DFG::osrWriteBarrier):
     60        * ftl/FTLLowerDFGToB3.cpp:
     61        (JSC::FTL::DFG::LowerDFGToB3::compileCallOrConstructVarargsSpread):
     62        (JSC::FTL::DFG::LowerDFGToB3::compileCallOrConstructVarargs):
     63        (JSC::FTL::DFG::LowerDFGToB3::compileCallEval):
     64        * ftl/FTLOSRExitCompiler.cpp:
     65        (JSC::FTL::compileStub):
     66        * jit/AssemblyHelpers.cpp:
     67        (JSC::AssemblyHelpers::callExceptionFuzz):
     68        * jit/CCallHelpers.cpp:
     69        (JSC::CCallHelpers::ensureShadowChickenPacket):
     70        * jit/JITOperations.cpp:
     71        * jit/ThunkGenerators.cpp:
     72        (JSC::throwExceptionFromCallSlowPathGenerator):
     73        (JSC::slowPathFor):
     74        (JSC::nativeForGenerator):
     75        (JSC::boundFunctionCallGenerator):
     76        * wasm/WasmB3IRGenerator.cpp:
     77        (JSC::Wasm::B3IRGenerator::addTableGet):
     78        (JSC::Wasm::B3IRGenerator::addTableSet):
     79        (JSC::Wasm::B3IRGenerator::addRefFunc):
     80        (JSC::Wasm::B3IRGenerator::addTableSize):
     81        (JSC::Wasm::B3IRGenerator::addTableGrow):
     82        (JSC::Wasm::B3IRGenerator::addTableFill):
     83        (JSC::Wasm::B3IRGenerator::addGrowMemory):
     84        (JSC::Wasm::B3IRGenerator::setGlobal):
     85        (JSC::Wasm::B3IRGenerator::emitWriteBarrierForJSWrapper):
     86        (JSC::Wasm::B3IRGenerator::addOp<OpType::I32Popcnt>):
     87        (JSC::Wasm::B3IRGenerator::addOp<OpType::I64Popcnt>):
     88        * wasm/WasmThunks.cpp:
     89        (JSC::Wasm::triggerOMGEntryTierUpThunkGenerator):
     90
    1912020-04-08  Devin Rousso  <drousso@apple.com>
    292
  • trunk/Source/JavaScriptCore/b3/B3LowerMacros.cpp

    r248686 r259786  
    11/*
    2  * Copyright (C) 2015-2019 Apple Inc. All rights reserved.
     2 * Copyright (C) 2015-2020 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    129129                }
    130130               
    131                 auto* fmodDouble = tagCFunctionPtr<double (*)(double, double)>(fmod, B3CCallPtrTag);
     131                double(*fmodDouble)(double, double) = fmod;
     132                fmodDouble = tagCFunction<B3CCallPtrTag>(fmodDouble);
    132133                if (m_value->type() == Double) {
    133134                    Value* functionAddress = m_insertionSet.insert<ConstPtrValue>(m_index, m_origin, fmodDouble);
  • trunk/Source/JavaScriptCore/b3/B3LowerMacrosAfterOptimizations.cpp

    r248178 r259786  
    11/*
    2  * Copyright (C) 2015-2018 Apple Inc. All rights reserved.
     2 * Copyright (C) 2015-2020 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    101101                if (m_value->type() == Double) {
    102102                    double (*ceilDouble)(double) = ceil;
    103                     functionAddress = m_insertionSet.insert<ConstPtrValue>(m_index, m_origin, tagCFunctionPtr(ceilDouble, B3CCallPtrTag));
     103                    functionAddress = m_insertionSet.insert<ConstPtrValue>(m_index, m_origin, tagCFunction<B3CCallPtrTag>(ceilDouble));
    104104                } else if (m_value->type() == Float)
    105                     functionAddress = m_insertionSet.insert<ConstPtrValue>(m_index, m_origin, tagCFunctionPtr(ceilf, B3CCallPtrTag));
     105                    functionAddress = m_insertionSet.insert<ConstPtrValue>(m_index, m_origin, tagCFunction<B3CCallPtrTag>(ceilf));
    106106                else
    107107                    RELEASE_ASSERT_NOT_REACHED();
     
    123123                if (m_value->type() == Double) {
    124124                    double (*floorDouble)(double) = floor;
    125                     functionAddress = m_insertionSet.insert<ConstPtrValue>(m_index, m_origin, tagCFunctionPtr(floorDouble, B3CCallPtrTag));
     125                    functionAddress = m_insertionSet.insert<ConstPtrValue>(m_index, m_origin, tagCFunction<B3CCallPtrTag>(floorDouble));
    126126                } else if (m_value->type() == Float)
    127                     functionAddress = m_insertionSet.insert<ConstPtrValue>(m_index, m_origin, tagCFunctionPtr(floorf, B3CCallPtrTag));
     127                    functionAddress = m_insertionSet.insert<ConstPtrValue>(m_index, m_origin, tagCFunction<B3CCallPtrTag>(floorf));
    128128                else
    129129                    RELEASE_ASSERT_NOT_REACHED();
  • trunk/Source/JavaScriptCore/b3/B3MathExtras.cpp

    r231027 r259786  
    11/*
    2  * Copyright (C) 2015-2018 Apple Inc. All rights reserved.
     2 * Copyright (C) 2015-2020 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    5858    // Function call.
    5959    Value* yAsDouble = functionCallCase->appendNew<Value>(procedure, IToD, origin, y);
    60     auto* powDouble = tagCFunctionPtr<double (*)(double, double)>(pow, B3CCallPtrTag);
     60    double(*powDouble)(double, double) = pow;
     61    powDouble = tagCFunction<B3CCallPtrTag>(powDouble);
    6162    Value* powResult = functionCallCase->appendNew<CCallValue>(
    6263        procedure, Double, origin,
  • 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),
  • trunk/Source/JavaScriptCore/b3/B3ReduceStrength.cpp

    r250198 r259786  
    11/*
    2  * Copyright (C) 2015-2019 Apple Inc. All rights reserved.
     2 * Copyright (C) 2015-2020 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    18191819            // Turn this: Call(fmod, constant1, constant2)
    18201820            // Into this: fcall-constant(constant1, constant2)
    1821             auto* fmodDouble = tagCFunctionPtr<double (*)(double, double)>(fmod, B3CCallPtrTag);
     1821            double(*fmodDouble)(double, double) = fmod;
     1822            fmodDouble = tagCFunction<B3CCallPtrTag>(fmodDouble);
    18221823            if (m_value->type() == Double
    18231824                && m_value->numChildren() == 3
  • trunk/Source/JavaScriptCore/b3/testb3_5.cpp

    r250199 r259786  
    11/*
    2  * Copyright (C) 2015-2019 Apple Inc. All rights reserved.
     2 * Copyright (C) 2015-2020 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    19171917        root->appendNew<CCallValue>(
    19181918            proc, Int32, Origin(),
    1919             root->appendNew<ConstPtrValue>(proc, Origin(), tagCFunctionPtr<void*>(simpleFunction, B3CCallPtrTag)),
     1919            root->appendNew<ConstPtrValue>(proc, Origin(), tagCFunction<B3CCallPtrTag>(simpleFunction)),
    19201920            root->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR0),
    19211921            root->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR1)));
     
    19441944        rare->appendNew<CCallValue>(
    19451945            proc, Int32, Origin(),
    1946             rare->appendNew<ConstPtrValue>(proc, Origin(), tagCFunctionPtr<void*>(simpleFunction, B3CCallPtrTag)),
     1946            rare->appendNew<ConstPtrValue>(proc, Origin(), tagCFunction<B3CCallPtrTag>(simpleFunction)),
    19471947            rare->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR1),
    19481948            rare->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR2)));
     
    19731973            rare->appendNew<CCallValue>(
    19741974                proc, Int32, Origin(),
    1975                 rare->appendNew<ConstPtrValue>(proc, Origin(), tagCFunctionPtr<void*>(simpleFunction, B3CCallPtrTag)),
     1975                rare->appendNew<ConstPtrValue>(proc, Origin(), tagCFunction<B3CCallPtrTag>(simpleFunction)),
    19761976                rare->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR1),
    19771977                rare->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR2)),
     
    19911991        root->appendNew<CCallValue>(
    19921992            proc, Int32, Origin(), Effects::none(),
    1993             root->appendNew<ConstPtrValue>(proc, Origin(), tagCFunctionPtr<void*>(simpleFunction, B3CCallPtrTag)),
     1993            root->appendNew<ConstPtrValue>(proc, Origin(), tagCFunction<B3CCallPtrTag>(simpleFunction)),
    19941994            root->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR0),
    19951995            root->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR1)));
     
    20142014    CCallValue* call = root->appendNew<CCallValue>(
    20152015        proc, Int32, Origin(),
    2016         root->appendNew<ConstPtrValue>(proc, Origin(), tagCFunctionPtr<void*>(functionWithHellaArguments, B3CCallPtrTag)));
     2016        root->appendNew<ConstPtrValue>(proc, Origin(), tagCFunction<B3CCallPtrTag>(functionWithHellaArguments)));
    20172017    call->appendArgs(args);
    20182018
     
    20402040    CCallValue* call = root->appendNew<CCallValue>(
    20412041        proc, Int64, Origin(),
    2042         root->appendNew<ConstPtrValue>(proc, Origin(), tagCFunctionPtr<void*>(functionWithHellaArguments2, B3CCallPtrTag)));
     2042        root->appendNew<ConstPtrValue>(proc, Origin(), tagCFunction<B3CCallPtrTag>(functionWithHellaArguments2)));
    20432043    call->appendArgs(args);
    20442044
     
    20622062    CCallValue* call = root->appendNew<CCallValue>(
    20632063        proc, Int32, Origin(),
    2064         root->appendNew<ConstPtrValue>(proc, Origin(), tagCFunctionPtr<void*>(functionWithHellaArguments3, B3CCallPtrTag)));
     2064        root->appendNew<ConstPtrValue>(proc, Origin(), tagCFunction<B3CCallPtrTag>(functionWithHellaArguments3)));
    20652065    call->appendArgs(args);
    20662066
     
    21132113        root->appendNew<CCallValue>(
    21142114            proc, Double, Origin(),
    2115             root->appendNew<ConstPtrValue>(proc, Origin(), tagCFunctionPtr<void*>(simpleFunctionDouble, B3CCallPtrTag)),
     2115            root->appendNew<ConstPtrValue>(proc, Origin(), tagCFunction<B3CCallPtrTag>(simpleFunctionDouble)),
    21162116            root->appendNew<ArgumentRegValue>(proc, Origin(), FPRInfo::argumentFPR0),
    21172117            root->appendNew<ArgumentRegValue>(proc, Origin(), FPRInfo::argumentFPR1)));
     
    21392139        root->appendNew<CCallValue>(
    21402140            proc, Float, Origin(),
    2141             root->appendNew<ConstPtrValue>(proc, Origin(), tagCFunctionPtr<void*>(simpleFunctionFloat, B3CCallPtrTag)),
     2141            root->appendNew<ConstPtrValue>(proc, Origin(), tagCFunction<B3CCallPtrTag>(simpleFunctionFloat)),
    21422142            floatValue1,
    21432143            floatValue2));
     
    21622162    CCallValue* call = root->appendNew<CCallValue>(
    21632163        proc, Double, Origin(),
    2164         root->appendNew<ConstPtrValue>(proc, Origin(), tagCFunctionPtr<void*>(functionWithHellaDoubleArguments, B3CCallPtrTag)));
     2164        root->appendNew<ConstPtrValue>(proc, Origin(), tagCFunction<B3CCallPtrTag>(functionWithHellaDoubleArguments)));
    21652165    call->appendArgs(args);
    21662166
     
    21862186    CCallValue* call = root->appendNew<CCallValue>(
    21872187        proc, Float, Origin(),
    2188         root->appendNew<ConstPtrValue>(proc, Origin(), tagCFunctionPtr<void*>(functionWithHellaFloatArguments, B3CCallPtrTag)));
     2188        root->appendNew<ConstPtrValue>(proc, Origin(), tagCFunction<B3CCallPtrTag>(functionWithHellaFloatArguments)));
    21892189    call->appendArgs(args);
    21902190
     
    22092209        root->appendNew<CCallValue>(
    22102210            proc, Int32, Origin(),
    2211             root->appendNew<ConstPtrValue>(proc, Origin(), tagCFunctionPtr<void*>(simpleFunction, B3CCallPtrTag)),
     2211            root->appendNew<ConstPtrValue>(proc, Origin(), tagCFunction<B3CCallPtrTag>(simpleFunction)),
    22122212            root->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR0),
    22132213            root->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR1)));
  • trunk/Source/JavaScriptCore/b3/testb3_6.cpp

    r255394 r259786  
    11/*
    2  * Copyright (C) 2015-2019 Apple Inc. All rights reserved.
     2 * Copyright (C) 2015-2020 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    17691769        proc, Void, Origin(),
    17701770        print->appendNew<ConstPtrValue>(
    1771             proc, Origin(), tagCFunctionPtr<void*>(interpreterPrint, B3CCallPtrTag)),
     1771            proc, Origin(), tagCFunction<B3CCallPtrTag>(interpreterPrint)),
    17721772        context,
    17731773        print->appendNew<MemoryValue>(proc, Load, pointerType(), Origin(), dataPointerValue));
  • trunk/Source/JavaScriptCore/b3/testb3_7.cpp

    r248178 r259786  
    11/*
    2  * Copyright (C) 2015-2019 Apple Inc. All rights reserved.
     2 * Copyright (C) 2015-2020 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    572572            return loop->appendNew<CCallValue>(
    573573                proc, Int32, Origin(), Effects::none(),
    574                 loop->appendNew<ConstPtrValue>(proc, Origin(), tagCFunctionPtr<void*>(oneFunction, B3CCallPtrTag)),
     574                loop->appendNew<ConstPtrValue>(proc, Origin(), tagCFunction<B3CCallPtrTag>(oneFunction)),
    575575                loop->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR0));
    576576        });
     
    593593            loop->appendNew<CCallValue>(
    594594                proc, Void, Origin(), effects,
    595                 loop->appendNew<ConstPtrValue>(proc, Origin(), tagCFunctionPtr<void*>(noOpFunction, B3CCallPtrTag)));
     595                loop->appendNew<ConstPtrValue>(proc, Origin(), tagCFunction<B3CCallPtrTag>(noOpFunction)));
    596596
    597597            return loop->appendNew<CCallValue>(
    598598                proc, Int32, Origin(), Effects::none(),
    599                 loop->appendNew<ConstPtrValue>(proc, Origin(), tagCFunctionPtr<void*>(oneFunction, B3CCallPtrTag)),
     599                loop->appendNew<ConstPtrValue>(proc, Origin(), tagCFunction<B3CCallPtrTag>(oneFunction)),
    600600                loop->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR0));
    601601        });
     
    618618            loop->appendNew<CCallValue>(
    619619                proc, Void, Origin(), effects,
    620                 loop->appendNew<ConstPtrValue>(proc, Origin(), tagCFunctionPtr<void*>(noOpFunction, B3CCallPtrTag)));
     620                loop->appendNew<ConstPtrValue>(proc, Origin(), tagCFunction<B3CCallPtrTag>(noOpFunction)));
    621621
    622622            return loop->appendNew<CCallValue>(
    623623                proc, Int32, Origin(), Effects::none(),
    624                 loop->appendNew<ConstPtrValue>(proc, Origin(), tagCFunctionPtr<void*>(oneFunction, B3CCallPtrTag)),
     624                loop->appendNew<ConstPtrValue>(proc, Origin(), tagCFunction<B3CCallPtrTag>(oneFunction)),
    625625                loop->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR0));
    626626        });
     
    643643            loop->appendNew<CCallValue>(
    644644                proc, Void, Origin(), effects,
    645                 loop->appendNew<ConstPtrValue>(proc, Origin(), tagCFunctionPtr<void*>(noOpFunction, B3CCallPtrTag)));
     645                loop->appendNew<ConstPtrValue>(proc, Origin(), tagCFunction<B3CCallPtrTag>(noOpFunction)));
    646646
    647647            return loop->appendNew<CCallValue>(
    648648                proc, Int32, Origin(), Effects::none(),
    649                 loop->appendNew<ConstPtrValue>(proc, Origin(), tagCFunctionPtr<void*>(oneFunction, B3CCallPtrTag)),
     649                loop->appendNew<ConstPtrValue>(proc, Origin(), tagCFunction<B3CCallPtrTag>(oneFunction)),
    650650                loop->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR0));
    651651        });
     
    666666            return loop->appendNew<CCallValue>(
    667667                proc, Int32, Origin(), effects,
    668                 loop->appendNew<ConstPtrValue>(proc, Origin(), tagCFunctionPtr<void*>(oneFunction, B3CCallPtrTag)),
     668                loop->appendNew<ConstPtrValue>(proc, Origin(), tagCFunction<B3CCallPtrTag>(oneFunction)),
    669669                loop->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR0));
    670670        });
     
    687687            return loop->appendNew<CCallValue>(
    688688                proc, Int32, Origin(), effects,
    689                 loop->appendNew<ConstPtrValue>(proc, Origin(), tagCFunctionPtr<void*>(oneFunction, B3CCallPtrTag)),
     689                loop->appendNew<ConstPtrValue>(proc, Origin(), tagCFunction<B3CCallPtrTag>(oneFunction)),
    690690                loop->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR0));
    691691        });
     
    708708            return loop->appendNew<CCallValue>(
    709709                proc, Int32, Origin(), effects,
    710                 loop->appendNew<ConstPtrValue>(proc, Origin(), tagCFunctionPtr<void*>(oneFunction, B3CCallPtrTag)),
     710                loop->appendNew<ConstPtrValue>(proc, Origin(), tagCFunction<B3CCallPtrTag>(oneFunction)),
    711711                loop->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR0));
    712712        });
     
    728728            return loop->appendNew<CCallValue>(
    729729                proc, Int32, Origin(), Effects::none(),
    730                 loop->appendNew<ConstPtrValue>(proc, Origin(), tagCFunctionPtr<void*>(oneFunction, B3CCallPtrTag)),
     730                loop->appendNew<ConstPtrValue>(proc, Origin(), tagCFunction<B3CCallPtrTag>(oneFunction)),
    731731                loop->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR0));
    732732        });
     
    745745            return loop->appendNew<CCallValue>(
    746746                proc, Int32, Origin(), Effects::none(),
    747                 loop->appendNew<ConstPtrValue>(proc, Origin(), tagCFunctionPtr<void*>(oneFunction, B3CCallPtrTag)),
     747                loop->appendNew<ConstPtrValue>(proc, Origin(), tagCFunction<B3CCallPtrTag>(oneFunction)),
    748748                loop->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR0),
    749749                index);
     
    766766            return loop->appendNew<CCallValue>(
    767767                proc, Int32, Origin(), Effects::none(),
    768                 loop->appendNew<ConstPtrValue>(proc, Origin(), tagCFunctionPtr<void*>(oneFunction, B3CCallPtrTag)),
     768                loop->appendNew<ConstPtrValue>(proc, Origin(), tagCFunction<B3CCallPtrTag>(oneFunction)),
    769769                loop->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR0),
    770770                index);
     
    786786            return loop->appendNew<CCallValue>(
    787787                proc, Int32, Origin(), effects,
    788                 loop->appendNew<ConstPtrValue>(proc, Origin(), tagCFunctionPtr<void*>(oneFunction, B3CCallPtrTag)),
     788                loop->appendNew<ConstPtrValue>(proc, Origin(), tagCFunction<B3CCallPtrTag>(oneFunction)),
    789789                loop->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR0));
    790790        });
     
    805805            return loop->appendNew<CCallValue>(
    806806                proc, Int32, Origin(), effects,
    807                 loop->appendNew<ConstPtrValue>(proc, Origin(), tagCFunctionPtr<void*>(oneFunction, B3CCallPtrTag)),
     807                loop->appendNew<ConstPtrValue>(proc, Origin(), tagCFunction<B3CCallPtrTag>(oneFunction)),
    808808                loop->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR0));
    809809        });
     
    824824            return loop->appendNew<CCallValue>(
    825825                proc, Int32, Origin(), effects,
    826                 loop->appendNew<ConstPtrValue>(proc, Origin(), tagCFunctionPtr<void*>(oneFunction, B3CCallPtrTag)),
     826                loop->appendNew<ConstPtrValue>(proc, Origin(), tagCFunction<B3CCallPtrTag>(oneFunction)),
    827827                loop->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR0));
    828828        });
     
    843843            return loop->appendNew<CCallValue>(
    844844                proc, Int32, Origin(), effects,
    845                 loop->appendNew<ConstPtrValue>(proc, Origin(), tagCFunctionPtr<void*>(oneFunction, B3CCallPtrTag)),
     845                loop->appendNew<ConstPtrValue>(proc, Origin(), tagCFunction<B3CCallPtrTag>(oneFunction)),
    846846                loop->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR0));
    847847        });
     
    862862            return loop->appendNew<CCallValue>(
    863863                proc, Int32, Origin(), effects,
    864                 loop->appendNew<ConstPtrValue>(proc, Origin(), tagCFunctionPtr<void*>(oneFunction, B3CCallPtrTag)),
     864                loop->appendNew<ConstPtrValue>(proc, Origin(), tagCFunction<B3CCallPtrTag>(oneFunction)),
    865865                loop->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR0));
    866866        });
     
    883883            return loop->appendNew<CCallValue>(
    884884                proc, Int32, Origin(), effects,
    885                 loop->appendNew<ConstPtrValue>(proc, Origin(), tagCFunctionPtr<void*>(oneFunction, B3CCallPtrTag)),
     885                loop->appendNew<ConstPtrValue>(proc, Origin(), tagCFunction<B3CCallPtrTag>(oneFunction)),
    886886                loop->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR0));
    887887        });
     
    905905            return loop->appendNew<CCallValue>(
    906906                proc, Int32, Origin(), effects,
    907                 loop->appendNew<ConstPtrValue>(proc, Origin(), tagCFunctionPtr<void*>(oneFunction, B3CCallPtrTag)),
     907                loop->appendNew<ConstPtrValue>(proc, Origin(), tagCFunction<B3CCallPtrTag>(oneFunction)),
    908908                loop->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR0));
    909909        });
     
    924924            loop->appendNew<CCallValue>(
    925925                proc, Void, Origin(), effects,
    926                 loop->appendNew<ConstPtrValue>(proc, Origin(), tagCFunctionPtr<void*>(noOpFunction, B3CCallPtrTag)));
     926                loop->appendNew<ConstPtrValue>(proc, Origin(), tagCFunction<B3CCallPtrTag>(noOpFunction)));
    927927       
    928928            effects = Effects::none();
     
    930930            return loop->appendNew<CCallValue>(
    931931                proc, Int32, Origin(), effects,
    932                 loop->appendNew<ConstPtrValue>(proc, Origin(), tagCFunctionPtr<void*>(oneFunction, B3CCallPtrTag)),
     932                loop->appendNew<ConstPtrValue>(proc, Origin(), tagCFunction<B3CCallPtrTag>(oneFunction)),
    933933                loop->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR0));
    934934        });
     
    949949            loop->appendNew<CCallValue>(
    950950                proc, Void, Origin(), effects,
    951                 loop->appendNew<ConstPtrValue>(proc, Origin(), tagCFunctionPtr<void*>(noOpFunction, B3CCallPtrTag)));
     951                loop->appendNew<ConstPtrValue>(proc, Origin(), tagCFunction<B3CCallPtrTag>(noOpFunction)));
    952952       
    953953            effects = Effects::none();
     
    955955            return loop->appendNew<CCallValue>(
    956956                proc, Int32, Origin(), effects,
    957                 loop->appendNew<ConstPtrValue>(proc, Origin(), tagCFunctionPtr<void*>(oneFunction, B3CCallPtrTag)),
     957                loop->appendNew<ConstPtrValue>(proc, Origin(), tagCFunction<B3CCallPtrTag>(oneFunction)),
    958958                loop->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR0));
    959959        });
     
    976976            loop->appendNew<CCallValue>(
    977977                proc, Void, Origin(), effects,
    978                 loop->appendNew<ConstPtrValue>(proc, Origin(), tagCFunctionPtr<void*>(noOpFunction, B3CCallPtrTag)));
     978                loop->appendNew<ConstPtrValue>(proc, Origin(), tagCFunction<B3CCallPtrTag>(noOpFunction)));
    979979       
    980980            effects = Effects::none();
     
    982982            return loop->appendNew<CCallValue>(
    983983                proc, Int32, Origin(), effects,
    984                 loop->appendNew<ConstPtrValue>(proc, Origin(), tagCFunctionPtr<void*>(oneFunction, B3CCallPtrTag)),
     984                loop->appendNew<ConstPtrValue>(proc, Origin(), tagCFunction<B3CCallPtrTag>(oneFunction)),
    985985                loop->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR0));
    986986        });
     
    10011001            loop->appendNew<CCallValue>(
    10021002                proc, Void, Origin(), effects,
    1003                 loop->appendNew<ConstPtrValue>(proc, Origin(), tagCFunctionPtr<void*>(noOpFunction, B3CCallPtrTag)));
     1003                loop->appendNew<ConstPtrValue>(proc, Origin(), tagCFunction<B3CCallPtrTag>(noOpFunction)));
    10041004       
    10051005            effects = Effects::none();
     
    10071007            return loop->appendNew<CCallValue>(
    10081008                proc, Int32, Origin(), effects,
    1009                 loop->appendNew<ConstPtrValue>(proc, Origin(), tagCFunctionPtr<void*>(oneFunction, B3CCallPtrTag)),
     1009                loop->appendNew<ConstPtrValue>(proc, Origin(), tagCFunction<B3CCallPtrTag>(oneFunction)),
    10101010                loop->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR0));
    10111011        });
     
    10241024            return loop->appendNew<CCallValue>(
    10251025                proc, Int32, Origin(),
    1026                 loop->appendNew<ConstPtrValue>(proc, Origin(), tagCFunctionPtr<void*>(oneFunction, B3CCallPtrTag)),
     1026                loop->appendNew<ConstPtrValue>(proc, Origin(), tagCFunction<B3CCallPtrTag>(oneFunction)),
    10271027                loop->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR0));
    10281028        });
     
    14111411    unlikely->appendNew<CCallValue>(
    14121412        proc, Void, Origin(),
    1413         unlikely->appendNew<ConstPtrValue>(proc, Origin(), tagCFunctionPtr<void*>(functionNineArgs, B3CCallPtrTag)),
     1413        unlikely->appendNew<ConstPtrValue>(proc, Origin(), tagCFunction<B3CCallPtrTag>(functionNineArgs)),
    14141414        constNumber, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8);
    14151415
  • trunk/Source/JavaScriptCore/dfg/DFGOSRExit.cpp

    r257721 r259786  
    11/*
    2  * Copyright (C) 2011-2019 Apple Inc. All rights reserved.
     2 * Copyright (C) 2011-2020 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    127127        switch (recovery.technique()) {
    128128        case DirectArgumentsThatWereNotCreated:
    129             jit.move(AssemblyHelpers::TrustedImmPtr(tagCFunctionPtr<OperationPtrTag>(operationCreateDirectArgumentsDuringExit)), GPRInfo::nonArgGPR0);
     129            jit.move(AssemblyHelpers::TrustedImmPtr(tagCFunction<OperationPtrTag>(operationCreateDirectArgumentsDuringExit)), GPRInfo::nonArgGPR0);
    130130            break;
    131131        case ClonedArgumentsThatWereNotCreated:
    132             jit.move(AssemblyHelpers::TrustedImmPtr(tagCFunctionPtr<OperationPtrTag>(operationCreateClonedArgumentsDuringExit)), GPRInfo::nonArgGPR0);
     132            jit.move(AssemblyHelpers::TrustedImmPtr(tagCFunction<OperationPtrTag>(operationCreateClonedArgumentsDuringExit)), GPRInfo::nonArgGPR0);
    133133            break;
    134134        default:
  • trunk/Source/JavaScriptCore/dfg/DFGOSRExitCompilerCommon.cpp

    r258874 r259786  
    11/*
    2  * Copyright (C) 2013-2019 Apple Inc. All rights reserved.
     2 * Copyright (C) 2013-2020 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    109109    jit.setupArguments<decltype(operationTriggerReoptimizationNow)>(GPRInfo::regT0, GPRInfo::regT3, AssemblyHelpers::TrustedImmPtr(&exit));
    110110    jit.prepareCallOperation(vm);
    111     jit.move(AssemblyHelpers::TrustedImmPtr(tagCFunctionPtr<OperationPtrTag>(operationTriggerReoptimizationNow)), GPRInfo::nonArgGPR0);
     111    jit.move(AssemblyHelpers::TrustedImmPtr(tagCFunction<OperationPtrTag>(operationTriggerReoptimizationNow)), GPRInfo::nonArgGPR0);
    112112    jit.call(GPRInfo::nonArgGPR0, OperationPtrTag);
    113113    AssemblyHelpers::Jump doneAdjusting = jit.jump();
     
    355355    jit.setupArguments<decltype(operationOSRWriteBarrier)>(&vm, owner);
    356356    jit.prepareCallOperation(vm);
    357     jit.move(MacroAssembler::TrustedImmPtr(tagCFunctionPtr<OperationPtrTag>(operationOSRWriteBarrier)), scratch);
     357    jit.move(MacroAssembler::TrustedImmPtr(tagCFunction<OperationPtrTag>(operationOSRWriteBarrier)), scratch);
    358358    jit.call(scratch, OperationPtrTag);
    359359
  • trunk/Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp

    r259676 r259786  
    11/*
    2  * Copyright (C) 2013-2019 Apple Inc. All rights reserved.
     2 * Copyright (C) 2013-2020 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    93819381                };
    93829382
    9383                 auto callWithExceptionCheck = [&] (void* callee) {
    9384                     jit.move(CCallHelpers::TrustedImmPtr(tagCFunctionPtr<OperationPtrTag>(callee)), GPRInfo::nonPreservedNonArgumentGPR0);
     9383                auto callWithExceptionCheck = [&] (void(*callee)(JSGlobalObject*)) {
     9384                    jit.move(CCallHelpers::TrustedImmPtr(tagCFunction<OperationPtrTag>(callee)), GPRInfo::nonPreservedNonArgumentGPR0);
    93859385                    jit.call(GPRInfo::nonPreservedNonArgumentGPR0, OperationPtrTag);
    93869386                    exceptions->append(jit.emitExceptionCheck(*vm, AssemblyHelpers::NormalExceptionCheck, AssemblyHelpers::FarJumpWidth));
     
    94799479                    jit.setupArguments<decltype(operationThrowStackOverflowForVarargs)>(jit.codeBlock()->globalObjectFor(node->origin.semantic));
    94809480                    jit.prepareCallOperation(jit.vm());
    9481                     callWithExceptionCheck(bitwise_cast<void*>(operationThrowStackOverflowForVarargs));
     9481                    callWithExceptionCheck(operationThrowStackOverflowForVarargs);
    94829482                    jit.abortWithReason(DFGVarargsThrowingPathDidNotThrow);
    94839483                   
     
    97219721                RELEASE_ASSERT(!allocator.numberOfReusedRegisters());
    97229722
    9723                 auto callWithExceptionCheck = [&] (void* callee) {
    9724                     jit.move(CCallHelpers::TrustedImmPtr(tagCFunctionPtr<OperationPtrTag>(callee)), GPRInfo::nonPreservedNonArgumentGPR0);
     9723                auto callWithExceptionCheck = [&] (void(*callee)()) {
     9724                    jit.move(CCallHelpers::TrustedImmPtr(tagCFunction<OperationPtrTag>(callee)), GPRInfo::nonPreservedNonArgumentGPR0);
    97259725                    jit.call(GPRInfo::nonPreservedNonArgumentGPR0, OperationPtrTag);
    97269726                    exceptions->append(jit.emitExceptionCheck(*vm, AssemblyHelpers::NormalExceptionCheck, AssemblyHelpers::FarJumpWidth));
     
    97469746                    jit.setupArguments<decltype(operationThrowStackOverflowForVarargs)>(jit.codeBlock()->globalObjectFor(node->origin.semantic));
    97479747                    jit.prepareCallOperation(jit.vm());
    9748                     callWithExceptionCheck(bitwise_cast<void*>(operationThrowStackOverflowForVarargs));
     9748                    callWithExceptionCheck(bitwise_cast<void(*)()>(operationThrowStackOverflowForVarargs));
    97499749                    jit.abortWithReason(DFGVarargsThrowingPathDidNotThrow);
    97509750                   
     
    97549754                    jit.setupArguments<decltype(operationSizeFrameForVarargs)>(jit.codeBlock()->globalObjectFor(node->origin.semantic), argumentsGPR, scratchGPR1, CCallHelpers::TrustedImm32(data->firstVarArgOffset));
    97559755                    jit.prepareCallOperation(jit.vm());
    9756                     callWithExceptionCheck(bitwise_cast<void*>(operationSizeFrameForVarargs));
     9756                    callWithExceptionCheck(bitwise_cast<void(*)()>(operationSizeFrameForVarargs));
    97579757
    97589758                    jit.move(GPRInfo::returnValueGPR, scratchGPR1);
     
    97639763                    jit.setupArguments<decltype(operationSetupVarargsFrame)>(jit.codeBlock()->globalObjectFor(node->origin.semantic), scratchGPR2, argumentsGPR, CCallHelpers::TrustedImm32(data->firstVarArgOffset), scratchGPR1);
    97649764                    jit.prepareCallOperation(jit.vm());
    9765                     callWithExceptionCheck(bitwise_cast<void*>(operationSetupVarargsFrame));
     9765                    callWithExceptionCheck(bitwise_cast<void(*)()>(operationSetupVarargsFrame));
    97669766                   
    97679767                    jit.addPtr(CCallHelpers::TrustedImm32(sizeof(CallerFrameAndPC)), GPRInfo::returnValueGPR, CCallHelpers::stackPointerRegister);
     
    99169916                jit.setupArguments<decltype(operationCallEval)>(globalObject, GPRInfo::regT1, GPRInfo::regT2);
    99179917                jit.prepareCallOperation(vm);
    9918                 jit.move(CCallHelpers::TrustedImmPtr(tagCFunctionPtr<OperationPtrTag>(operationCallEval)), GPRInfo::nonPreservedNonArgumentGPR0);
     9918                jit.move(CCallHelpers::TrustedImmPtr(tagCFunction<OperationPtrTag>(operationCallEval)), GPRInfo::nonPreservedNonArgumentGPR0);
    99199919                jit.call(GPRInfo::nonPreservedNonArgumentGPR0, OperationPtrTag);
    99209920                exceptions->append(jit.emitExceptionCheck(state->vm(), AssemblyHelpers::NormalExceptionCheck, AssemblyHelpers::FarJumpWidth));
  • trunk/Source/JavaScriptCore/ftl/FTLOSRExitCompiler.cpp

    r254735 r259786  
    11/*
    2  * Copyright (C) 2013-2019 Apple Inc. All rights reserved.
     2 * Copyright (C) 2013-2020 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    338338                CCallHelpers::TrustedImmPtr(materializationArguments));
    339339            jit.prepareCallOperation(vm);
    340             jit.move(CCallHelpers::TrustedImmPtr(tagCFunctionPtr<OperationPtrTag>(operationMaterializeObjectInOSR)), GPRInfo::nonArgGPR0);
     340            jit.move(CCallHelpers::TrustedImmPtr(tagCFunction<OperationPtrTag>(operationMaterializeObjectInOSR)), GPRInfo::nonArgGPR0);
    341341            jit.call(GPRInfo::nonArgGPR0, OperationPtrTag);
    342342            jit.storePtr(GPRInfo::returnValueGPR, materializationToPointer.get(materialization));
     
    368368            CCallHelpers::TrustedImmPtr(materializationArguments));
    369369        jit.prepareCallOperation(vm);
    370         jit.move(CCallHelpers::TrustedImmPtr(tagCFunctionPtr<OperationPtrTag>(operationPopulateObjectInOSR)), GPRInfo::nonArgGPR0);
     370        jit.move(CCallHelpers::TrustedImmPtr(tagCFunction<OperationPtrTag>(operationPopulateObjectInOSR)), GPRInfo::nonArgGPR0);
    371371        jit.call(GPRInfo::nonArgGPR0, OperationPtrTag);
    372372    }
  • trunk/Source/JavaScriptCore/jit/AssemblyHelpers.cpp

    r254087 r259786  
    11/*
    2  * Copyright (C) 2011-2019 Apple Inc. All rights reserved.
     2 * Copyright (C) 2011-2020 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    252252    // Set up one argument.
    253253    move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR0);
    254     move(TrustedImmPtr(tagCFunctionPtr<OperationPtrTag>(operationExceptionFuzz)), GPRInfo::nonPreservedNonReturnGPR);
     254    move(TrustedImmPtr(tagCFunction<OperationPtrTag>(operationExceptionFuzz)), GPRInfo::nonPreservedNonReturnGPR);
    255255    prepareCallOperation(vm);
    256256    call(GPRInfo::nonPreservedNonReturnGPR, OperationPtrTag);
  • trunk/Source/JavaScriptCore/jit/CCallHelpers.cpp

    r251518 r259786  
    11/*
    2  * Copyright (C) 2016-2018 Apple Inc. All rights reserved.
     2 * Copyright (C) 2016-2020 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    6363    setupArguments<decltype(operationProcessShadowChickenLog)>(TrustedImmPtr(&vm));
    6464    prepareCallOperation(vm);
    65     move(TrustedImmPtr(tagCFunctionPtr<OperationPtrTag>(operationProcessShadowChickenLog)), scratch1NonArgGPR);
     65    move(TrustedImmPtr(tagCFunction<OperationPtrTag>(operationProcessShadowChickenLog)), scratch1NonArgGPR);
    6666    call(scratch1NonArgGPR, OperationPtrTag);
    6767    move(TrustedImmPtr(shadowChicken->addressOfLogCursor()), scratch1NonArgGPR);
  • trunk/Source/JavaScriptCore/jit/JITOperations.cpp

    r259676 r259786  
    10651065
    10661066            return encodeResult(
    1067                 tagCFunctionPtr<void*, JSEntryPtrTag>(getHostCallReturnValue),
     1067                tagCFunction<void*, JSEntryPtrTag>(getHostCallReturnValue),
    10681068                reinterpret_cast<void*>(callLinkInfo->callMode() == CallMode::Tail ? ReuseTheFrame : KeepTheFrame));
    10691069        }
     
    10931093        }
    10941094
    1095         return encodeResult(tagCFunctionPtr<void*, JSEntryPtrTag>(getHostCallReturnValue), reinterpret_cast<void*>(KeepTheFrame));
     1095        return encodeResult(tagCFunction<void*, JSEntryPtrTag>(getHostCallReturnValue), reinterpret_cast<void*>(KeepTheFrame));
    10961096    }
    10971097   
  • trunk/Source/JavaScriptCore/jit/ThunkGenerators.cpp

    r258063 r259786  
    11/*
    2  * Copyright (C) 2010-2019 Apple Inc. All rights reserved.
     2 * Copyright (C) 2010-2020 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    7474    jit.setupArguments<decltype(operationLookupExceptionHandler)>(CCallHelpers::TrustedImmPtr(&vm));
    7575    jit.prepareCallOperation(vm);
    76     jit.move(CCallHelpers::TrustedImmPtr(tagCFunctionPtr<OperationPtrTag>(operationLookupExceptionHandler)), GPRInfo::nonArgGPR0);
     76    jit.move(CCallHelpers::TrustedImmPtr(tagCFunction<OperationPtrTag>(operationLookupExceptionHandler)), GPRInfo::nonArgGPR0);
    7777    emitPointerValidation(jit, GPRInfo::nonArgGPR0, OperationPtrTag);
    7878    jit.call(GPRInfo::nonArgGPR0, OperationPtrTag);
     
    101101    jit.addPtr(CCallHelpers::TrustedImm32(32), CCallHelpers::stackPointerRegister, GPRInfo::argumentGPR0);
    102102    jit.move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR1);
    103     jit.move(CCallHelpers::TrustedImmPtr(tagCFunctionPtr<OperationPtrTag>(slowPathFunction)), GPRInfo::nonArgGPR0);
     103    jit.move(CCallHelpers::TrustedImmPtr(tagCFunction<OperationPtrTag>(slowPathFunction)), GPRInfo::nonArgGPR0);
    104104    emitPointerValidation(jit, GPRInfo::nonArgGPR0, OperationPtrTag);
    105105    jit.call(GPRInfo::nonArgGPR0, OperationPtrTag);
     
    111111        jit.addPtr(CCallHelpers::TrustedImm32(-maxFrameExtentForSlowPathCall), CCallHelpers::stackPointerRegister);
    112112    jit.setupArguments<decltype(slowPathFunction)>(GPRInfo::regT3, GPRInfo::regT2);
    113     jit.move(CCallHelpers::TrustedImmPtr(tagCFunctionPtr<OperationPtrTag>(slowPathFunction)), GPRInfo::nonArgGPR0);
     113    jit.move(CCallHelpers::TrustedImmPtr(tagCFunction<OperationPtrTag>(slowPathFunction)), GPRInfo::nonArgGPR0);
    114114    emitPointerValidation(jit, GPRInfo::nonArgGPR0, OperationPtrTag);
    115115    jit.call(GPRInfo::nonArgGPR0, OperationPtrTag);
     
    336336#endif
    337337    jit.move(CCallHelpers::TrustedImmPtr(&vm), JSInterfaceJIT::argumentGPR0);
    338     jit.move(JSInterfaceJIT::TrustedImmPtr(tagCFunctionPtr<OperationPtrTag>(operationVMHandleException)), JSInterfaceJIT::regT3);
     338    jit.move(JSInterfaceJIT::TrustedImmPtr(tagCFunction<OperationPtrTag>(operationVMHandleException)), JSInterfaceJIT::regT3);
    339339    jit.call(JSInterfaceJIT::regT3, OperationPtrTag);
    340340#if OS(WINDOWS)
     
    11921192    jit.setupArguments<decltype(operationThrowStackOverflowErrorFromThunk)>(GPRInfo::regT3);
    11931193    jit.prepareCallOperation(vm);
    1194     jit.move(CCallHelpers::TrustedImmPtr(tagCFunctionPtr<OperationPtrTag>(operationThrowStackOverflowErrorFromThunk)), GPRInfo::nonArgGPR0);
     1194    jit.move(CCallHelpers::TrustedImmPtr(tagCFunction<OperationPtrTag>(operationThrowStackOverflowErrorFromThunk)), GPRInfo::nonArgGPR0);
    11951195    emitPointerValidation(jit, GPRInfo::nonArgGPR0, OperationPtrTag);
    11961196    jit.call(GPRInfo::nonArgGPR0, OperationPtrTag);
  • trunk/Source/JavaScriptCore/wasm/WasmB3IRGenerator.cpp

    r256665 r259786  
    11/*
    2  * Copyright (C) 2016-2019 Apple Inc. All rights reserved.
     2 * Copyright (C) 2016-2020 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    699699    // FIXME: Emit this inline <https://bugs.webkit.org/show_bug.cgi?id=198506>.
    700700    result = m_currentBlock->appendNew<CCallValue>(m_proc, toB3Type(Anyref), origin(),
    701         m_currentBlock->appendNew<ConstPtrValue>(m_proc, origin(), tagCFunctionPtr<void*>(&operationGetWasmTableElement, B3CCallPtrTag)),
     701        m_currentBlock->appendNew<ConstPtrValue>(m_proc, origin(), tagCFunction<B3CCallPtrTag>(operationGetWasmTableElement)),
    702702        instanceValue(), m_currentBlock->appendNew<Const32Value>(m_proc, origin(), tableIndex), index);
    703703
     
    718718    // FIXME: Emit this inline <https://bugs.webkit.org/show_bug.cgi?id=198506>.
    719719    auto shouldThrow = m_currentBlock->appendNew<CCallValue>(m_proc, B3::Int32, origin(),
    720         m_currentBlock->appendNew<ConstPtrValue>(m_proc, origin(), tagCFunctionPtr<void*>(&operationSetWasmTableElement, B3CCallPtrTag)),
     720        m_currentBlock->appendNew<ConstPtrValue>(m_proc, origin(), tagCFunction<B3CCallPtrTag>(operationSetWasmTableElement)),
    721721        instanceValue(), m_currentBlock->appendNew<Const32Value>(m_proc, origin(), tableIndex), index, value);
    722722
     
    738738
    739739    result = m_currentBlock->appendNew<CCallValue>(m_proc, B3::Int64, origin(),
    740         m_currentBlock->appendNew<ConstPtrValue>(m_proc, origin(), tagCFunctionPtr<void*>(&operationWasmRefFunc, B3CCallPtrTag)),
     740        m_currentBlock->appendNew<ConstPtrValue>(m_proc, origin(), tagCFunction<B3CCallPtrTag>(operationWasmRefFunc)),
    741741        instanceValue(), addConstant(Type::I32, index));
    742742
     
    748748    // FIXME: Emit this inline <https://bugs.webkit.org/show_bug.cgi?id=198506>.
    749749    result = m_currentBlock->appendNew<CCallValue>(m_proc, toB3Type(I32), origin(),
    750         m_currentBlock->appendNew<ConstPtrValue>(m_proc, origin(), tagCFunctionPtr<void*>(&operationGetWasmTableSize, B3CCallPtrTag)),
     750        m_currentBlock->appendNew<ConstPtrValue>(m_proc, origin(), tagCFunction<B3CCallPtrTag>(operationGetWasmTableSize)),
    751751        instanceValue(), m_currentBlock->appendNew<Const32Value>(m_proc, origin(), tableIndex));
    752752
     
    757757{
    758758    result = m_currentBlock->appendNew<CCallValue>(m_proc, toB3Type(I32), origin(),
    759         m_currentBlock->appendNew<ConstPtrValue>(m_proc, origin(), tagCFunctionPtr<void*>(&operationWasmTableGrow, B3CCallPtrTag)),
     759        m_currentBlock->appendNew<ConstPtrValue>(m_proc, origin(), tagCFunction<B3CCallPtrTag>(operationWasmTableGrow)),
    760760        instanceValue(), m_currentBlock->appendNew<Const32Value>(m_proc, origin(), tableIndex), fill, delta);
    761761
     
    766766{
    767767    auto result = m_currentBlock->appendNew<CCallValue>(m_proc, toB3Type(I32), origin(),
    768         m_currentBlock->appendNew<ConstPtrValue>(m_proc, origin(), tagCFunctionPtr<void*>(&operationWasmTableFill, B3CCallPtrTag)),
     768        m_currentBlock->appendNew<ConstPtrValue>(m_proc, origin(), tagCFunction<B3CCallPtrTag>(operationWasmTableFill)),
    769769        instanceValue(), m_currentBlock->appendNew<Const32Value>(m_proc, origin(), tableIndex), offset, fill, count);
    770770
     
    801801{
    802802    result = m_currentBlock->appendNew<CCallValue>(m_proc, Int32, origin(),
    803         m_currentBlock->appendNew<ConstPtrValue>(m_proc, origin(), tagCFunctionPtr<void*>(&operationGrowMemory, B3CCallPtrTag)),
     803        m_currentBlock->appendNew<ConstPtrValue>(m_proc, origin(), tagCFunction<B3CCallPtrTag>(operationGrowMemory)),
    804804        framePointer(), instanceValue(), delta);
    805805
     
    905905            m_currentBlock = doSlowPath;
    906906
    907             Value* writeBarrierAddress = m_currentBlock->appendNew<ConstPtrValue>(m_proc, origin(), tagCFunctionPtr<void*>(&operationWasmWriteBarrierSlowPath, B3CCallPtrTag));
     907            Value* writeBarrierAddress = m_currentBlock->appendNew<ConstPtrValue>(m_proc, origin(), tagCFunction<B3CCallPtrTag>(operationWasmWriteBarrierSlowPath));
    908908            m_currentBlock->appendNew<CCallValue>(m_proc, B3::Void, origin(), writeBarrierAddress, cell, vm);
    909909            m_currentBlock->appendNewControlValue(m_proc, Jump, origin(), continuation);
     
    958958    m_currentBlock = doSlowPath;
    959959
    960     Value* writeBarrierAddress = m_currentBlock->appendNew<ConstPtrValue>(m_proc, origin(), tagCFunctionPtr<void*>(&operationWasmWriteBarrierSlowPath, B3CCallPtrTag));
     960    Value* writeBarrierAddress = m_currentBlock->appendNew<ConstPtrValue>(m_proc, origin(), tagCFunction<B3CCallPtrTag>(operationWasmWriteBarrierSlowPath));
    961961    m_currentBlock->appendNew<CCallValue>(m_proc, B3::Void, origin(), writeBarrierAddress, cell, vm);
    962962    m_currentBlock->appendNewControlValue(m_proc, Jump, origin(), continuation);
     
    21512151#endif
    21522152
    2153     Value* funcAddress = m_currentBlock->appendNew<ConstPtrValue>(m_proc, origin(), tagCFunctionPtr<void*>(&operationPopcount32, B3CCallPtrTag));
     2153    Value* funcAddress = m_currentBlock->appendNew<ConstPtrValue>(m_proc, origin(), tagCFunction<B3CCallPtrTag>(operationPopcount32));
    21542154    result = m_currentBlock->appendNew<CCallValue>(m_proc, Int32, origin(), Effects::none(), funcAddress, arg);
    21552155    return { };
     
    21722172#endif
    21732173
    2174     Value* funcAddress = m_currentBlock->appendNew<ConstPtrValue>(m_proc, origin(), tagCFunctionPtr<void*>(operationPopcount64, B3CCallPtrTag));
     2174    Value* funcAddress = m_currentBlock->appendNew<ConstPtrValue>(m_proc, origin(), tagCFunction<B3CCallPtrTag>(operationPopcount64));
    21752175    result = m_currentBlock->appendNew<CCallValue>(m_proc, Int64, origin(), Effects::none(), funcAddress, arg);
    21762176    return { };
  • trunk/Source/JavaScriptCore/wasm/WasmThunks.cpp

    r253140 r259786  
    11/*
    2  * Copyright (C) 2017-2018 Apple Inc. All rights reserved.
     2 * Copyright (C) 2017-2020 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    8989
    9090    jit.loadWasmContextInstance(GPRInfo::argumentGPR0);
    91     jit.move(MacroAssembler::TrustedImmPtr(tagCFunctionPtr<OperationPtrTag>(operationWasmTriggerTierUpNow)), GPRInfo::argumentGPR2);
     91    jit.move(MacroAssembler::TrustedImmPtr(tagCFunction<OperationPtrTag>(operationWasmTriggerTierUpNow)), GPRInfo::argumentGPR2);
    9292    jit.call(GPRInfo::argumentGPR2, OperationPtrTag);
    9393
  • trunk/Source/WTF/ChangeLog

    r259780 r259786  
     12020-04-09  Mark Lam  <mark.lam@apple.com>
     2
     3        Implement a more efficient tagCFunction() tool.
     4        https://bugs.webkit.org/show_bug.cgi?id=210254
     5
     6        Reviewed by Keith Miller.
     7
     8        The current tagCFunctionPtr() tool does some extra work that is not needed if
     9        we are tagging a known function and not a potentially arbitrary pointer.  For
     10        example,
     11        1. it doesn't need to do a null check.
     12        2. it doesn't need to authenticate the function address. 
     13        3. The RELEASE_ASSERT used to enforce that authentication can also go away.
     14
     15        We should only use tagCFunction() (instead of tagCFunctionPtr()) if we know for
     16        certain that we're operating on a C/C++ function, and not some arbitrary pointer.
     17
     18        * wtf/PtrTag.h:
     19        (WTF::tagCFunction):
     20
    1212020-04-08  David Kilzer  <ddkilzer@apple.com>
    222
  • trunk/Source/WTF/wtf/PtrTag.h

    r254087 r259786  
    11/*
    2  * Copyright (C) 2018-2019 Apple Inc. All rights reserved.
     2 * Copyright (C) 2018-2020 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    321321inline PtrType tagCFunctionPtr(PtrType ptr) { return tagCFunctionPtr(ptr, tag); }
    322322
     323template<PtrTag newTag, typename FunctionType, class = typename std::enable_if<std::is_pointer<FunctionType>::value && std::is_function<typename std::remove_pointer<FunctionType>::type>::value>::type>
     324inline FunctionType tagCFunction(FunctionType func)
     325{
     326    ASSERT(isTaggedWith(func, CFunctionPtrTag));
     327    ASSERT(newTag != CFunctionPtrTag);
     328    return ptrauth_auth_and_resign(func, ptrauth_key_function_pointer, 0, ptrauth_key_process_dependent_code, newTag);
     329}
     330
     331template<typename ReturnType, PtrTag newTag, typename FunctionType, class = typename std::enable_if<std::is_pointer<FunctionType>::value && std::is_function<typename std::remove_pointer<FunctionType>::type>::value>::type>
     332inline ReturnType tagCFunction(FunctionType func)
     333{
     334    return bitwise_cast<ReturnType>(tagCFunction<newTag>(func));
     335}
     336
    323337template<PtrTagAction tagAction, typename PtrType>
    324338inline PtrType untagCFunctionPtrImpl(PtrType ptr, PtrTag tag)
     
    522536inline PtrType tagCFunctionPtr(PtrType ptr) { return ptr; }
    523537
     538template<PtrTag newTag, typename FunctionType, class = typename std::enable_if<std::is_pointer<FunctionType>::value && std::is_function<typename std::remove_pointer<FunctionType>::type>::value>::type>
     539inline FunctionType tagCFunction(FunctionType func) { return func; }
     540
     541template<typename ReturnType, PtrTag newTag, typename FunctionType, class = typename std::enable_if<std::is_pointer<FunctionType>::value && std::is_function<typename std::remove_pointer<FunctionType>::type>::value>::type>
     542inline ReturnType tagCFunction(FunctionType func)
     543{
     544    return bitwise_cast<ReturnType>(tagCFunction<newTag>(func));
     545}
     546
    524547template<typename T, typename PtrType, typename = std::enable_if_t<std::is_pointer<PtrType>::value && !std::is_same<T, PtrType>::value>>
    525548inline T untagCFunctionPtr(PtrType ptr, PtrTag) { return bitwise_cast<T>(ptr); }
     
    579602using WTF::retagCodePtr;
    580603using WTF::removeCodePtrTag;
     604using WTF::tagCFunction;
    581605using WTF::tagCFunctionPtr;
    582606using WTF::untagCFunctionPtr;
Note: See TracChangeset for help on using the changeset viewer.