Changeset 271186 in webkit
- Timestamp:
- Jan 5, 2021, 7:03:43 PM (6 years ago)
- Location:
- trunk
- Files:
-
- 12 edited
-
JSTests/stress/sampling-profiler-wasm-name-section.js (modified) (1 diff)
-
JSTests/stress/sampling-profiler-wasm.js (modified) (1 diff)
-
JSTests/stress/sampling-profiler/samplingProfiler.js (modified) (1 diff)
-
JSTests/wasm/function-tests/nameSection.js (modified) (1 diff)
-
Source/JavaScriptCore/ChangeLog (modified) (1 diff)
-
Source/JavaScriptCore/dfg/DFGOperations.cpp (modified) (1 diff)
-
Source/JavaScriptCore/dfg/DFGStrengthReductionPhase.cpp (modified) (2 diffs)
-
Source/JavaScriptCore/jit/JITOperations.cpp (modified) (1 diff)
-
Source/JavaScriptCore/llint/LLIntSlowPaths.cpp (modified) (2 diffs)
-
Source/JavaScriptCore/runtime/Intrinsic.cpp (modified) (1 diff)
-
Source/JavaScriptCore/runtime/Intrinsic.h (modified) (1 diff)
-
Source/JavaScriptCore/wasm/js/WebAssemblyFunction.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/JSTests/stress/sampling-profiler-wasm-name-section.js
r271112 r271186 70 70 return instance.exports._parrot(1); 71 71 }; 72 runTest(wasmEntry, ["_silly", "(unknown)", "<?>.wasm-function[_eggs]", "<?>.wasm-function[_bacon]", "<?>.wasm-function[_spam]", "<?>.wasm-function[_parrot]", " wasm-stub", "24", "wasmEntry"]);72 runTest(wasmEntry, ["_silly", "(unknown)", "<?>.wasm-function[_eggs]", "<?>.wasm-function[_bacon]", "<?>.wasm-function[_spam]", "<?>.wasm-function[_parrot]", "(unknown)", "wasmEntry"]); 73 73 } -
trunk/JSTests/stress/sampling-profiler-wasm.js
r271112 r271186 9 9 return instance.exports.loop(10000000); 10 10 }; 11 runTest(wasmEntry, ["<?>.wasm-function[0]", " wasm-stub", "0", "wasmEntry"]);11 runTest(wasmEntry, ["<?>.wasm-function[0]", "(unknown)", "wasmEntry"]); 12 12 } -
trunk/JSTests/stress/sampling-profiler/samplingProfiler.js
r195376 r271186 44 44 45 45 let node = tree; 46 let prev = null; 46 47 for (let i = stackTrace.length; i--; ) { 48 prev = node; 47 49 node = node.children[stackTrace[i]]; 48 50 if (!node) { 49 51 if (verbose) 50 print("failing on " + i + " : " + stackTrace[i] );52 print("failing on " + i + " : " + stackTrace[i], " ", JSON.stringify(Object.getOwnPropertyNames(prev.children))); 51 53 return false; 52 54 } -
trunk/JSTests/wasm/function-tests/nameSection.js
r246589 r271186 70 70 assert.eq(stacktrace[4], "<?>.wasm-function[_spam]@[wasm code]"); 71 71 assert.eq(stacktrace[5], "<?>.wasm-function[_parrot]@[wasm code]"); 72 assert.eq(stacktrace[6], "wasm-stub@[ wasmcode]"); // wasm entry72 assert.eq(stacktrace[6], "wasm-stub@[native code]"); // wasm entry -
trunk/Source/JavaScriptCore/ChangeLog
r271168 r271186 1 2021-01-05 Yusuke Suzuki <ysuzuki@apple.com> 2 3 [JSC] DFG/FTL DirectCall need to respect Wasm IC 4 https://bugs.webkit.org/show_bug.cgi?id=220339 5 6 Reviewed by Saam Barati. 7 8 We found that Wasm IC for fast calls are not used in several places. 9 10 1. LLInt calls 11 2. DFG/FTL DirectCall 12 3. Virtual calls 13 14 We noticed this because of r271112. r271112 made wasm function loading from exports constant-folded in DFG/FTL. 15 And it emits DirectCall instead of Call in DFG/FTL. Then, we missed Wasm IC and get large performance regression 16 in JetStream2 richard-wasm. 17 18 In this patch, we use Wasm IC as much as possible. The key thing of this wasm IC is that it relies on callee. 19 So, if the place is just checking Executable, then we should not go to that IC. Fortunately, the above three checks 20 callee before using code pointer obtained for Wasm IC. 21 22 1. LLInt call fast path first checks callee. 23 2. DFG/FTL DirectCall requires callee is constant for wasm functions. 24 3. Virtual calls are not storing generated codePtr. 25 26 * dfg/DFGOperations.cpp: 27 (JSC::DFG::JSC_DEFINE_JIT_OPERATION): 28 * jit/JITOperations.cpp: 29 (JSC::virtualForWithFunction): 30 * llint/LLIntSlowPaths.cpp: 31 (JSC::LLInt::setUpCall): 32 1 33 2021-01-05 Yusuke Suzuki <ysuzuki@apple.com> 2 34 -
trunk/Source/JavaScriptCore/dfg/DFGOperations.cpp
r270874 r271186 3551 3551 MacroAssemblerCodePtr<JSEntryPtrTag> codePtr; 3552 3552 CodeBlock* codeBlock = nullptr; 3553 if (executable->isHostFunction()) 3554 codePtr = executable->entrypointFor(kind, MustCheckArity); 3555 else { 3553 if (executable->isHostFunction()) { 3554 // jsToWasmICCodePtr assumes that callee is always the same since DirectCall does not check callee. 3555 // But for wasm functions, we already ensured that callee is constant when emitting DirectCall. 3556 codePtr = jsToWasmICCodePtr(vm, kind, callee); 3557 if (!codePtr) 3558 codePtr = executable->entrypointFor(kind, MustCheckArity); 3559 } else { 3556 3560 FunctionExecutable* functionExecutable = static_cast<FunctionExecutable*>(executable); 3557 3561 -
trunk/Source/JavaScriptCore/dfg/DFGStrengthReductionPhase.cpp
r261895 r271186 918 918 Edge callee = m_graph.varArgChild(m_node, 0); 919 919 CallVariant callVariant; 920 if (JSFunction* function = callee->dynamicCastConstant<JSFunction*>(vm())) { 920 JSFunction* function = callee->dynamicCastConstant<JSFunction*>(vm()); 921 if (function) { 921 922 executable = function->executable(); 922 923 callVariant = CallVariant(function); … … 928 929 if (!executable) 929 930 break; 931 932 // If this is wasm function, and callee is not an constant, 933 // we should not use DirectCall since it will emit Wasm IC based on the assumption that the callee is constant. 934 // Currently, there is no way to reach to this condition (since no function-allocation node generates WebAssemblyFunction), 935 // but this is good guard for the future extension. 936 if (executable->intrinsic() == WasmFunctionIntrinsic) { 937 if (!function) 938 break; 939 } 930 940 931 941 if (FunctionExecutable* functionExecutable = jsDynamicCast<FunctionExecutable*>(vm(), executable)) { -
trunk/Source/JavaScriptCore/jit/JITOperations.cpp
r270874 r271186 1390 1390 } 1391 1391 } 1392 return encodeResult(executable->entrypointFor( 1393 kind, MustCheckArity).executableAddress(), 1392 1393 MacroAssemblerCodePtr<JSEntryPtrTag> codePtr; 1394 if (executable->isHostFunction()) 1395 codePtr = jsToWasmICCodePtr(vm, kind, function); 1396 if (!codePtr) 1397 codePtr = executable->entrypointFor(kind, MustCheckArity); 1398 1399 return encodeResult(codePtr.executableAddress(), 1394 1400 reinterpret_cast<void*>(callLinkInfo->callMode() == CallMode::Tail ? ReuseTheFrame : KeepTheFrame)); 1395 1401 } -
trunk/Source/JavaScriptCore/llint/LLIntSlowPaths.cpp
r269468 r271186 61 61 #include "ProtoCallFrameInlines.h" 62 62 #include "RegExpObject.h" 63 #include "Repatch.h" 63 64 #include "ShadowChicken.h" 64 65 #include "SuperSampler.h" … … 1737 1738 MacroAssemblerCodePtr<JSEntryPtrTag> codePtr; 1738 1739 CodeBlock* codeBlock = nullptr; 1739 if (executable->isHostFunction()) 1740 codePtr = executable->entrypointFor(kind, MustCheckArity); 1741 else { 1740 if (executable->isHostFunction()) { 1741 #if ENABLE(JIT) 1742 codePtr = jsToWasmICCodePtr(vm, kind, callee); 1743 #endif 1744 if (!codePtr) 1745 codePtr = executable->entrypointFor(kind, MustCheckArity); 1746 } else { 1742 1747 FunctionExecutable* functionExecutable = static_cast<FunctionExecutable*>(executable); 1743 1748 -
trunk/Source/JavaScriptCore/runtime/Intrinsic.cpp
r269531 r271186 338 338 case DataViewSetFloat64: 339 339 return "DataViewSetFloat64"; 340 case WasmFunctionIntrinsic: 341 return "WasmFunctionIntrinsic"; 340 342 } 341 343 RELEASE_ASSERT_NOT_REACHED(); -
trunk/Source/JavaScriptCore/runtime/Intrinsic.h
r269531 r271186 193 193 DataViewSetFloat32, 194 194 DataViewSetFloat64, 195 196 WasmFunctionIntrinsic, 195 197 }; 196 198 -
trunk/Source/JavaScriptCore/wasm/js/WebAssemblyFunction.cpp
r271168 r271186 435 435 WebAssemblyFunction* WebAssemblyFunction::create(VM& vm, JSGlobalObject* globalObject, Structure* structure, unsigned length, const String& name, JSWebAssemblyInstance* instance, Wasm::Callee& jsEntrypoint, Wasm::WasmToWasmImportableFunction::LoadLocation wasmToWasmEntrypointLoadLocation, Wasm::SignatureIndex signatureIndex) 436 436 { 437 NativeExecutable* executable = vm.getHostFunction(callWebAssemblyFunction, NoIntrinsic, callHostFunctionAsConstructor, nullptr, name);437 NativeExecutable* executable = vm.getHostFunction(callWebAssemblyFunction, WasmFunctionIntrinsic, callHostFunctionAsConstructor, nullptr, name); 438 438 WebAssemblyFunction* function = new (NotNull, allocateCell<WebAssemblyFunction>(vm.heap)) WebAssemblyFunction(vm, executable, globalObject, structure, jsEntrypoint, wasmToWasmEntrypointLoadLocation, signatureIndex); 439 439 function->finishCreation(vm, executable, length, name, instance);
Note:
See TracChangeset
for help on using the changeset viewer.