Diff
Modified: trunk/Source/_javascript_Core/ChangeLog (259785 => 259786)
--- trunk/Source/_javascript_Core/ChangeLog 2020-04-09 07:57:16 UTC (rev 259785)
+++ trunk/Source/_javascript_Core/ChangeLog 2020-04-09 09:27:40 UTC (rev 259786)
@@ -1,3 +1,93 @@
+2020-04-09 Mark Lam <[email protected]>
+
+ Implement a more efficient tagCFunction() tool.
+ https://bugs.webkit.org/show_bug.cgi?id=210254
+
+ Reviewed by Keith Miller.
+
+ 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):
+
2020-04-08 Devin Rousso <[email protected]>
Web Inspector: Debugger: treat comma sub-expressions as separate statements
Modified: trunk/Source/_javascript_Core/b3/B3LowerMacros.cpp (259785 => 259786)
--- trunk/Source/_javascript_Core/b3/B3LowerMacros.cpp 2020-04-09 07:57:16 UTC (rev 259785)
+++ trunk/Source/_javascript_Core/b3/B3LowerMacros.cpp 2020-04-09 09:27:40 UTC (rev 259786)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2015-2019 Apple Inc. All rights reserved.
+ * Copyright (C) 2015-2020 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -128,7 +128,8 @@
break;
}
- auto* fmodDouble = tagCFunctionPtr<double (*)(double, double)>(fmod, B3CCallPtrTag);
+ double(*fmodDouble)(double, double) = fmod;
+ fmodDouble = tagCFunction<B3CCallPtrTag>(fmodDouble);
if (m_value->type() == Double) {
Value* functionAddress = m_insertionSet.insert<ConstPtrValue>(m_index, m_origin, fmodDouble);
Value* result = m_insertionSet.insert<CCallValue>(m_index, Double, m_origin,
Modified: trunk/Source/_javascript_Core/b3/B3LowerMacrosAfterOptimizations.cpp (259785 => 259786)
--- trunk/Source/_javascript_Core/b3/B3LowerMacrosAfterOptimizations.cpp 2020-04-09 07:57:16 UTC (rev 259785)
+++ trunk/Source/_javascript_Core/b3/B3LowerMacrosAfterOptimizations.cpp 2020-04-09 09:27:40 UTC (rev 259786)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2015-2018 Apple Inc. All rights reserved.
+ * Copyright (C) 2015-2020 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -100,9 +100,9 @@
Value* functionAddress = nullptr;
if (m_value->type() == Double) {
double (*ceilDouble)(double) = ceil;
- functionAddress = m_insertionSet.insert<ConstPtrValue>(m_index, m_origin, tagCFunctionPtr(ceilDouble, B3CCallPtrTag));
+ functionAddress = m_insertionSet.insert<ConstPtrValue>(m_index, m_origin, tagCFunction<B3CCallPtrTag>(ceilDouble));
} else if (m_value->type() == Float)
- functionAddress = m_insertionSet.insert<ConstPtrValue>(m_index, m_origin, tagCFunctionPtr(ceilf, B3CCallPtrTag));
+ functionAddress = m_insertionSet.insert<ConstPtrValue>(m_index, m_origin, tagCFunction<B3CCallPtrTag>(ceilf));
else
RELEASE_ASSERT_NOT_REACHED();
@@ -122,9 +122,9 @@
Value* functionAddress = nullptr;
if (m_value->type() == Double) {
double (*floorDouble)(double) = floor;
- functionAddress = m_insertionSet.insert<ConstPtrValue>(m_index, m_origin, tagCFunctionPtr(floorDouble, B3CCallPtrTag));
+ functionAddress = m_insertionSet.insert<ConstPtrValue>(m_index, m_origin, tagCFunction<B3CCallPtrTag>(floorDouble));
} else if (m_value->type() == Float)
- functionAddress = m_insertionSet.insert<ConstPtrValue>(m_index, m_origin, tagCFunctionPtr(floorf, B3CCallPtrTag));
+ functionAddress = m_insertionSet.insert<ConstPtrValue>(m_index, m_origin, tagCFunction<B3CCallPtrTag>(floorf));
else
RELEASE_ASSERT_NOT_REACHED();
Modified: trunk/Source/_javascript_Core/b3/B3MathExtras.cpp (259785 => 259786)
--- trunk/Source/_javascript_Core/b3/B3MathExtras.cpp 2020-04-09 07:57:16 UTC (rev 259785)
+++ trunk/Source/_javascript_Core/b3/B3MathExtras.cpp 2020-04-09 09:27:40 UTC (rev 259786)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2015-2018 Apple Inc. All rights reserved.
+ * Copyright (C) 2015-2020 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -57,7 +57,8 @@
// Function call.
Value* yAsDouble = functionCallCase->appendNew<Value>(procedure, IToD, origin, y);
- auto* powDouble = tagCFunctionPtr<double (*)(double, double)>(pow, B3CCallPtrTag);
+ double(*powDouble)(double, double) = pow;
+ powDouble = tagCFunction<B3CCallPtrTag>(powDouble);
Value* powResult = functionCallCase->appendNew<CCallValue>(
procedure, Double, origin,
functionCallCase->appendNew<ConstPtrValue>(procedure, origin, bitwise_cast<void*>(powDouble)),
Modified: trunk/Source/_javascript_Core/b3/B3ReduceLoopStrength.cpp (259785 => 259786)
--- trunk/Source/_javascript_Core/b3/B3ReduceLoopStrength.cpp 2020-04-09 07:57:16 UTC (rev 259785)
+++ trunk/Source/_javascript_Core/b3/B3ReduceLoopStrength.cpp 2020-04-09 09:27:40 UTC (rev 259786)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2019 Apple Inc. All rights reserved.
+ * Copyright (C) 2019-2020 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -444,7 +444,7 @@
Effects effects = Effects::forCall();
memcpy->appendNew<CCallValue>(m_proc, B3::Void, origin, effects,
- memcpy->appendNew<ConstPtrValue>(m_proc, origin, tagCFunctionPtr<void*>(fastForwardCopy32, B3CCallPtrTag)),
+ memcpy->appendNew<ConstPtrValue>(m_proc, origin, tagCFunction<B3CCallPtrTag>(fastForwardCopy32)),
destination->appendAddr(m_proc, memcpy, destination->arrayBase),
source->appendAddr(m_proc, memcpy, source->arrayBase),
loopBound);
Modified: trunk/Source/_javascript_Core/b3/B3ReduceStrength.cpp (259785 => 259786)
--- trunk/Source/_javascript_Core/b3/B3ReduceStrength.cpp 2020-04-09 07:57:16 UTC (rev 259785)
+++ trunk/Source/_javascript_Core/b3/B3ReduceStrength.cpp 2020-04-09 09:27:40 UTC (rev 259786)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2015-2019 Apple Inc. All rights reserved.
+ * Copyright (C) 2015-2020 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -1818,7 +1818,8 @@
case CCall: {
// Turn this: Call(fmod, constant1, constant2)
// Into this: fcall-constant(constant1, constant2)
- auto* fmodDouble = tagCFunctionPtr<double (*)(double, double)>(fmod, B3CCallPtrTag);
+ double(*fmodDouble)(double, double) = fmod;
+ fmodDouble = tagCFunction<B3CCallPtrTag>(fmodDouble);
if (m_value->type() == Double
&& m_value->numChildren() == 3
&& m_value->child(0)->isIntPtr(reinterpret_cast<intptr_t>(fmodDouble))
Modified: trunk/Source/_javascript_Core/b3/testb3_5.cpp (259785 => 259786)
--- trunk/Source/_javascript_Core/b3/testb3_5.cpp 2020-04-09 07:57:16 UTC (rev 259785)
+++ trunk/Source/_javascript_Core/b3/testb3_5.cpp 2020-04-09 09:27:40 UTC (rev 259786)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2015-2019 Apple Inc. All rights reserved.
+ * Copyright (C) 2015-2020 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -1916,7 +1916,7 @@
proc, Return, Origin(),
root->appendNew<CCallValue>(
proc, Int32, Origin(),
- root->appendNew<ConstPtrValue>(proc, Origin(), tagCFunctionPtr<void*>(simpleFunction, B3CCallPtrTag)),
+ root->appendNew<ConstPtrValue>(proc, Origin(), tagCFunction<B3CCallPtrTag>(simpleFunction)),
root->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR0),
root->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR1)));
@@ -1943,7 +1943,7 @@
proc, Return, Origin(),
rare->appendNew<CCallValue>(
proc, Int32, Origin(),
- rare->appendNew<ConstPtrValue>(proc, Origin(), tagCFunctionPtr<void*>(simpleFunction, B3CCallPtrTag)),
+ rare->appendNew<ConstPtrValue>(proc, Origin(), tagCFunction<B3CCallPtrTag>(simpleFunction)),
rare->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR1),
rare->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR2)));
@@ -1972,7 +1972,7 @@
proc, Add, Origin(),
rare->appendNew<CCallValue>(
proc, Int32, Origin(),
- rare->appendNew<ConstPtrValue>(proc, Origin(), tagCFunctionPtr<void*>(simpleFunction, B3CCallPtrTag)),
+ rare->appendNew<ConstPtrValue>(proc, Origin(), tagCFunction<B3CCallPtrTag>(simpleFunction)),
rare->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR1),
rare->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR2)),
rare->appendNew<Value>(
@@ -1990,7 +1990,7 @@
proc, Return, Origin(),
root->appendNew<CCallValue>(
proc, Int32, Origin(), Effects::none(),
- root->appendNew<ConstPtrValue>(proc, Origin(), tagCFunctionPtr<void*>(simpleFunction, B3CCallPtrTag)),
+ root->appendNew<ConstPtrValue>(proc, Origin(), tagCFunction<B3CCallPtrTag>(simpleFunction)),
root->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR0),
root->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR1)));
@@ -2013,7 +2013,7 @@
CCallValue* call = root->appendNew<CCallValue>(
proc, Int32, Origin(),
- root->appendNew<ConstPtrValue>(proc, Origin(), tagCFunctionPtr<void*>(functionWithHellaArguments, B3CCallPtrTag)));
+ root->appendNew<ConstPtrValue>(proc, Origin(), tagCFunction<B3CCallPtrTag>(functionWithHellaArguments)));
call->appendArgs(args);
root->appendNewControlValue(proc, Return, Origin(), call);
@@ -2039,7 +2039,7 @@
CCallValue* call = root->appendNew<CCallValue>(
proc, Int64, Origin(),
- root->appendNew<ConstPtrValue>(proc, Origin(), tagCFunctionPtr<void*>(functionWithHellaArguments2, B3CCallPtrTag)));
+ root->appendNew<ConstPtrValue>(proc, Origin(), tagCFunction<B3CCallPtrTag>(functionWithHellaArguments2)));
call->appendArgs(args);
root->appendNewControlValue(proc, Return, Origin(), call);
@@ -2061,7 +2061,7 @@
CCallValue* call = root->appendNew<CCallValue>(
proc, Int32, Origin(),
- root->appendNew<ConstPtrValue>(proc, Origin(), tagCFunctionPtr<void*>(functionWithHellaArguments3, B3CCallPtrTag)));
+ root->appendNew<ConstPtrValue>(proc, Origin(), tagCFunction<B3CCallPtrTag>(functionWithHellaArguments3)));
call->appendArgs(args);
root->appendNewControlValue(proc, Return, Origin(), call);
@@ -2112,7 +2112,7 @@
proc, Return, Origin(),
root->appendNew<CCallValue>(
proc, Double, Origin(),
- root->appendNew<ConstPtrValue>(proc, Origin(), tagCFunctionPtr<void*>(simpleFunctionDouble, B3CCallPtrTag)),
+ root->appendNew<ConstPtrValue>(proc, Origin(), tagCFunction<B3CCallPtrTag>(simpleFunctionDouble)),
root->appendNew<ArgumentRegValue>(proc, Origin(), FPRInfo::argumentFPR0),
root->appendNew<ArgumentRegValue>(proc, Origin(), FPRInfo::argumentFPR1)));
@@ -2138,7 +2138,7 @@
proc, Return, Origin(),
root->appendNew<CCallValue>(
proc, Float, Origin(),
- root->appendNew<ConstPtrValue>(proc, Origin(), tagCFunctionPtr<void*>(simpleFunctionFloat, B3CCallPtrTag)),
+ root->appendNew<ConstPtrValue>(proc, Origin(), tagCFunction<B3CCallPtrTag>(simpleFunctionFloat)),
floatValue1,
floatValue2));
@@ -2161,7 +2161,7 @@
CCallValue* call = root->appendNew<CCallValue>(
proc, Double, Origin(),
- root->appendNew<ConstPtrValue>(proc, Origin(), tagCFunctionPtr<void*>(functionWithHellaDoubleArguments, B3CCallPtrTag)));
+ root->appendNew<ConstPtrValue>(proc, Origin(), tagCFunction<B3CCallPtrTag>(functionWithHellaDoubleArguments)));
call->appendArgs(args);
root->appendNewControlValue(proc, Return, Origin(), call);
@@ -2185,7 +2185,7 @@
CCallValue* call = root->appendNew<CCallValue>(
proc, Float, Origin(),
- root->appendNew<ConstPtrValue>(proc, Origin(), tagCFunctionPtr<void*>(functionWithHellaFloatArguments, B3CCallPtrTag)));
+ root->appendNew<ConstPtrValue>(proc, Origin(), tagCFunction<B3CCallPtrTag>(functionWithHellaFloatArguments)));
call->appendArgs(args);
root->appendNewControlValue(proc, Return, Origin(), call);
@@ -2208,7 +2208,7 @@
proc, Return, Origin(),
root->appendNew<CCallValue>(
proc, Int32, Origin(),
- root->appendNew<ConstPtrValue>(proc, Origin(), tagCFunctionPtr<void*>(simpleFunction, B3CCallPtrTag)),
+ root->appendNew<ConstPtrValue>(proc, Origin(), tagCFunction<B3CCallPtrTag>(simpleFunction)),
root->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR0),
root->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR1)));
Modified: trunk/Source/_javascript_Core/b3/testb3_6.cpp (259785 => 259786)
--- trunk/Source/_javascript_Core/b3/testb3_6.cpp 2020-04-09 07:57:16 UTC (rev 259785)
+++ trunk/Source/_javascript_Core/b3/testb3_6.cpp 2020-04-09 09:27:40 UTC (rev 259786)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2015-2019 Apple Inc. All rights reserved.
+ * Copyright (C) 2015-2020 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -1768,7 +1768,7 @@
print->appendNew<CCallValue>(
proc, Void, Origin(),
print->appendNew<ConstPtrValue>(
- proc, Origin(), tagCFunctionPtr<void*>(interpreterPrint, B3CCallPtrTag)),
+ proc, Origin(), tagCFunction<B3CCallPtrTag>(interpreterPrint)),
context,
print->appendNew<MemoryValue>(proc, Load, pointerType(), Origin(), dataPointerValue));
print->appendNew<VariableValue>(
Modified: trunk/Source/_javascript_Core/b3/testb3_7.cpp (259785 => 259786)
--- trunk/Source/_javascript_Core/b3/testb3_7.cpp 2020-04-09 07:57:16 UTC (rev 259785)
+++ trunk/Source/_javascript_Core/b3/testb3_7.cpp 2020-04-09 09:27:40 UTC (rev 259786)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2015-2019 Apple Inc. All rights reserved.
+ * Copyright (C) 2015-2020 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -571,7 +571,7 @@
[&] (BasicBlock* loop, Value*) -> Value* {
return loop->appendNew<CCallValue>(
proc, Int32, Origin(), Effects::none(),
- loop->appendNew<ConstPtrValue>(proc, Origin(), tagCFunctionPtr<void*>(oneFunction, B3CCallPtrTag)),
+ loop->appendNew<ConstPtrValue>(proc, Origin(), tagCFunction<B3CCallPtrTag>(oneFunction)),
loop->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR0));
});
@@ -592,11 +592,11 @@
effects.exitsSideways = true;
loop->appendNew<CCallValue>(
proc, Void, Origin(), effects,
- loop->appendNew<ConstPtrValue>(proc, Origin(), tagCFunctionPtr<void*>(noOpFunction, B3CCallPtrTag)));
+ loop->appendNew<ConstPtrValue>(proc, Origin(), tagCFunction<B3CCallPtrTag>(noOpFunction)));
return loop->appendNew<CCallValue>(
proc, Int32, Origin(), Effects::none(),
- loop->appendNew<ConstPtrValue>(proc, Origin(), tagCFunctionPtr<void*>(oneFunction, B3CCallPtrTag)),
+ loop->appendNew<ConstPtrValue>(proc, Origin(), tagCFunction<B3CCallPtrTag>(oneFunction)),
loop->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR0));
});
@@ -617,11 +617,11 @@
effects.writesPinned = true;
loop->appendNew<CCallValue>(
proc, Void, Origin(), effects,
- loop->appendNew<ConstPtrValue>(proc, Origin(), tagCFunctionPtr<void*>(noOpFunction, B3CCallPtrTag)));
+ loop->appendNew<ConstPtrValue>(proc, Origin(), tagCFunction<B3CCallPtrTag>(noOpFunction)));
return loop->appendNew<CCallValue>(
proc, Int32, Origin(), Effects::none(),
- loop->appendNew<ConstPtrValue>(proc, Origin(), tagCFunctionPtr<void*>(oneFunction, B3CCallPtrTag)),
+ loop->appendNew<ConstPtrValue>(proc, Origin(), tagCFunction<B3CCallPtrTag>(oneFunction)),
loop->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR0));
});
@@ -642,11 +642,11 @@
effects.writes = HeapRange(63479);
loop->appendNew<CCallValue>(
proc, Void, Origin(), effects,
- loop->appendNew<ConstPtrValue>(proc, Origin(), tagCFunctionPtr<void*>(noOpFunction, B3CCallPtrTag)));
+ loop->appendNew<ConstPtrValue>(proc, Origin(), tagCFunction<B3CCallPtrTag>(noOpFunction)));
return loop->appendNew<CCallValue>(
proc, Int32, Origin(), Effects::none(),
- loop->appendNew<ConstPtrValue>(proc, Origin(), tagCFunctionPtr<void*>(oneFunction, B3CCallPtrTag)),
+ loop->appendNew<ConstPtrValue>(proc, Origin(), tagCFunction<B3CCallPtrTag>(oneFunction)),
loop->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR0));
});
@@ -665,7 +665,7 @@
effects.readsLocalState = true;
return loop->appendNew<CCallValue>(
proc, Int32, Origin(), effects,
- loop->appendNew<ConstPtrValue>(proc, Origin(), tagCFunctionPtr<void*>(oneFunction, B3CCallPtrTag)),
+ loop->appendNew<ConstPtrValue>(proc, Origin(), tagCFunction<B3CCallPtrTag>(oneFunction)),
loop->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR0));
});
@@ -686,7 +686,7 @@
effects.readsPinned = true;
return loop->appendNew<CCallValue>(
proc, Int32, Origin(), effects,
- loop->appendNew<ConstPtrValue>(proc, Origin(), tagCFunctionPtr<void*>(oneFunction, B3CCallPtrTag)),
+ loop->appendNew<ConstPtrValue>(proc, Origin(), tagCFunction<B3CCallPtrTag>(oneFunction)),
loop->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR0));
});
@@ -707,7 +707,7 @@
effects.reads = HeapRange::top();
return loop->appendNew<CCallValue>(
proc, Int32, Origin(), effects,
- loop->appendNew<ConstPtrValue>(proc, Origin(), tagCFunctionPtr<void*>(oneFunction, B3CCallPtrTag)),
+ loop->appendNew<ConstPtrValue>(proc, Origin(), tagCFunction<B3CCallPtrTag>(oneFunction)),
loop->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR0));
});
@@ -727,7 +727,7 @@
[&] (BasicBlock* loop, Value*) -> Value* {
return loop->appendNew<CCallValue>(
proc, Int32, Origin(), Effects::none(),
- loop->appendNew<ConstPtrValue>(proc, Origin(), tagCFunctionPtr<void*>(oneFunction, B3CCallPtrTag)),
+ loop->appendNew<ConstPtrValue>(proc, Origin(), tagCFunction<B3CCallPtrTag>(oneFunction)),
loop->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR0));
});
@@ -744,7 +744,7 @@
[&] (BasicBlock* loop, Value* index) -> Value* {
return loop->appendNew<CCallValue>(
proc, Int32, Origin(), Effects::none(),
- loop->appendNew<ConstPtrValue>(proc, Origin(), tagCFunctionPtr<void*>(oneFunction, B3CCallPtrTag)),
+ loop->appendNew<ConstPtrValue>(proc, Origin(), tagCFunction<B3CCallPtrTag>(oneFunction)),
loop->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR0),
index);
});
@@ -765,7 +765,7 @@
[&] (BasicBlock* loop, Value* index) -> Value* {
return loop->appendNew<CCallValue>(
proc, Int32, Origin(), Effects::none(),
- loop->appendNew<ConstPtrValue>(proc, Origin(), tagCFunctionPtr<void*>(oneFunction, B3CCallPtrTag)),
+ loop->appendNew<ConstPtrValue>(proc, Origin(), tagCFunction<B3CCallPtrTag>(oneFunction)),
loop->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR0),
index);
});
@@ -785,7 +785,7 @@
effects.exitsSideways = true;
return loop->appendNew<CCallValue>(
proc, Int32, Origin(), effects,
- loop->appendNew<ConstPtrValue>(proc, Origin(), tagCFunctionPtr<void*>(oneFunction, B3CCallPtrTag)),
+ loop->appendNew<ConstPtrValue>(proc, Origin(), tagCFunction<B3CCallPtrTag>(oneFunction)),
loop->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR0));
});
@@ -804,7 +804,7 @@
effects.writesLocalState = true;
return loop->appendNew<CCallValue>(
proc, Int32, Origin(), effects,
- loop->appendNew<ConstPtrValue>(proc, Origin(), tagCFunctionPtr<void*>(oneFunction, B3CCallPtrTag)),
+ loop->appendNew<ConstPtrValue>(proc, Origin(), tagCFunction<B3CCallPtrTag>(oneFunction)),
loop->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR0));
});
@@ -823,7 +823,7 @@
effects.writes = HeapRange(666);
return loop->appendNew<CCallValue>(
proc, Int32, Origin(), effects,
- loop->appendNew<ConstPtrValue>(proc, Origin(), tagCFunctionPtr<void*>(oneFunction, B3CCallPtrTag)),
+ loop->appendNew<ConstPtrValue>(proc, Origin(), tagCFunction<B3CCallPtrTag>(oneFunction)),
loop->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR0));
});
@@ -842,7 +842,7 @@
effects.fence = true;
return loop->appendNew<CCallValue>(
proc, Int32, Origin(), effects,
- loop->appendNew<ConstPtrValue>(proc, Origin(), tagCFunctionPtr<void*>(oneFunction, B3CCallPtrTag)),
+ loop->appendNew<ConstPtrValue>(proc, Origin(), tagCFunction<B3CCallPtrTag>(oneFunction)),
loop->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR0));
});
@@ -861,7 +861,7 @@
effects.writesPinned = true;
return loop->appendNew<CCallValue>(
proc, Int32, Origin(), effects,
- loop->appendNew<ConstPtrValue>(proc, Origin(), tagCFunctionPtr<void*>(oneFunction, B3CCallPtrTag)),
+ loop->appendNew<ConstPtrValue>(proc, Origin(), tagCFunction<B3CCallPtrTag>(oneFunction)),
loop->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR0));
});
@@ -882,7 +882,7 @@
effects.controlDependent = true;
return loop->appendNew<CCallValue>(
proc, Int32, Origin(), effects,
- loop->appendNew<ConstPtrValue>(proc, Origin(), tagCFunctionPtr<void*>(oneFunction, B3CCallPtrTag)),
+ loop->appendNew<ConstPtrValue>(proc, Origin(), tagCFunction<B3CCallPtrTag>(oneFunction)),
loop->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR0));
});
@@ -904,7 +904,7 @@
effects.controlDependent = true;
return loop->appendNew<CCallValue>(
proc, Int32, Origin(), effects,
- loop->appendNew<ConstPtrValue>(proc, Origin(), tagCFunctionPtr<void*>(oneFunction, B3CCallPtrTag)),
+ loop->appendNew<ConstPtrValue>(proc, Origin(), tagCFunction<B3CCallPtrTag>(oneFunction)),
loop->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR0));
});
@@ -923,13 +923,13 @@
effects.exitsSideways = true;
loop->appendNew<CCallValue>(
proc, Void, Origin(), effects,
- loop->appendNew<ConstPtrValue>(proc, Origin(), tagCFunctionPtr<void*>(noOpFunction, B3CCallPtrTag)));
+ loop->appendNew<ConstPtrValue>(proc, Origin(), tagCFunction<B3CCallPtrTag>(noOpFunction)));
effects = Effects::none();
effects.controlDependent = true;
return loop->appendNew<CCallValue>(
proc, Int32, Origin(), effects,
- loop->appendNew<ConstPtrValue>(proc, Origin(), tagCFunctionPtr<void*>(oneFunction, B3CCallPtrTag)),
+ loop->appendNew<ConstPtrValue>(proc, Origin(), tagCFunction<B3CCallPtrTag>(oneFunction)),
loop->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR0));
});
@@ -948,13 +948,13 @@
effects.writesPinned = true;
loop->appendNew<CCallValue>(
proc, Void, Origin(), effects,
- loop->appendNew<ConstPtrValue>(proc, Origin(), tagCFunctionPtr<void*>(noOpFunction, B3CCallPtrTag)));
+ loop->appendNew<ConstPtrValue>(proc, Origin(), tagCFunction<B3CCallPtrTag>(noOpFunction)));
effects = Effects::none();
effects.readsPinned = true;
return loop->appendNew<CCallValue>(
proc, Int32, Origin(), effects,
- loop->appendNew<ConstPtrValue>(proc, Origin(), tagCFunctionPtr<void*>(oneFunction, B3CCallPtrTag)),
+ loop->appendNew<ConstPtrValue>(proc, Origin(), tagCFunction<B3CCallPtrTag>(oneFunction)),
loop->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR0));
});
@@ -975,13 +975,13 @@
effects.writes = HeapRange(6436);
loop->appendNew<CCallValue>(
proc, Void, Origin(), effects,
- loop->appendNew<ConstPtrValue>(proc, Origin(), tagCFunctionPtr<void*>(noOpFunction, B3CCallPtrTag)));
+ loop->appendNew<ConstPtrValue>(proc, Origin(), tagCFunction<B3CCallPtrTag>(noOpFunction)));
effects = Effects::none();
effects.reads = HeapRange(4886);
return loop->appendNew<CCallValue>(
proc, Int32, Origin(), effects,
- loop->appendNew<ConstPtrValue>(proc, Origin(), tagCFunctionPtr<void*>(oneFunction, B3CCallPtrTag)),
+ loop->appendNew<ConstPtrValue>(proc, Origin(), tagCFunction<B3CCallPtrTag>(oneFunction)),
loop->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR0));
});
@@ -1000,13 +1000,13 @@
effects.writes = HeapRange(6436, 74458);
loop->appendNew<CCallValue>(
proc, Void, Origin(), effects,
- loop->appendNew<ConstPtrValue>(proc, Origin(), tagCFunctionPtr<void*>(noOpFunction, B3CCallPtrTag)));
+ loop->appendNew<ConstPtrValue>(proc, Origin(), tagCFunction<B3CCallPtrTag>(noOpFunction)));
effects = Effects::none();
effects.reads = HeapRange(48864, 78239);
return loop->appendNew<CCallValue>(
proc, Int32, Origin(), effects,
- loop->appendNew<ConstPtrValue>(proc, Origin(), tagCFunctionPtr<void*>(oneFunction, B3CCallPtrTag)),
+ loop->appendNew<ConstPtrValue>(proc, Origin(), tagCFunction<B3CCallPtrTag>(oneFunction)),
loop->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR0));
});
@@ -1023,7 +1023,7 @@
[&] (BasicBlock* loop, Value*) -> Value* {
return loop->appendNew<CCallValue>(
proc, Int32, Origin(),
- loop->appendNew<ConstPtrValue>(proc, Origin(), tagCFunctionPtr<void*>(oneFunction, B3CCallPtrTag)),
+ loop->appendNew<ConstPtrValue>(proc, Origin(), tagCFunction<B3CCallPtrTag>(oneFunction)),
loop->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR0));
});
@@ -1410,7 +1410,7 @@
unlikely->appendNew<CCallValue>(
proc, Void, Origin(),
- unlikely->appendNew<ConstPtrValue>(proc, Origin(), tagCFunctionPtr<void*>(functionNineArgs, B3CCallPtrTag)),
+ unlikely->appendNew<ConstPtrValue>(proc, Origin(), tagCFunction<B3CCallPtrTag>(functionNineArgs)),
constNumber, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8);
PatchpointValue* voidPatch = unlikely->appendNew<PatchpointValue>(proc, Void, Origin());
Modified: trunk/Source/_javascript_Core/dfg/DFGOSRExit.cpp (259785 => 259786)
--- trunk/Source/_javascript_Core/dfg/DFGOSRExit.cpp 2020-04-09 07:57:16 UTC (rev 259785)
+++ trunk/Source/_javascript_Core/dfg/DFGOSRExit.cpp 2020-04-09 09:27:40 UTC (rev 259786)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011-2019 Apple Inc. All rights reserved.
+ * Copyright (C) 2011-2020 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -126,10 +126,10 @@
jit.prepareCallOperation(vm);
switch (recovery.technique()) {
case DirectArgumentsThatWereNotCreated:
- jit.move(AssemblyHelpers::TrustedImmPtr(tagCFunctionPtr<OperationPtrTag>(operationCreateDirectArgumentsDuringExit)), GPRInfo::nonArgGPR0);
+ jit.move(AssemblyHelpers::TrustedImmPtr(tagCFunction<OperationPtrTag>(operationCreateDirectArgumentsDuringExit)), GPRInfo::nonArgGPR0);
break;
case ClonedArgumentsThatWereNotCreated:
- jit.move(AssemblyHelpers::TrustedImmPtr(tagCFunctionPtr<OperationPtrTag>(operationCreateClonedArgumentsDuringExit)), GPRInfo::nonArgGPR0);
+ jit.move(AssemblyHelpers::TrustedImmPtr(tagCFunction<OperationPtrTag>(operationCreateClonedArgumentsDuringExit)), GPRInfo::nonArgGPR0);
break;
default:
RELEASE_ASSERT_NOT_REACHED();
Modified: trunk/Source/_javascript_Core/dfg/DFGOSRExitCompilerCommon.cpp (259785 => 259786)
--- trunk/Source/_javascript_Core/dfg/DFGOSRExitCompilerCommon.cpp 2020-04-09 07:57:16 UTC (rev 259785)
+++ trunk/Source/_javascript_Core/dfg/DFGOSRExitCompilerCommon.cpp 2020-04-09 09:27:40 UTC (rev 259786)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2013-2019 Apple Inc. All rights reserved.
+ * Copyright (C) 2013-2020 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -108,7 +108,7 @@
jit.setupArguments<decltype(operationTriggerReoptimizationNow)>(GPRInfo::regT0, GPRInfo::regT3, AssemblyHelpers::TrustedImmPtr(&exit));
jit.prepareCallOperation(vm);
- jit.move(AssemblyHelpers::TrustedImmPtr(tagCFunctionPtr<OperationPtrTag>(operationTriggerReoptimizationNow)), GPRInfo::nonArgGPR0);
+ jit.move(AssemblyHelpers::TrustedImmPtr(tagCFunction<OperationPtrTag>(operationTriggerReoptimizationNow)), GPRInfo::nonArgGPR0);
jit.call(GPRInfo::nonArgGPR0, OperationPtrTag);
AssemblyHelpers::Jump doneAdjusting = jit.jump();
@@ -354,7 +354,7 @@
jit.setupArguments<decltype(operationOSRWriteBarrier)>(&vm, owner);
jit.prepareCallOperation(vm);
- jit.move(MacroAssembler::TrustedImmPtr(tagCFunctionPtr<OperationPtrTag>(operationOSRWriteBarrier)), scratch);
+ jit.move(MacroAssembler::TrustedImmPtr(tagCFunction<OperationPtrTag>(operationOSRWriteBarrier)), scratch);
jit.call(scratch, OperationPtrTag);
ownerIsRememberedOrInEden.link(&jit);
Modified: trunk/Source/_javascript_Core/ftl/FTLLowerDFGToB3.cpp (259785 => 259786)
--- trunk/Source/_javascript_Core/ftl/FTLLowerDFGToB3.cpp 2020-04-09 07:57:16 UTC (rev 259785)
+++ trunk/Source/_javascript_Core/ftl/FTLLowerDFGToB3.cpp 2020-04-09 09:27:40 UTC (rev 259786)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2013-2019 Apple Inc. All rights reserved.
+ * Copyright (C) 2013-2020 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -9380,8 +9380,8 @@
jit.move(rep.gpr(), result);
};
- auto callWithExceptionCheck = [&] (void* callee) {
- jit.move(CCallHelpers::TrustedImmPtr(tagCFunctionPtr<OperationPtrTag>(callee)), GPRInfo::nonPreservedNonArgumentGPR0);
+ auto callWithExceptionCheck = [&] (void(*callee)(JSGlobalObject*)) {
+ jit.move(CCallHelpers::TrustedImmPtr(tagCFunction<OperationPtrTag>(callee)), GPRInfo::nonPreservedNonArgumentGPR0);
jit.call(GPRInfo::nonPreservedNonArgumentGPR0, OperationPtrTag);
exceptions->append(jit.emitExceptionCheck(*vm, AssemblyHelpers::NormalExceptionCheck, AssemblyHelpers::FarJumpWidth));
};
@@ -9478,7 +9478,7 @@
slowCase.link(&jit);
jit.setupArguments<decltype(operationThrowStackOverflowForVarargs)>(jit.codeBlock()->globalObjectFor(node->origin.semantic));
jit.prepareCallOperation(jit.vm());
- callWithExceptionCheck(bitwise_cast<void*>(operationThrowStackOverflowForVarargs));
+ callWithExceptionCheck(operationThrowStackOverflowForVarargs);
jit.abortWithReason(DFGVarargsThrowingPathDidNotThrow);
dontThrow.link(&jit);
@@ -9720,8 +9720,8 @@
GPRReg scratchGPR3 = forwarding ? allocator.allocateScratchGPR() : InvalidGPRReg;
RELEASE_ASSERT(!allocator.numberOfReusedRegisters());
- auto callWithExceptionCheck = [&] (void* callee) {
- jit.move(CCallHelpers::TrustedImmPtr(tagCFunctionPtr<OperationPtrTag>(callee)), GPRInfo::nonPreservedNonArgumentGPR0);
+ auto callWithExceptionCheck = [&] (void(*callee)()) {
+ jit.move(CCallHelpers::TrustedImmPtr(tagCFunction<OperationPtrTag>(callee)), GPRInfo::nonPreservedNonArgumentGPR0);
jit.call(GPRInfo::nonPreservedNonArgumentGPR0, OperationPtrTag);
exceptions->append(jit.emitExceptionCheck(*vm, AssemblyHelpers::NormalExceptionCheck, AssemblyHelpers::FarJumpWidth));
};
@@ -9745,7 +9745,7 @@
slowCase.link(&jit);
jit.setupArguments<decltype(operationThrowStackOverflowForVarargs)>(jit.codeBlock()->globalObjectFor(node->origin.semantic));
jit.prepareCallOperation(jit.vm());
- callWithExceptionCheck(bitwise_cast<void*>(operationThrowStackOverflowForVarargs));
+ callWithExceptionCheck(bitwise_cast<void(*)()>(operationThrowStackOverflowForVarargs));
jit.abortWithReason(DFGVarargsThrowingPathDidNotThrow);
done.link(&jit);
@@ -9753,7 +9753,7 @@
jit.move(CCallHelpers::TrustedImm32(originalStackHeight / sizeof(EncodedJSValue)), scratchGPR1);
jit.setupArguments<decltype(operationSizeFrameForVarargs)>(jit.codeBlock()->globalObjectFor(node->origin.semantic), argumentsGPR, scratchGPR1, CCallHelpers::TrustedImm32(data->firstVarArgOffset));
jit.prepareCallOperation(jit.vm());
- callWithExceptionCheck(bitwise_cast<void*>(operationSizeFrameForVarargs));
+ callWithExceptionCheck(bitwise_cast<void(*)()>(operationSizeFrameForVarargs));
jit.move(GPRInfo::returnValueGPR, scratchGPR1);
jit.move(CCallHelpers::TrustedImm32(originalStackHeight / sizeof(EncodedJSValue)), scratchGPR2);
@@ -9762,7 +9762,7 @@
jit.addPtr(CCallHelpers::TrustedImm32(-minimumJSCallAreaSize), scratchGPR2, CCallHelpers::stackPointerRegister);
jit.setupArguments<decltype(operationSetupVarargsFrame)>(jit.codeBlock()->globalObjectFor(node->origin.semantic), scratchGPR2, argumentsGPR, CCallHelpers::TrustedImm32(data->firstVarArgOffset), scratchGPR1);
jit.prepareCallOperation(jit.vm());
- callWithExceptionCheck(bitwise_cast<void*>(operationSetupVarargsFrame));
+ callWithExceptionCheck(bitwise_cast<void(*)()>(operationSetupVarargsFrame));
jit.addPtr(CCallHelpers::TrustedImm32(sizeof(CallerFrameAndPC)), GPRInfo::returnValueGPR, CCallHelpers::stackPointerRegister);
@@ -9915,7 +9915,7 @@
jit.move(CCallHelpers::TrustedImm32(node->ecmaMode().value()), GPRInfo::regT2);
jit.setupArguments<decltype(operationCallEval)>(globalObject, GPRInfo::regT1, GPRInfo::regT2);
jit.prepareCallOperation(vm);
- jit.move(CCallHelpers::TrustedImmPtr(tagCFunctionPtr<OperationPtrTag>(operationCallEval)), GPRInfo::nonPreservedNonArgumentGPR0);
+ jit.move(CCallHelpers::TrustedImmPtr(tagCFunction<OperationPtrTag>(operationCallEval)), GPRInfo::nonPreservedNonArgumentGPR0);
jit.call(GPRInfo::nonPreservedNonArgumentGPR0, OperationPtrTag);
exceptions->append(jit.emitExceptionCheck(state->vm(), AssemblyHelpers::NormalExceptionCheck, AssemblyHelpers::FarJumpWidth));
Modified: trunk/Source/_javascript_Core/ftl/FTLOSRExitCompiler.cpp (259785 => 259786)
--- trunk/Source/_javascript_Core/ftl/FTLOSRExitCompiler.cpp 2020-04-09 07:57:16 UTC (rev 259785)
+++ trunk/Source/_javascript_Core/ftl/FTLOSRExitCompiler.cpp 2020-04-09 09:27:40 UTC (rev 259786)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2013-2019 Apple Inc. All rights reserved.
+ * Copyright (C) 2013-2020 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -337,7 +337,7 @@
CCallHelpers::TrustedImmPtr(materialization),
CCallHelpers::TrustedImmPtr(materializationArguments));
jit.prepareCallOperation(vm);
- jit.move(CCallHelpers::TrustedImmPtr(tagCFunctionPtr<OperationPtrTag>(operationMaterializeObjectInOSR)), GPRInfo::nonArgGPR0);
+ jit.move(CCallHelpers::TrustedImmPtr(tagCFunction<OperationPtrTag>(operationMaterializeObjectInOSR)), GPRInfo::nonArgGPR0);
jit.call(GPRInfo::nonArgGPR0, OperationPtrTag);
jit.storePtr(GPRInfo::returnValueGPR, materializationToPointer.get(materialization));
@@ -367,7 +367,7 @@
CCallHelpers::TrustedImmPtr(materializationToPointer.get(materialization)),
CCallHelpers::TrustedImmPtr(materializationArguments));
jit.prepareCallOperation(vm);
- jit.move(CCallHelpers::TrustedImmPtr(tagCFunctionPtr<OperationPtrTag>(operationPopulateObjectInOSR)), GPRInfo::nonArgGPR0);
+ jit.move(CCallHelpers::TrustedImmPtr(tagCFunction<OperationPtrTag>(operationPopulateObjectInOSR)), GPRInfo::nonArgGPR0);
jit.call(GPRInfo::nonArgGPR0, OperationPtrTag);
}
Modified: trunk/Source/_javascript_Core/jit/AssemblyHelpers.cpp (259785 => 259786)
--- trunk/Source/_javascript_Core/jit/AssemblyHelpers.cpp 2020-04-09 07:57:16 UTC (rev 259785)
+++ trunk/Source/_javascript_Core/jit/AssemblyHelpers.cpp 2020-04-09 09:27:40 UTC (rev 259786)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011-2019 Apple Inc. All rights reserved.
+ * Copyright (C) 2011-2020 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -251,7 +251,7 @@
// Set up one argument.
move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR0);
- move(TrustedImmPtr(tagCFunctionPtr<OperationPtrTag>(operationExceptionFuzz)), GPRInfo::nonPreservedNonReturnGPR);
+ move(TrustedImmPtr(tagCFunction<OperationPtrTag>(operationExceptionFuzz)), GPRInfo::nonPreservedNonReturnGPR);
prepareCallOperation(vm);
call(GPRInfo::nonPreservedNonReturnGPR, OperationPtrTag);
Modified: trunk/Source/_javascript_Core/jit/CCallHelpers.cpp (259785 => 259786)
--- trunk/Source/_javascript_Core/jit/CCallHelpers.cpp 2020-04-09 07:57:16 UTC (rev 259785)
+++ trunk/Source/_javascript_Core/jit/CCallHelpers.cpp 2020-04-09 09:27:40 UTC (rev 259786)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2016-2018 Apple Inc. All rights reserved.
+ * Copyright (C) 2016-2020 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -62,7 +62,7 @@
Jump ok = branchPtr(Below, shadowPacket, TrustedImmPtr(shadowChicken->logEnd()));
setupArguments<decltype(operationProcessShadowChickenLog)>(TrustedImmPtr(&vm));
prepareCallOperation(vm);
- move(TrustedImmPtr(tagCFunctionPtr<OperationPtrTag>(operationProcessShadowChickenLog)), scratch1NonArgGPR);
+ move(TrustedImmPtr(tagCFunction<OperationPtrTag>(operationProcessShadowChickenLog)), scratch1NonArgGPR);
call(scratch1NonArgGPR, OperationPtrTag);
move(TrustedImmPtr(shadowChicken->addressOfLogCursor()), scratch1NonArgGPR);
loadPtr(Address(scratch1NonArgGPR), shadowPacket);
Modified: trunk/Source/_javascript_Core/jit/JITOperations.cpp (259785 => 259786)
--- trunk/Source/_javascript_Core/jit/JITOperations.cpp 2020-04-09 07:57:16 UTC (rev 259785)
+++ trunk/Source/_javascript_Core/jit/JITOperations.cpp 2020-04-09 09:27:40 UTC (rev 259786)
@@ -1064,7 +1064,7 @@
}
return encodeResult(
- tagCFunctionPtr<void*, JSEntryPtrTag>(getHostCallReturnValue),
+ tagCFunction<void*, JSEntryPtrTag>(getHostCallReturnValue),
reinterpret_cast<void*>(callLinkInfo->callMode() == CallMode::Tail ? ReuseTheFrame : KeepTheFrame));
}
@@ -1092,7 +1092,7 @@
reinterpret_cast<void*>(KeepTheFrame));
}
- return encodeResult(tagCFunctionPtr<void*, JSEntryPtrTag>(getHostCallReturnValue), reinterpret_cast<void*>(KeepTheFrame));
+ return encodeResult(tagCFunction<void*, JSEntryPtrTag>(getHostCallReturnValue), reinterpret_cast<void*>(KeepTheFrame));
}
ASSERT(constructType == ConstructType::None);
Modified: trunk/Source/_javascript_Core/jit/ThunkGenerators.cpp (259785 => 259786)
--- trunk/Source/_javascript_Core/jit/ThunkGenerators.cpp 2020-04-09 07:57:16 UTC (rev 259785)
+++ trunk/Source/_javascript_Core/jit/ThunkGenerators.cpp 2020-04-09 09:27:40 UTC (rev 259786)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2010-2019 Apple Inc. All rights reserved.
+ * Copyright (C) 2010-2020 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -73,7 +73,7 @@
jit.setupArguments<decltype(operationLookupExceptionHandler)>(CCallHelpers::TrustedImmPtr(&vm));
jit.prepareCallOperation(vm);
- jit.move(CCallHelpers::TrustedImmPtr(tagCFunctionPtr<OperationPtrTag>(operationLookupExceptionHandler)), GPRInfo::nonArgGPR0);
+ jit.move(CCallHelpers::TrustedImmPtr(tagCFunction<OperationPtrTag>(operationLookupExceptionHandler)), GPRInfo::nonArgGPR0);
emitPointerValidation(jit, GPRInfo::nonArgGPR0, OperationPtrTag);
jit.call(GPRInfo::nonArgGPR0, OperationPtrTag);
jit.jumpToExceptionHandler(vm);
@@ -100,7 +100,7 @@
jit.move(GPRInfo::argumentGPR0, GPRInfo::argumentGPR3);
jit.addPtr(CCallHelpers::TrustedImm32(32), CCallHelpers::stackPointerRegister, GPRInfo::argumentGPR0);
jit.move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR1);
- jit.move(CCallHelpers::TrustedImmPtr(tagCFunctionPtr<OperationPtrTag>(slowPathFunction)), GPRInfo::nonArgGPR0);
+ jit.move(CCallHelpers::TrustedImmPtr(tagCFunction<OperationPtrTag>(slowPathFunction)), GPRInfo::nonArgGPR0);
emitPointerValidation(jit, GPRInfo::nonArgGPR0, OperationPtrTag);
jit.call(GPRInfo::nonArgGPR0, OperationPtrTag);
jit.loadPtr(CCallHelpers::Address(GPRInfo::returnValueGPR, 8), GPRInfo::returnValueGPR2);
@@ -110,7 +110,7 @@
if (maxFrameExtentForSlowPathCall)
jit.addPtr(CCallHelpers::TrustedImm32(-maxFrameExtentForSlowPathCall), CCallHelpers::stackPointerRegister);
jit.setupArguments<decltype(slowPathFunction)>(GPRInfo::regT3, GPRInfo::regT2);
- jit.move(CCallHelpers::TrustedImmPtr(tagCFunctionPtr<OperationPtrTag>(slowPathFunction)), GPRInfo::nonArgGPR0);
+ jit.move(CCallHelpers::TrustedImmPtr(tagCFunction<OperationPtrTag>(slowPathFunction)), GPRInfo::nonArgGPR0);
emitPointerValidation(jit, GPRInfo::nonArgGPR0, OperationPtrTag);
jit.call(GPRInfo::nonArgGPR0, OperationPtrTag);
if (maxFrameExtentForSlowPathCall)
@@ -335,7 +335,7 @@
jit.subPtr(CCallHelpers::TrustedImm32(16), CCallHelpers::stackPointerRegister);
#endif
jit.move(CCallHelpers::TrustedImmPtr(&vm), JSInterfaceJIT::argumentGPR0);
- jit.move(JSInterfaceJIT::TrustedImmPtr(tagCFunctionPtr<OperationPtrTag>(operationVMHandleException)), JSInterfaceJIT::regT3);
+ jit.move(JSInterfaceJIT::TrustedImmPtr(tagCFunction<OperationPtrTag>(operationVMHandleException)), JSInterfaceJIT::regT3);
jit.call(JSInterfaceJIT::regT3, OperationPtrTag);
#if OS(WINDOWS)
jit.addPtr(JSInterfaceJIT::TrustedImm32(4 * sizeof(int64_t)), JSInterfaceJIT::stackPointerRegister);
@@ -1191,7 +1191,7 @@
jit.loadPtr(CCallHelpers::Address(GPRInfo::regT0, JSBoundFunction::offsetOfScopeChain()), GPRInfo::regT3);
jit.setupArguments<decltype(operationThrowStackOverflowErrorFromThunk)>(GPRInfo::regT3);
jit.prepareCallOperation(vm);
- jit.move(CCallHelpers::TrustedImmPtr(tagCFunctionPtr<OperationPtrTag>(operationThrowStackOverflowErrorFromThunk)), GPRInfo::nonArgGPR0);
+ jit.move(CCallHelpers::TrustedImmPtr(tagCFunction<OperationPtrTag>(operationThrowStackOverflowErrorFromThunk)), GPRInfo::nonArgGPR0);
emitPointerValidation(jit, GPRInfo::nonArgGPR0, OperationPtrTag);
jit.call(GPRInfo::nonArgGPR0, OperationPtrTag);
jit.jumpToExceptionHandler(vm);
Modified: trunk/Source/_javascript_Core/wasm/WasmB3IRGenerator.cpp (259785 => 259786)
--- trunk/Source/_javascript_Core/wasm/WasmB3IRGenerator.cpp 2020-04-09 07:57:16 UTC (rev 259785)
+++ trunk/Source/_javascript_Core/wasm/WasmB3IRGenerator.cpp 2020-04-09 09:27:40 UTC (rev 259786)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2016-2019 Apple Inc. All rights reserved.
+ * Copyright (C) 2016-2020 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -698,7 +698,7 @@
{
// FIXME: Emit this inline <https://bugs.webkit.org/show_bug.cgi?id=198506>.
result = m_currentBlock->appendNew<CCallValue>(m_proc, toB3Type(Anyref), origin(),
- m_currentBlock->appendNew<ConstPtrValue>(m_proc, origin(), tagCFunctionPtr<void*>(&operationGetWasmTableElement, B3CCallPtrTag)),
+ m_currentBlock->appendNew<ConstPtrValue>(m_proc, origin(), tagCFunction<B3CCallPtrTag>(operationGetWasmTableElement)),
instanceValue(), m_currentBlock->appendNew<Const32Value>(m_proc, origin(), tableIndex), index);
{
@@ -717,7 +717,7 @@
{
// FIXME: Emit this inline <https://bugs.webkit.org/show_bug.cgi?id=198506>.
auto shouldThrow = m_currentBlock->appendNew<CCallValue>(m_proc, B3::Int32, origin(),
- m_currentBlock->appendNew<ConstPtrValue>(m_proc, origin(), tagCFunctionPtr<void*>(&operationSetWasmTableElement, B3CCallPtrTag)),
+ m_currentBlock->appendNew<ConstPtrValue>(m_proc, origin(), tagCFunction<B3CCallPtrTag>(operationSetWasmTableElement)),
instanceValue(), m_currentBlock->appendNew<Const32Value>(m_proc, origin(), tableIndex), index, value);
{
@@ -737,7 +737,7 @@
// FIXME: Emit this inline <https://bugs.webkit.org/show_bug.cgi?id=198506>.
result = m_currentBlock->appendNew<CCallValue>(m_proc, B3::Int64, origin(),
- m_currentBlock->appendNew<ConstPtrValue>(m_proc, origin(), tagCFunctionPtr<void*>(&operationWasmRefFunc, B3CCallPtrTag)),
+ m_currentBlock->appendNew<ConstPtrValue>(m_proc, origin(), tagCFunction<B3CCallPtrTag>(operationWasmRefFunc)),
instanceValue(), addConstant(Type::I32, index));
return { };
@@ -747,7 +747,7 @@
{
// FIXME: Emit this inline <https://bugs.webkit.org/show_bug.cgi?id=198506>.
result = m_currentBlock->appendNew<CCallValue>(m_proc, toB3Type(I32), origin(),
- m_currentBlock->appendNew<ConstPtrValue>(m_proc, origin(), tagCFunctionPtr<void*>(&operationGetWasmTableSize, B3CCallPtrTag)),
+ m_currentBlock->appendNew<ConstPtrValue>(m_proc, origin(), tagCFunction<B3CCallPtrTag>(operationGetWasmTableSize)),
instanceValue(), m_currentBlock->appendNew<Const32Value>(m_proc, origin(), tableIndex));
return { };
@@ -756,7 +756,7 @@
auto B3IRGenerator::addTableGrow(unsigned tableIndex, ExpressionType fill, ExpressionType delta, ExpressionType& result) -> PartialResult
{
result = m_currentBlock->appendNew<CCallValue>(m_proc, toB3Type(I32), origin(),
- m_currentBlock->appendNew<ConstPtrValue>(m_proc, origin(), tagCFunctionPtr<void*>(&operationWasmTableGrow, B3CCallPtrTag)),
+ m_currentBlock->appendNew<ConstPtrValue>(m_proc, origin(), tagCFunction<B3CCallPtrTag>(operationWasmTableGrow)),
instanceValue(), m_currentBlock->appendNew<Const32Value>(m_proc, origin(), tableIndex), fill, delta);
return { };
@@ -765,7 +765,7 @@
auto B3IRGenerator::addTableFill(unsigned tableIndex, ExpressionType offset, ExpressionType fill, ExpressionType count) -> PartialResult
{
auto result = m_currentBlock->appendNew<CCallValue>(m_proc, toB3Type(I32), origin(),
- m_currentBlock->appendNew<ConstPtrValue>(m_proc, origin(), tagCFunctionPtr<void*>(&operationWasmTableFill, B3CCallPtrTag)),
+ m_currentBlock->appendNew<ConstPtrValue>(m_proc, origin(), tagCFunction<B3CCallPtrTag>(operationWasmTableFill)),
instanceValue(), m_currentBlock->appendNew<Const32Value>(m_proc, origin(), tableIndex), offset, fill, count);
{
@@ -800,7 +800,7 @@
auto B3IRGenerator::addGrowMemory(ExpressionType delta, ExpressionType& result) -> PartialResult
{
result = m_currentBlock->appendNew<CCallValue>(m_proc, Int32, origin(),
- m_currentBlock->appendNew<ConstPtrValue>(m_proc, origin(), tagCFunctionPtr<void*>(&operationGrowMemory, B3CCallPtrTag)),
+ m_currentBlock->appendNew<ConstPtrValue>(m_proc, origin(), tagCFunction<B3CCallPtrTag>(operationGrowMemory)),
framePointer(), instanceValue(), delta);
restoreWebAssemblyGlobalState(RestoreCachedStackLimit::No, m_info.memory, instanceValue(), m_proc, m_currentBlock);
@@ -904,7 +904,7 @@
continuation->addPredecessor(m_currentBlock);
m_currentBlock = doSlowPath;
- Value* writeBarrierAddress = m_currentBlock->appendNew<ConstPtrValue>(m_proc, origin(), tagCFunctionPtr<void*>(&operationWasmWriteBarrierSlowPath, B3CCallPtrTag));
+ Value* writeBarrierAddress = m_currentBlock->appendNew<ConstPtrValue>(m_proc, origin(), tagCFunction<B3CCallPtrTag>(operationWasmWriteBarrierSlowPath));
m_currentBlock->appendNew<CCallValue>(m_proc, B3::Void, origin(), writeBarrierAddress, cell, vm);
m_currentBlock->appendNewControlValue(m_proc, Jump, origin(), continuation);
@@ -957,7 +957,7 @@
continuation->addPredecessor(m_currentBlock);
m_currentBlock = doSlowPath;
- Value* writeBarrierAddress = m_currentBlock->appendNew<ConstPtrValue>(m_proc, origin(), tagCFunctionPtr<void*>(&operationWasmWriteBarrierSlowPath, B3CCallPtrTag));
+ Value* writeBarrierAddress = m_currentBlock->appendNew<ConstPtrValue>(m_proc, origin(), tagCFunction<B3CCallPtrTag>(operationWasmWriteBarrierSlowPath));
m_currentBlock->appendNew<CCallValue>(m_proc, B3::Void, origin(), writeBarrierAddress, cell, vm);
m_currentBlock->appendNewControlValue(m_proc, Jump, origin(), continuation);
@@ -2150,7 +2150,7 @@
}
#endif
- Value* funcAddress = m_currentBlock->appendNew<ConstPtrValue>(m_proc, origin(), tagCFunctionPtr<void*>(&operationPopcount32, B3CCallPtrTag));
+ Value* funcAddress = m_currentBlock->appendNew<ConstPtrValue>(m_proc, origin(), tagCFunction<B3CCallPtrTag>(operationPopcount32));
result = m_currentBlock->appendNew<CCallValue>(m_proc, Int32, origin(), Effects::none(), funcAddress, arg);
return { };
}
@@ -2171,7 +2171,7 @@
}
#endif
- Value* funcAddress = m_currentBlock->appendNew<ConstPtrValue>(m_proc, origin(), tagCFunctionPtr<void*>(operationPopcount64, B3CCallPtrTag));
+ Value* funcAddress = m_currentBlock->appendNew<ConstPtrValue>(m_proc, origin(), tagCFunction<B3CCallPtrTag>(operationPopcount64));
result = m_currentBlock->appendNew<CCallValue>(m_proc, Int64, origin(), Effects::none(), funcAddress, arg);
return { };
}
Modified: trunk/Source/_javascript_Core/wasm/WasmThunks.cpp (259785 => 259786)
--- trunk/Source/_javascript_Core/wasm/WasmThunks.cpp 2020-04-09 07:57:16 UTC (rev 259785)
+++ trunk/Source/_javascript_Core/wasm/WasmThunks.cpp 2020-04-09 09:27:40 UTC (rev 259786)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2017-2018 Apple Inc. All rights reserved.
+ * Copyright (C) 2017-2020 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -88,7 +88,7 @@
unsigned numberOfStackBytesUsedForRegisterPreservation = ScratchRegisterAllocator::preserveRegistersToStackForCall(jit, registersToSpill, extraPaddingBytes);
jit.loadWasmContextInstance(GPRInfo::argumentGPR0);
- jit.move(MacroAssembler::TrustedImmPtr(tagCFunctionPtr<OperationPtrTag>(operationWasmTriggerTierUpNow)), GPRInfo::argumentGPR2);
+ jit.move(MacroAssembler::TrustedImmPtr(tagCFunction<OperationPtrTag>(operationWasmTriggerTierUpNow)), GPRInfo::argumentGPR2);
jit.call(GPRInfo::argumentGPR2, OperationPtrTag);
ScratchRegisterAllocator::restoreRegistersFromStackForCall(jit, registersToSpill, RegisterSet(), numberOfStackBytesUsedForRegisterPreservation, extraPaddingBytes);
Modified: trunk/Source/WTF/ChangeLog (259785 => 259786)
--- trunk/Source/WTF/ChangeLog 2020-04-09 07:57:16 UTC (rev 259785)
+++ trunk/Source/WTF/ChangeLog 2020-04-09 09:27:40 UTC (rev 259786)
@@ -1,3 +1,23 @@
+2020-04-09 Mark Lam <[email protected]>
+
+ Implement a more efficient tagCFunction() tool.
+ https://bugs.webkit.org/show_bug.cgi?id=210254
+
+ Reviewed by Keith Miller.
+
+ 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):
+
2020-04-08 David Kilzer <[email protected]>
WTF::Persistence::VectorCoder and IPC::VectorArgumentCoder should use checked arithmetic
Modified: trunk/Source/WTF/wtf/PtrTag.h (259785 => 259786)
--- trunk/Source/WTF/wtf/PtrTag.h 2020-04-09 07:57:16 UTC (rev 259785)
+++ trunk/Source/WTF/wtf/PtrTag.h 2020-04-09 09:27:40 UTC (rev 259786)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2018-2019 Apple Inc. All rights reserved.
+ * Copyright (C) 2018-2020 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -320,6 +320,20 @@
template<PtrTag tag, typename PtrType, typename = std::enable_if_t<std::is_pointer<PtrType>::value>>
inline PtrType tagCFunctionPtr(PtrType ptr) { return tagCFunctionPtr(ptr, tag); }
+template<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>
+inline FunctionType tagCFunction(FunctionType func)
+{
+ ASSERT(isTaggedWith(func, CFunctionPtrTag));
+ ASSERT(newTag != CFunctionPtrTag);
+ return ptrauth_auth_and_resign(func, ptrauth_key_function_pointer, 0, ptrauth_key_process_dependent_code, newTag);
+}
+
+template<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>
+inline ReturnType tagCFunction(FunctionType func)
+{
+ return bitwise_cast<ReturnType>(tagCFunction<newTag>(func));
+}
+
template<PtrTagAction tagAction, typename PtrType>
inline PtrType untagCFunctionPtrImpl(PtrType ptr, PtrTag tag)
{
@@ -521,6 +535,15 @@
template<PtrTag, typename PtrType, typename = std::enable_if_t<std::is_pointer<PtrType>::value>>
inline PtrType tagCFunctionPtr(PtrType ptr) { return ptr; }
+template<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>
+inline FunctionType tagCFunction(FunctionType func) { return func; }
+
+template<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>
+inline ReturnType tagCFunction(FunctionType func)
+{
+ return bitwise_cast<ReturnType>(tagCFunction<newTag>(func));
+}
+
template<typename T, typename PtrType, typename = std::enable_if_t<std::is_pointer<PtrType>::value && !std::is_same<T, PtrType>::value>>
inline T untagCFunctionPtr(PtrType ptr, PtrTag) { return bitwise_cast<T>(ptr); }
@@ -578,6 +601,7 @@
using WTF::untagCodePtr;
using WTF::retagCodePtr;
using WTF::removeCodePtrTag;
+using WTF::tagCFunction;
using WTF::tagCFunctionPtr;
using WTF::untagCFunctionPtr;
using WTF::tagInt;