Changeset 287864 in webkit for trunk/Source/JavaScriptCore/wasm/WasmBBQPlan.cpp
- Timestamp:
- Jan 10, 2022, 5:36:00 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/wasm/WasmBBQPlan.cpp
r287801 r287864 65 65 if (!tryReserveCapacity(m_wasmInternalFunctions, functions.size(), " WebAssembly functions") 66 66 || !tryReserveCapacity(m_compilationContexts, functions.size(), " compilation contexts") 67 || !tryReserveCapacity(m_tierUpCounts, functions.size(), " tier-up counts")) 67 || !tryReserveCapacity(m_tierUpCounts, functions.size(), " tier-up counts") 68 || !tryReserveCapacity(m_allLoopEntrypoints, functions.size(), " loop entrypoints")) 68 69 return false; 69 70 … … 72 73 m_compilationContexts.resize(functions.size()); 73 74 m_tierUpCounts.resize(functions.size()); 75 m_allLoopEntrypoints.resize(functions.size()); 74 76 75 77 return true; … … 114 116 115 117 Vector<CodeLocationLabel<ExceptionHandlerPtrTag>> exceptionHandlerLocations; 116 computeExceptionHandlerLocations(exceptionHandlerLocations, function.get(), context, linkBuffer); 118 Vector<CodeLocationLabel<WasmEntryPtrTag>> loopEntrypointLocations; 119 computeExceptionHandlerAndLoopEntrypointLocations(exceptionHandlerLocations, loopEntrypointLocations, function.get(), context, linkBuffer); 117 120 118 121 computePCToCodeOriginMap(context, linkBuffer); … … 127 130 MacroAssemblerCodePtr<WasmEntryPtrTag> entrypoint; 128 131 { 129 Ref<BBQCallee> callee = BBQCallee::create(WTFMove(function->entrypoint), functionIndexSpace, m_moduleInformation->nameSection->get(functionIndexSpace), WTFMove(tierUp), WTFMove(unlinkedWasmToWasmCalls), WTFMove(function->stackmaps), WTFMove(function->exceptionHandlers), WTFMove(exceptionHandlerLocations)); 130 MacroAssembler::repatchPointer(function->calleeMoveLocation, CalleeBits::boxWasm(callee.ptr())); 132 Ref<BBQCallee> callee = BBQCallee::create(WTFMove(function->entrypoint), functionIndexSpace, m_moduleInformation->nameSection->get(functionIndexSpace), WTFMove(tierUp), WTFMove(unlinkedWasmToWasmCalls), WTFMove(function->stackmaps), WTFMove(function->exceptionHandlers), WTFMove(exceptionHandlerLocations), WTFMove(loopEntrypointLocations), function->osrEntryScratchBufferSize); 133 for (auto& moveLocation : function->calleeMoveLocations) 134 MacroAssembler::repatchPointer(moveLocation, CalleeBits::boxWasm(callee.ptr())); 131 135 entrypoint = callee->entrypoint(); 132 136 … … 197 201 ASSERT_UNUSED(functionIndexSpace, m_moduleInformation->signatureIndexFromFunctionIndexSpace(functionIndexSpace) == signatureIndex); 198 202 Expected<std::unique_ptr<InternalFunction>, String> parseAndCompileResult; 199 unsigned osrEntryScratchBufferSize = 0;200 203 201 204 // FIXME: Some webpages use very large Wasm module, and it exhausts all executable memory in ARM64 devices since the size of executable memory region is only limited to 128MB. … … 209 212 210 213 if (forceUsingB3) 211 parseAndCompileResult = parseAndCompile (context, function, signature, unlinkedWasmToWasmCalls, osrEntryScratchBufferSize, m_moduleInformation.get(), m_mode, CompilationMode::BBQMode, functionIndex, UINT32_MAX, tierUp);214 parseAndCompileResult = parseAndCompileB3(context, function, signature, unlinkedWasmToWasmCalls, m_moduleInformation.get(), m_mode, CompilationMode::BBQMode, functionIndex, UINT32_MAX, tierUp); 212 215 else 213 216 parseAndCompileResult = parseAndCompileAir(context, function, signature, unlinkedWasmToWasmCalls, m_moduleInformation.get(), m_mode, functionIndex, tierUp); … … 242 245 } 243 246 244 computeExceptionHandler Locations(m_exceptionHandlerLocations[functionIndex], function, context, linkBuffer);247 computeExceptionHandlerAndLoopEntrypointLocations(m_exceptionHandlerLocations[functionIndex], m_allLoopEntrypoints[functionIndex], function, context, linkBuffer); 245 248 246 249 computePCToCodeOriginMap(context, linkBuffer); … … 285 288 if (auto embedderToWasmFunction = m_embedderToWasmInternalFunctions.get(internalFunctionIndex)) { 286 289 embedderEntrypointCallee = EmbedderEntrypointCallee::create(WTFMove(embedderToWasmFunction->entrypoint)); 287 MacroAssembler::repatchPointer(embedderToWasmFunction->calleeMoveLocation, CalleeBits::boxWasm(embedderEntrypointCallee.get())); 290 for (auto& moveLocation : embedderToWasmFunction->calleeMoveLocations) 291 MacroAssembler::repatchPointer(moveLocation, CalleeBits::boxWasm(embedderEntrypointCallee.get())); 288 292 } 289 293 290 294 InternalFunction* function = m_wasmInternalFunctions[internalFunctionIndex].get(); 291 295 size_t functionIndexSpace = internalFunctionIndex + m_moduleInformation->importFunctionCount(); 292 Ref<BBQCallee> wasmEntrypointCallee = BBQCallee::create(WTFMove(function->entrypoint), functionIndexSpace, m_moduleInformation->nameSection->get(functionIndexSpace), WTFMove(m_tierUpCounts[internalFunctionIndex]), WTFMove(m_unlinkedWasmToWasmCalls[internalFunctionIndex]), WTFMove(function->stackmaps), WTFMove(function->exceptionHandlers), WTFMove(m_exceptionHandlerLocations[internalFunctionIndex])); 293 MacroAssembler::repatchPointer(function->calleeMoveLocation, CalleeBits::boxWasm(wasmEntrypointCallee.ptr())); 296 Ref<BBQCallee> wasmEntrypointCallee = BBQCallee::create(WTFMove(function->entrypoint), functionIndexSpace, m_moduleInformation->nameSection->get(functionIndexSpace), WTFMove(m_tierUpCounts[internalFunctionIndex]), WTFMove(m_unlinkedWasmToWasmCalls[internalFunctionIndex]), WTFMove(function->stackmaps), WTFMove(function->exceptionHandlers), WTFMove(m_exceptionHandlerLocations[internalFunctionIndex]), WTFMove(m_allLoopEntrypoints[internalFunctionIndex]), function->osrEntryScratchBufferSize); 297 298 for (auto& moveLocation : function->calleeMoveLocations) 299 MacroAssembler::repatchPointer(moveLocation, CalleeBits::boxWasm(wasmEntrypointCallee.ptr())); 294 300 295 301 if (m_compilationContexts[internalFunctionIndex].pcToCodeOriginMap)
Note:
See TracChangeset
for help on using the changeset viewer.