Changeset 248824 in webkit
- Timestamp:
- Aug 17, 2019 6:47:58 PM (5 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r248802 r248824 1 2019-08-17 Yusuke Suzuki <ysuzuki@apple.com> 2 3 [JSC] WebAssembly BBQ should switch compile mode for size of modules 4 https://bugs.webkit.org/show_bug.cgi?id=200807 5 6 Reviewed by Mark Lam. 7 8 Some webpages use very large Wasm module, and it exhausts all executable memory in ARM64 devices since the size of executable memory region is 128MB. 9 The long term solution should be introducing Wasm interpreter. But as a short term solution, we introduce heuristics switching back to BBQ B3 at 10 the sacrifice of start-up time, since BBQ Air bloats such lengthy code, and thereby consumes a large amount of executable memory. 11 12 Currently, I picked 10MB since the reported website is using 11MB wasm module. 13 14 * runtime/Options.h: 15 * wasm/WasmAirIRGenerator.cpp: 16 (JSC::Wasm::parseAndCompileAir): 17 * wasm/WasmB3IRGenerator.cpp: 18 (JSC::Wasm::parseAndCompile): 19 * wasm/WasmBBQPlan.cpp: 20 (JSC::Wasm::BBQPlan::compileFunctions): 21 * wasm/WasmModuleInformation.h: 22 * wasm/WasmSectionParser.cpp: 23 (JSC::Wasm::SectionParser::parseCode): 24 * wasm/WasmStreamingParser.cpp: 25 (JSC::Wasm::StreamingParser::parseCodeSectionSize): 26 1 27 2019-08-16 Mark Lam <mark.lam@apple.com> 2 28 -
trunk/Source/JavaScriptCore/runtime/Options.h
r248661 r248824 477 477 v(bool, failToCompileWebAssemblyCode, false, Normal, "If true, no Wasm::Plan will sucessfully compile a function.") \ 478 478 v(size, webAssemblyPartialCompileLimit, 5000, Normal, "Limit on the number of bytes a Wasm::Plan::compile should attempt before checking for other work.") \ 479 v(unsigned, webAssemblyBBQOptimizationLevel, 0, Normal, "B3 Optimization level for BBQ Web Assembly module compilations.") \ 479 v(unsigned, webAssemblyBBQAirOptimizationLevel, 0, Normal, "Air Optimization level for BBQ Web Assembly module compilations.") \ 480 v(unsigned, webAssemblyBBQB3OptimizationLevel, 1, Normal, "B3 Optimization level for BBQ Web Assembly module compilations.") \ 480 481 v(unsigned, webAssemblyOMGOptimizationLevel, Options::defaultB3OptLevel(), Normal, "B3 Optimization level for OMG Web Assembly module compilations.") \ 481 482 \ … … 492 493 v(bool, useFastTLSForWasmContext, true, Normal, "If true, we will store context in fast TLS. If false, we will pin it to a register.") \ 493 494 v(bool, wasmBBQUsesAir, true, Normal, nullptr) \ 495 v(size, webAssemblyBBQAirModeThreshold, isIOS() ? (10 * MB) : 0, Normal, "If 0, we always use BBQ Air. If Wasm module code size hits this threshold, we compile Wasm module with B3 BBQ mode.") \ 494 496 v(bool, useWebAssemblyStreamingApi, enableWebAssemblyStreamingApi, Normal, "Allow to run WebAssembly's Streaming API") \ 495 497 v(bool, useCallICsForWebAssemblyToJSCalls, true, Normal, "If true, we will use CallLinkInfo to inline cache Wasm to JS calls.") \ -
trunk/Source/JavaScriptCore/wasm/WasmAirIRGenerator.cpp
r248178 r248824 2159 2159 procedure.setNeedsUsedRegisters(false); 2160 2160 2161 procedure.setOptLevel(Options::webAssemblyBBQ OptimizationLevel());2161 procedure.setOptLevel(Options::webAssemblyBBQAirOptimizationLevel()); 2162 2162 2163 2163 AirIRGenerator irGenerator(info, procedure, result.get(), unlinkedWasmToWasmCalls, mode, functionIndex, tierUp, throwWasmException, signature); -
trunk/Source/JavaScriptCore/wasm/WasmB3IRGenerator.cpp
r248178 r248824 1571 1571 1572 1572 procedure.setOptLevel(compilationMode == CompilationMode::BBQMode 1573 ? Options::webAssemblyBBQ OptimizationLevel()1573 ? Options::webAssemblyBBQB3OptimizationLevel() 1574 1574 : Options::webAssemblyOMGOptimizationLevel()); 1575 1575 -
trunk/Source/JavaScriptCore/wasm/WasmBBQPlan.cpp
r248187 r248824 270 270 TierUpCount* tierUp = Options::useBBQTierUpChecks() ? &m_tierUpCounts[functionIndex] : nullptr; 271 271 Expected<std::unique_ptr<InternalFunction>, String> parseAndCompileResult; 272 if (Options::wasmBBQUsesAir()) 272 273 // 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. 274 // The long term solution should be to introduce a Wasm interpreter. But as a short term solution, we introduce heuristics to switch back to BBQ B3 at the sacrifice of start-up time, 275 // as BBQ Air bloats such lengthy Wasm code and will consume a large amount of executable memory. 276 bool forceUsingB3 = false; 277 if (Options::webAssemblyBBQAirModeThreshold() && m_moduleInformation->codeSectionSize >= Options::webAssemblyBBQAirModeThreshold()) 278 forceUsingB3 = true; 279 280 if (!forceUsingB3 && Options::wasmBBQUsesAir()) 273 281 parseAndCompileResult = parseAndCompileAir(m_compilationContexts[functionIndex], function.data.data(), function.data.size(), signature, m_unlinkedWasmToWasmCalls[functionIndex], m_moduleInformation.get(), m_mode, functionIndex, tierUp, m_throwWasmException); 274 282 else -
trunk/Source/JavaScriptCore/wasm/WasmModuleInformation.h
r246571 r248824 87 87 Vector<Global> globals; 88 88 unsigned firstInternalGlobal { 0 }; 89 uint32_t codeSectionSize { 0 }; 89 90 Vector<CustomSection> customSections; 90 91 Ref<NameSection> nameSection; -
trunk/Source/JavaScriptCore/wasm/WasmSectionParser.cpp
r246645 r248824 415 415 auto SectionParser::parseCode() -> PartialResult 416 416 { 417 m_info->codeSectionSize = length(); 417 418 uint32_t count; 418 419 WASM_PARSER_FAIL_IF(!parseVarUInt32(count), "can't get Code section's count"); -
trunk/Source/JavaScriptCore/wasm/WasmStreamingParser.cpp
r243163 r248824 111 111 auto StreamingParser::parseCodeSectionSize(uint32_t functionCount) -> State 112 112 { 113 m_info->codeSectionSize = m_sectionLength; 113 114 m_functionCount = functionCount; 114 115 m_functionIndex = 0;
Note: See TracChangeset
for help on using the changeset viewer.