WebKit Bugzilla
Attachment 348269 Details for
Bug 189043
: [WebAssembly] Use StreamingParser in existing Wasm::BBQPlan
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-189043-20180828160053.patch (text/plain), 42.36 KB, created by
Yusuke Suzuki
on 2018-08-28 00:00:54 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Yusuke Suzuki
Created:
2018-08-28 00:00:54 PDT
Size:
42.36 KB
patch
obsolete
>Subversion Revision: 235420 >diff --git a/Source/JavaScriptCore/ChangeLog b/Source/JavaScriptCore/ChangeLog >index 59898cdfaa6aa1e2faf4395568baa4be15674c26..9c189ec639e867cf26fd8615f975d796b8d3e838 100644 >--- a/Source/JavaScriptCore/ChangeLog >+++ b/Source/JavaScriptCore/ChangeLog >@@ -1,3 +1,58 @@ >+2018-08-27 Yusuke Suzuki <yusukesuzuki@slowstart.org> >+ >+ [WebAssembly] Use StreamingParser in existing Wasm::BBQPlan >+ https://bugs.webkit.org/show_bug.cgi?id=189043 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ This patch integrates Wasm::StreamingParser into the existing Wasm::BBQPlan. >+ But it does not use any streaming feature. And Wasm::BBQPlan would not use the >+ streaming feature since it assumes that all the data is already given. >+ In a subsequent patch, we will create a new Plan and manager class for streaming >+ parsing and streaming compiling and use them for WebAssembly.compileStreaming and >+ instantiateStreaming. >+ >+ The intension of this patch is removing the old Wasm::ModuleParser. >+ >+ * JavaScriptCore.xcodeproj/project.pbxproj: >+ * Sources.txt: >+ * tools/JSDollarVM.cpp: >+ (WTF::WasmStreamingParser::WasmStreamingParser): >+ * wasm/WasmB3IRGenerator.cpp: >+ (JSC::Wasm::parseAndCompile): Use FunctionData, it is good since it is more strongly typed. >+ * wasm/WasmB3IRGenerator.h: >+ * wasm/WasmBBQPlan.cpp: >+ (JSC::Wasm::BBQPlan::BBQPlan): >+ (JSC::Wasm::BBQPlan::didParseFunction): Add a callback, which invokes validation. >+ (JSC::Wasm::BBQPlan::parseAndValidateModule): Use StreamingParser instead of old ModuleParser. >+ (JSC::Wasm::BBQPlan::compileFunctions): >+ (JSC::Wasm::BBQPlan::complete): >+ * wasm/WasmBBQPlan.h: >+ * wasm/WasmModuleParser.cpp: Removed. >+ * wasm/WasmModuleParser.h: Removed old Wasm::ModuleParser. >+ * wasm/WasmOMGPlan.cpp: >+ (JSC::Wasm::OMGPlan::work): >+ * wasm/WasmPlan.cpp: >+ (JSC::Wasm::Plan::fail): Make fail function callable multiple times. The first error will be used. >+ * wasm/WasmSectionParser.cpp: >+ (JSC::Wasm::SectionParser::parseCode): Since the Code section is specially handled in >+ StreamingParser, this code is never used. >+ * wasm/WasmStreamingParser.cpp: >+ (JSC::Wasm::StreamingParser::StreamingParser): >+ (JSC::Wasm::StreamingParser::parseCodeSectionSize): >+ (JSC::Wasm::StreamingParser::parseFunctionPayload): >+ (JSC::Wasm::StreamingParser::parseSectionPayload): >+ (JSC::Wasm::StreamingParser::finalize): Call client's callbacks at appropriate timings. >+ * wasm/WasmStreamingParser.h: >+ (JSC::Wasm::StreamingParserClient::didParseSection): >+ (JSC::Wasm::StreamingParserClient::didParseFunction): >+ (JSC::Wasm::StreamingParserClient::didFinishParsing): Add StreamingParserClient, >+ which has 3 callbacks right now. StreamingParser gets this client and call these callbacks >+ at appropriate timings. >+ * wasm/WasmValidate.cpp: >+ (JSC::Wasm::validateFunction): >+ * wasm/WasmValidate.h: Use FunctionData, it is good since it is more strongly typed. >+ > 2018-08-27 Yusuke Suzuki <yusukesuzuki@slowstart.org> > > [WebAssembly] Parse wasm modules in a streaming fashion >diff --git a/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj b/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj >index e88a74ab7651dcebeba9dde34b64014b3b86b816..110bdbc235baee3ba4264ec8e1e7603a6c6d3e14 100644 >--- a/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj >+++ b/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj >@@ -1050,7 +1050,6 @@ > 53F40E8B1D5901BB0099A1B6 /* WasmFunctionParser.h in Headers */ = {isa = PBXBuildFile; fileRef = 53F40E8A1D5901BB0099A1B6 /* WasmFunctionParser.h */; }; > 53F40E8D1D5901F20099A1B6 /* WasmParser.h in Headers */ = {isa = PBXBuildFile; fileRef = 53F40E8C1D5901F20099A1B6 /* WasmParser.h */; }; > 53F40E931D5A4AB30099A1B6 /* WasmB3IRGenerator.h in Headers */ = {isa = PBXBuildFile; fileRef = 53F40E921D5A4AB30099A1B6 /* WasmB3IRGenerator.h */; }; >- 53F40E951D5A7AEF0099A1B6 /* WasmModuleParser.h in Headers */ = {isa = PBXBuildFile; fileRef = 53F40E941D5A7AEF0099A1B6 /* WasmModuleParser.h */; }; > 53F6BF6D1C3F060A00F41E5D /* InternalFunctionAllocationProfile.h in Headers */ = {isa = PBXBuildFile; fileRef = 53F6BF6C1C3F060A00F41E5D /* InternalFunctionAllocationProfile.h */; settings = {ATTRIBUTES = (Private, ); }; }; > 53F8D2001E8387D400D21116 /* WasmBBQPlanInlines.h in Headers */ = {isa = PBXBuildFile; fileRef = 53F8D1FF1E8387D400D21116 /* WasmBBQPlanInlines.h */; }; > 53FA2AE11CF37F3F0022711D /* LLIntPrototypeLoadAdaptiveStructureWatchpoint.h in Headers */ = {isa = PBXBuildFile; fileRef = 53FA2AE01CF37F3F0022711D /* LLIntPrototypeLoadAdaptiveStructureWatchpoint.h */; settings = {ATTRIBUTES = (Private, ); }; }; >@@ -3509,8 +3508,6 @@ > 53F40E8C1D5901F20099A1B6 /* WasmParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WasmParser.h; sourceTree = "<group>"; }; > 53F40E8E1D5902820099A1B6 /* WasmB3IRGenerator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WasmB3IRGenerator.cpp; sourceTree = "<group>"; }; > 53F40E921D5A4AB30099A1B6 /* WasmB3IRGenerator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WasmB3IRGenerator.h; sourceTree = "<group>"; }; >- 53F40E941D5A7AEF0099A1B6 /* WasmModuleParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WasmModuleParser.h; sourceTree = "<group>"; }; >- 53F40E961D5A7BEC0099A1B6 /* WasmModuleParser.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WasmModuleParser.cpp; sourceTree = "<group>"; }; > 53F6BF6C1C3F060A00F41E5D /* InternalFunctionAllocationProfile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InternalFunctionAllocationProfile.h; sourceTree = "<group>"; }; > 53F8D1FF1E8387D400D21116 /* WasmBBQPlanInlines.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WasmBBQPlanInlines.h; sourceTree = "<group>"; }; > 53FA2AE01CF37F3F0022711D /* LLIntPrototypeLoadAdaptiveStructureWatchpoint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LLIntPrototypeLoadAdaptiveStructureWatchpoint.h; sourceTree = "<group>"; }; >@@ -5508,8 +5505,8 @@ > 796DAA2A1E89CCD6005DF24A /* CalleeBits.h */, > 1429D8DB0ED2205B00B89619 /* CallFrame.cpp */, > 1429D8DC0ED2205B00B89619 /* CallFrame.h */, >- FEA3BBA7212B655800E93AD1 /* CallFrameInlines.h */, > A7F869EC0F95C2EC00558697 /* CallFrameClosure.h */, >+ FEA3BBA7212B655800E93AD1 /* CallFrameInlines.h */, > 1429D85B0ED218E900B89619 /* CLoopStack.cpp */, > 14D792640DAA03FB001A9F05 /* CLoopStack.h */, > A7C1EAEB17987AB600299DB2 /* CLoopStackInlines.h */, >@@ -6342,8 +6339,6 @@ > 790081371E95A8EC0052D7CD /* WasmModule.h */, > 53E777E11E92E265007CBEC4 /* WasmModuleInformation.cpp */, > 53E777E21E92E265007CBEC4 /* WasmModuleInformation.h */, >- 53F40E961D5A7BEC0099A1B6 /* WasmModuleParser.cpp */, >- 53F40E941D5A7AEF0099A1B6 /* WasmModuleParser.h */, > AD5B416E1EBAFB65008EFA43 /* WasmName.h */, > AD7B4B2D1FA3E28600C9DF79 /* WasmNameSection.h */, > ADD8FA441EB3077100DF542F /* WasmNameSectionParser.cpp */, >@@ -8444,7 +8439,6 @@ > 99DA00A31BD5993100F4575C /* builtins_generator.py in Headers */, > 99DA00A41BD5993100F4575C /* builtins_model.py in Headers */, > 99DA00A51BD5993100F4575C /* builtins_templates.py in Headers */, >- FEA3BBA8212B655900E93AD1 /* CallFrameInlines.h in Headers */, > 41DEA1321B9F3163006D65DD /* BuiltinUtils.h in Headers */, > 9E72940B190F0514001A91B5 /* BundlePath.h in Headers */, > 0FB7F39715ED8E4600F167B2 /* Butterfly.h in Headers */, >@@ -8469,6 +8463,7 @@ > 0F64B27A1A7957B2006E4E66 /* CallEdge.h in Headers */, > 796DAA2B1E89CCD6005DF24A /* CalleeBits.h in Headers */, > 1429D8DE0ED2205B00B89619 /* CallFrame.h in Headers */, >+ FEA3BBA8212B655900E93AD1 /* CallFrameInlines.h in Headers */, > 62EC9BB71B7EB07C00303AD1 /* CallFrameShuffleData.h in Headers */, > 62D755D71B84FB4A001801FA /* CallFrameShuffler.h in Headers */, > 0F0B83B114BCF71800885B4F /* CallLinkInfo.h in Headers */, >@@ -8759,6 +8754,7 @@ > A70447EE17A0BD7000F5898E /* DumpContext.h in Headers */, > FE318FE01CAC982F00DFCC54 /* ECMAScriptSpecInternalFunctions.h in Headers */, > 2A83638618D7D0EE0000EBCC /* EdenGCActivityCallback.h in Headers */, >+ FE086BCA2123DEFB003F2929 /* EntryFrame.h in Headers */, > 2AD2EDFB19799E38004D6478 /* EnumerationMode.h in Headers */, > BC3046070E1F497F003232CF /* Error.h in Headers */, > BC02E90D0E1839DB000F9297 /* ErrorConstructor.h in Headers */, >@@ -9095,7 +9091,6 @@ > 978801411471AD920041B016 /* JSDateMath.h in Headers */, > C2A7F688160432D400F76B98 /* JSDestructibleObject.h in Headers */, > 0F7DF13C1E2971130095951B /* JSDestructibleObjectHeapCellType.h in Headers */, >- FE086BCA2123DEFB003F2929 /* EntryFrame.h in Headers */, > FE384EE61ADDB7AD0055DE2C /* JSDollarVM.h in Headers */, > 86E3C614167BABD7006D760A /* JSExport.h in Headers */, > A7B4ACAF1484C9CE00B38A36 /* JSExportMacros.h in Headers */, >@@ -9609,7 +9604,6 @@ > AD5C36EF1F7A263A000BCAAF /* WasmMemoryMode.h in Headers */, > 790081391E95A8EC0052D7CD /* WasmModule.h in Headers */, > 53E777E41E92E265007CBEC4 /* WasmModuleInformation.h in Headers */, >- 53F40E951D5A7AEF0099A1B6 /* WasmModuleParser.h in Headers */, > AD5B416F1EBAFB77008EFA43 /* WasmName.h in Headers */, > AD7B4B2E1FA3E29800C9DF79 /* WasmNameSection.h in Headers */, > ADD8FA461EB3079700DF542F /* WasmNameSectionParser.h in Headers */, >diff --git a/Source/JavaScriptCore/Sources.txt b/Source/JavaScriptCore/Sources.txt >index e2baf1a5755fc7e4f23f9d14d9de3491f390a18e..34041a958b683ee601d8e0ddae8211fccdc46f9c 100644 >--- a/Source/JavaScriptCore/Sources.txt >+++ b/Source/JavaScriptCore/Sources.txt >@@ -985,7 +985,6 @@ wasm/WasmMemoryInformation.cpp > wasm/WasmMemoryMode.cpp > wasm/WasmModule.cpp > wasm/WasmModuleInformation.cpp >-wasm/WasmModuleParser.cpp > wasm/WasmNameSectionParser.cpp > wasm/WasmOMGPlan.cpp > wasm/WasmOpcodeOrigin.cpp >diff --git a/Source/JavaScriptCore/tools/JSDollarVM.cpp b/Source/JavaScriptCore/tools/JSDollarVM.cpp >index ef255724bc6a1120016b7f22f969dbffd9cae23f..22dcdb7c117294712d5fe983279d536dddd737d2 100644 >--- a/Source/JavaScriptCore/tools/JSDollarVM.cpp >+++ b/Source/JavaScriptCore/tools/JSDollarVM.cpp >@@ -1105,10 +1105,25 @@ static EncodedJSValue JSC_HOST_CALL functionWasmStreamingParserFinalize(ExecStat > > class WasmStreamingParser : public JSDestructibleObject { > public: >+ class Client final : public Wasm::StreamingParserClient { >+ public: >+ explicit Client(WasmStreamingParser* parser) >+ : m_parser(parser) >+ { >+ } >+ >+ void didParseSection(Wasm::Section) override { } >+ void didParseFunction(unsigned, const Wasm::FunctionData&) override { } >+ void didFinishParsing() override { } >+ >+ WasmStreamingParser* m_parser; >+ }; >+ > WasmStreamingParser(VM& vm, Structure* structure) > : Base(vm, structure) > , m_info(Wasm::ModuleInformation::create()) >- , m_streamingParser(m_info.get()) >+ , m_client(this) >+ , m_streamingParser(m_info.get(), m_client) > { > } > >@@ -1141,6 +1156,7 @@ class WasmStreamingParser : public JSDestructibleObject { > DECLARE_INFO; > > Ref<Wasm::ModuleInformation> m_info; >+ Client m_client; > Wasm::StreamingParser m_streamingParser; > }; > >diff --git a/Source/JavaScriptCore/wasm/WasmB3IRGenerator.cpp b/Source/JavaScriptCore/wasm/WasmB3IRGenerator.cpp >index 3e7ce60ad74b0020474a86993da76e7180dc6f24..ee5f15904037a4f554254e8bcff6bf535ebba1b1 100644 >--- a/Source/JavaScriptCore/wasm/WasmB3IRGenerator.cpp >+++ b/Source/JavaScriptCore/wasm/WasmB3IRGenerator.cpp >@@ -1381,7 +1381,7 @@ auto B3IRGenerator::origin() -> Origin > return bitwise_cast<Origin>(origin); > } > >-Expected<std::unique_ptr<InternalFunction>, String> parseAndCompile(CompilationContext& compilationContext, const uint8_t* functionStart, size_t functionLength, const Signature& signature, Vector<UnlinkedWasmToWasmCall>& unlinkedWasmToWasmCalls, const ModuleInformation& info, MemoryMode mode, CompilationMode compilationMode, uint32_t functionIndex, TierUpCount* tierUp, ThrowWasmException throwWasmException) >+Expected<std::unique_ptr<InternalFunction>, String> parseAndCompile(CompilationContext& compilationContext, const FunctionData& function, const Signature& signature, Vector<UnlinkedWasmToWasmCall>& unlinkedWasmToWasmCalls, const ModuleInformation& info, MemoryMode mode, CompilationMode compilationMode, uint32_t functionIndex, TierUpCount* tierUp, ThrowWasmException throwWasmException) > { > auto result = std::make_unique<InternalFunction>(); > >@@ -1406,7 +1406,7 @@ Expected<std::unique_ptr<InternalFunction>, String> parseAndCompile(CompilationC > : Options::webAssemblyOMGOptimizationLevel()); > > B3IRGenerator irGenerator(info, procedure, result.get(), unlinkedWasmToWasmCalls, mode, compilationMode, functionIndex, tierUp, throwWasmException); >- FunctionParser<B3IRGenerator> parser(irGenerator, functionStart, functionLength, signature, info); >+ FunctionParser<B3IRGenerator> parser(irGenerator, function.data.data(), function.data.size(), signature, info); > WASM_FAIL_IF_HELPER_FAILS(parser.parse()); > > irGenerator.insertConstants(); >diff --git a/Source/JavaScriptCore/wasm/WasmB3IRGenerator.h b/Source/JavaScriptCore/wasm/WasmB3IRGenerator.h >index 931f527cb7a52e394d703fcf2995e6bd769a078b..9cbc046e0075e94a8aeffd3890d01aae12739354 100644 >--- a/Source/JavaScriptCore/wasm/WasmB3IRGenerator.h >+++ b/Source/JavaScriptCore/wasm/WasmB3IRGenerator.h >@@ -55,7 +55,7 @@ struct CompilationContext { > std::unique_ptr<B3::OpaqueByproducts> wasmEntrypointByproducts; > }; > >-Expected<std::unique_ptr<InternalFunction>, String> parseAndCompile(CompilationContext&, const uint8_t*, size_t, const Signature&, Vector<UnlinkedWasmToWasmCall>&, const ModuleInformation&, MemoryMode, CompilationMode, uint32_t functionIndex, TierUpCount* = nullptr, ThrowWasmException = nullptr); >+Expected<std::unique_ptr<InternalFunction>, String> parseAndCompile(CompilationContext&, const FunctionData&, const Signature&, Vector<UnlinkedWasmToWasmCall>&, const ModuleInformation&, MemoryMode, CompilationMode, uint32_t functionIndex, TierUpCount* = nullptr, ThrowWasmException = nullptr); > > } } // namespace JSC::Wasm > >diff --git a/Source/JavaScriptCore/wasm/WasmBBQPlan.cpp b/Source/JavaScriptCore/wasm/WasmBBQPlan.cpp >index 43c8f562afa1c3633a7e6c61f40922ec0be97213..ee5559a631dfd6e3ce282d491516f79568c2d672 100644 >--- a/Source/JavaScriptCore/wasm/WasmBBQPlan.cpp >+++ b/Source/JavaScriptCore/wasm/WasmBBQPlan.cpp >@@ -35,7 +35,6 @@ > #include "WasmCallingConvention.h" > #include "WasmFaultSignalHandler.h" > #include "WasmMemory.h" >-#include "WasmModuleParser.h" > #include "WasmTierUpCount.h" > #include "WasmValidate.h" > #include <wtf/DataLog.h> >@@ -53,6 +52,7 @@ static const bool verbose = false; > > BBQPlan::BBQPlan(Context* context, Ref<ModuleInformation> info, AsyncWork work, CompletionTask&& task, CreateEmbedderWrapper&& createEmbedderWrapper, ThrowWasmException throwWasmException) > : Base(context, WTFMove(info), WTFMove(task), WTFMove(createEmbedderWrapper), throwWasmException) >+ , m_streamingParser(m_moduleInformation.get(), *this) > , m_state(State::Validated) > , m_asyncWork(work) > { >@@ -61,6 +61,7 @@ BBQPlan::BBQPlan(Context* context, Ref<ModuleInformation> info, AsyncWork work, > BBQPlan::BBQPlan(Context* context, Vector<uint8_t>&& source, AsyncWork work, CompletionTask&& task, CreateEmbedderWrapper&& createEmbedderWrapper, ThrowWasmException throwWasmException) > : Base(context, ModuleInformation::create(), WTFMove(task), WTFMove(createEmbedderWrapper), throwWasmException) > , m_source(WTFMove(source)) >+ , m_streamingParser(m_moduleInformation.get(), *this) > , m_state(State::Initial) > , m_asyncWork(work) > { >@@ -68,6 +69,7 @@ BBQPlan::BBQPlan(Context* context, Vector<uint8_t>&& source, AsyncWork work, Com > > BBQPlan::BBQPlan(Context* context, AsyncWork work, CompletionTask&& task) > : Base(context, WTFMove(task)) >+ , m_streamingParser(m_moduleInformation.get(), *this) > , m_state(State::Initial) > , m_asyncWork(work) > { >@@ -92,6 +94,26 @@ void BBQPlan::moveToState(State state) > m_state = state; > } > >+void BBQPlan::didParseFunction(unsigned functionIndex, const FunctionData& function) >+{ >+ dataLogLnIf(WasmBBQPlanInternal::verbose, "Processing function starting at: ", function.start, " and ending at: ", function.end); >+ size_t functionLength = function.end - function.start; >+ ASSERT(functionLength <= sourceLength); >+ ASSERT(functionLength == function.data.size()); >+ SignatureIndex signatureIndex = m_moduleInformation->internalFunctionSignatureIndices[functionIndex]; >+ const Signature& signature = SignatureInformation::get(signatureIndex); >+ >+ auto validationResult = validateFunction(function, signature, m_moduleInformation.get()); >+ if (!validationResult) { >+ if (WasmBBQPlanInternal::verbose) { >+ for (unsigned i = 0; i < functionLength; ++i) >+ dataLog(RawPointer(reinterpret_cast<void*>(function.data[i])), ", "); >+ dataLogLn(); >+ } >+ fail(holdLock(m_lock), makeString(validationResult.error(), ", in function at index ", String::number(functionIndex))); // FIXME make this an Expected. >+ } >+} >+ > bool BBQPlan::parseAndValidateModule(const uint8_t* source, size_t sourceLength) > { > if (m_state != State::Initial) >@@ -102,37 +124,16 @@ bool BBQPlan::parseAndValidateModule(const uint8_t* source, size_t sourceLength) > if (WasmBBQPlanInternal::verbose || Options::reportCompileTimes()) > startTime = MonotonicTime::now(); > >- { >- ModuleParser moduleParser(source, sourceLength, m_moduleInformation); >- auto parseResult = moduleParser.parse(); >- if (!parseResult) { >- Base::fail(holdLock(m_lock), WTFMove(parseResult.error())); >- return false; >- } >+ m_streamingParser.addBytes(source, sourceLength); >+ if (m_streamingParser.finalize() != StreamingParser::State::Finished) { >+ fail(holdLock(m_lock), String(m_streamingParser.errorMessage())); >+ return false; > } >- >- const auto& functions = m_moduleInformation->functions; >- for (unsigned functionIndex = 0; functionIndex < functions.size(); ++functionIndex) { >- const auto& function = functions[functionIndex]; >- dataLogLnIf(WasmBBQPlanInternal::verbose, "Processing function starting at: ", function.start, " and ending at: ", function.end); >- size_t functionLength = function.end - function.start; >- ASSERT(functionLength <= sourceLength); >- ASSERT(functionLength == function.data.size()); >- SignatureIndex signatureIndex = m_moduleInformation->internalFunctionSignatureIndices[functionIndex]; >- const Signature& signature = SignatureInformation::get(signatureIndex); >- >- auto validationResult = validateFunction(function.data.data(), function.data.size(), signature, m_moduleInformation.get()); >- if (!validationResult) { >- if (WasmBBQPlanInternal::verbose) { >- for (unsigned i = 0; i < functionLength; ++i) >- dataLog(RawPointer(reinterpret_cast<void*>(function.data[i])), ", "); >- dataLogLn(); >- } >- Base::fail(holdLock(m_lock), makeString(validationResult.error(), ", in function at index ", String::number(functionIndex))); // FIXME make this an Expected. >+ { >+ auto locker = holdLock(m_lock); >+ if (failed()) > return false; >- } > } >- > if (WasmBBQPlanInternal::verbose || Options::reportCompileTimes()) > dataLogLn("Took ", (MonotonicTime::now() - startTime).microseconds(), " us to validate module"); > >@@ -266,18 +267,15 @@ void BBQPlan::compileFunctions(CompilationEffort effort) > const Signature& signature = SignatureInformation::get(signatureIndex); > unsigned functionIndexSpace = m_wasmToWasmExitStubs.size() + functionIndex; > ASSERT_UNUSED(functionIndexSpace, m_moduleInformation->signatureIndexFromFunctionIndexSpace(functionIndexSpace) == signatureIndex); >- ASSERT(validateFunction(function.data.data(), function.data.size(), signature, m_moduleInformation.get())); >+ ASSERT(validateFunction(function, signature, m_moduleInformation.get())); > > m_unlinkedWasmToWasmCalls[functionIndex] = Vector<UnlinkedWasmToWasmCall>(); > TierUpCount* tierUp = Options::useBBQTierUpChecks() ? &m_tierUpCounts[functionIndex] : nullptr; >- auto parseAndCompileResult = parseAndCompile(m_compilationContexts[functionIndex], function.data.data(), function.data.size(), signature, m_unlinkedWasmToWasmCalls[functionIndex], m_moduleInformation.get(), m_mode, CompilationMode::BBQMode, functionIndex, tierUp, m_throwWasmException); >+ auto parseAndCompileResult = parseAndCompile(m_compilationContexts[functionIndex], function, signature, m_unlinkedWasmToWasmCalls[functionIndex], m_moduleInformation.get(), m_mode, CompilationMode::BBQMode, functionIndex, tierUp, m_throwWasmException); > > if (UNLIKELY(!parseAndCompileResult)) { > auto locker = holdLock(m_lock); >- if (!m_errorMessage) { >- // Multiple compiles could fail simultaneously. We arbitrarily choose the first. >- fail(locker, makeString(parseAndCompileResult.error(), ", in function at index ", String::number(functionIndex))); // FIXME make this an Expected. >- } >+ fail(locker, makeString(parseAndCompileResult.error(), ", in function at index ", String::number(functionIndex))); // FIXME make this an Expected. > m_currentIndex = functions.size(); > return; > } >@@ -307,7 +305,7 @@ void BBQPlan::complete(const AbstractLocker& locker) > { > LinkBuffer linkBuffer(*context.wasmEntrypointJIT, nullptr, JITCompilationCanFail); > if (UNLIKELY(linkBuffer.didFailToAllocate())) { >- Base::fail(locker, makeString("Out of executable memory in function at index ", String::number(functionIndex))); >+ fail(locker, makeString("Out of executable memory in function at index ", String::number(functionIndex))); > return; > } > >@@ -319,7 +317,7 @@ void BBQPlan::complete(const AbstractLocker& locker) > if (auto embedderToWasmInternalFunction = m_embedderToWasmInternalFunctions.get(functionIndex)) { > LinkBuffer linkBuffer(*context.embedderEntrypointJIT, nullptr, JITCompilationCanFail); > if (UNLIKELY(linkBuffer.didFailToAllocate())) { >- Base::fail(locker, makeString("Out of executable memory in function entrypoint at index ", String::number(functionIndex))); >+ fail(locker, makeString("Out of executable memory in function entrypoint at index ", String::number(functionIndex))); > return; > } > >diff --git a/Source/JavaScriptCore/wasm/WasmBBQPlan.h b/Source/JavaScriptCore/wasm/WasmBBQPlan.h >index 941ac75f70e6f911b9fbb3ddb1378ccf969941ad..b40162146f731f3899e370e9a7b87753e0003310 100644 >--- a/Source/JavaScriptCore/wasm/WasmBBQPlan.h >+++ b/Source/JavaScriptCore/wasm/WasmBBQPlan.h >@@ -31,6 +31,7 @@ > #include "WasmB3IRGenerator.h" > #include "WasmModuleInformation.h" > #include "WasmPlan.h" >+#include "WasmStreamingParser.h" > #include "WasmTierUpCount.h" > #include <wtf/Bag.h> > #include <wtf/Function.h> >@@ -44,7 +45,7 @@ class CallLinkInfo; > > namespace Wasm { > >-class BBQPlan final : public Plan { >+class BBQPlan final : public Plan, public StreamingParserClient { > public: > using Base = Plan; > enum AsyncWork : uint8_t { FullCompile, Validation }; >@@ -127,6 +128,8 @@ class BBQPlan final : public Plan { > bool hasBeenPrepared() const { return m_state >= State::Prepared; } > bool multiThreaded() const override { return hasBeenPrepared(); } > >+ void didParseFunction(unsigned, const FunctionData&) override; >+ > private: > class ThreadCountHolder; > friend class ThreadCountHolder; >@@ -149,6 +152,7 @@ class BBQPlan final : public Plan { > Vector<TierUpCount> m_tierUpCounts; > > Vector<Vector<UnlinkedWasmToWasmCall>> m_unlinkedWasmToWasmCalls; >+ StreamingParser m_streamingParser; > State m_state; > > const AsyncWork m_asyncWork; >diff --git a/Source/JavaScriptCore/wasm/WasmModuleParser.cpp b/Source/JavaScriptCore/wasm/WasmModuleParser.cpp >deleted file mode 100644 >index 225dba63138c25a5eabe6ab222a3fb4b4dc191bd..0000000000000000000000000000000000000000 >--- a/Source/JavaScriptCore/wasm/WasmModuleParser.cpp >+++ /dev/null >@@ -1,109 +0,0 @@ >-/* >- * Copyright (C) 2016-2018 Apple Inc. All rights reserved. >- * >- * Redistribution and use in source and binary forms, with or without >- * modification, are permitted provided that the following conditions >- * are met: >- * 1. Redistributions of source code must retain the above copyright >- * notice, this list of conditions and the following disclaimer. >- * 2. Redistributions in binary form must reproduce the above copyright >- * notice, this list of conditions and the following disclaimer in the >- * documentation and/or other materials provided with the distribution. >- * >- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY >- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE >- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR >- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, >- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, >- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR >- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY >- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT >- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE >- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. >- */ >- >-#include "config.h" >-#include "WasmModuleParser.h" >- >-#if ENABLE(WEBASSEMBLY) >- >-#include "IdentifierInlines.h" >-#include "WasmMemoryInformation.h" >-#include "WasmNameSectionParser.h" >-#include "WasmOps.h" >-#include "WasmSectionParser.h" >-#include "WasmSections.h" >- >-namespace JSC { namespace Wasm { >- >-auto ModuleParser::parse() -> Result >-{ >- const size_t minSize = 8; >- uint32_t versionNumber; >- >- WASM_PARSER_FAIL_IF(length() < minSize, "expected a module of at least ", minSize, " bytes"); >- WASM_PARSER_FAIL_IF(length() > maxModuleSize, "module size ", length(), " is too large, maximum ", maxModuleSize); >- WASM_PARSER_FAIL_IF(!consumeCharacter(0) || !consumeString("asm"), "modules doesn't start with '\\0asm'"); >- WASM_PARSER_FAIL_IF(!parseUInt32(versionNumber), "can't parse version number"); >- WASM_PARSER_FAIL_IF(versionNumber != expectedVersionNumber, "unexpected version number ", versionNumber, " expected ", expectedVersionNumber); >- >- // This is not really a known section. >- Section previousKnownSection = Section::Begin; >- while (m_offset < length()) { >- uint8_t sectionByte; >- >- WASM_PARSER_FAIL_IF(!parseUInt7(sectionByte), "can't get section byte"); >- >- Section section = Section::Custom; >- WASM_PARSER_FAIL_IF(!decodeSection(sectionByte, section)); >- ASSERT(section != Section::Begin); >- >- uint32_t sectionLength; >- WASM_PARSER_FAIL_IF(!validateOrder(previousKnownSection, section), "invalid section order, ", previousKnownSection, " followed by ", section); >- WASM_PARSER_FAIL_IF(!parseVarUInt32(sectionLength), "can't get ", section, " section's length"); >- WASM_PARSER_FAIL_IF(sectionLength > length() - m_offset, section, " section of size ", sectionLength, " would overflow Module's size"); >- >- SectionParser parser(source() + m_offset, sectionLength, m_offset, m_info.get()); >- >- switch (section) { >-#define WASM_SECTION_PARSE(NAME, ID, DESCRIPTION) \ >- case Section::NAME: { \ >- WASM_FAIL_IF_HELPER_FAILS(parser.parse ## NAME()); \ >- break; \ >- } >- FOR_EACH_KNOWN_WASM_SECTION(WASM_SECTION_PARSE) >-#undef WASM_SECTION_PARSE >- >- case Section::Custom: { >- WASM_FAIL_IF_HELPER_FAILS(parser.parseCustom()); >- break; >- } >- >- case Section::Begin: { >- RELEASE_ASSERT_NOT_REACHED(); >- break; >- } >- } >- >- WASM_PARSER_FAIL_IF(parser.length() != parser.offset(), "parsing ended before the end of ", section, " section"); >- >- m_offset += sectionLength; >- >- >- if (isKnownSection(section)) >- previousKnownSection = section; >- } >- >- if (UNLIKELY(Options::useEagerWebAssemblyModuleHashing())) { >- SHA1 hasher; >- hasher.addBytes(source(), length()); >- m_info->nameSection->setHash(hasher.computeHexDigest()); >- } >- >- return { }; >-} >- >-} } // namespace JSC::Wasm >- >-#endif // ENABLE(WEBASSEMBLY) >diff --git a/Source/JavaScriptCore/wasm/WasmModuleParser.h b/Source/JavaScriptCore/wasm/WasmModuleParser.h >deleted file mode 100644 >index d33b77953373db27f15199d9804080f09296edb9..0000000000000000000000000000000000000000 >--- a/Source/JavaScriptCore/wasm/WasmModuleParser.h >+++ /dev/null >@@ -1,54 +0,0 @@ >-/* >- * Copyright (C) 2016 Apple Inc. All rights reserved. >- * >- * Redistribution and use in source and binary forms, with or without >- * modification, are permitted provided that the following conditions >- * are met: >- * 1. Redistributions of source code must retain the above copyright >- * notice, this list of conditions and the following disclaimer. >- * 2. Redistributions in binary form must reproduce the above copyright >- * notice, this list of conditions and the following disclaimer in the >- * documentation and/or other materials provided with the distribution. >- * >- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY >- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE >- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR >- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, >- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, >- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR >- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY >- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT >- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE >- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. >- */ >- >-#pragma once >- >-#if ENABLE(WEBASSEMBLY) >- >-#include "WasmFormat.h" >-#include "WasmOps.h" >-#include "WasmParser.h" >-#include <wtf/Optional.h> >-#include <wtf/Vector.h> >- >-namespace JSC { namespace Wasm { >- >-class ModuleParser : public Parser<void> { >-public: >- ModuleParser(const uint8_t* sourceBuffer, size_t sourceLength, ModuleInformation& info) >- : Parser(sourceBuffer, sourceLength) >- , m_info(info) >- { >- } >- >- Result WARN_UNUSED_RETURN parse(); >- >-private: >- Ref<ModuleInformation> m_info; >-}; >- >-} } // namespace JSC::Wasm >- >-#endif // ENABLE(WEBASSEMBLY) >diff --git a/Source/JavaScriptCore/wasm/WasmOMGPlan.cpp b/Source/JavaScriptCore/wasm/WasmOMGPlan.cpp >index 9e0c4a5666e44e0eacc2312abbb765453b879f48..c1a1d0a209a47039aa23c2844f1e93e6902772b2 100644 >--- a/Source/JavaScriptCore/wasm/WasmOMGPlan.cpp >+++ b/Source/JavaScriptCore/wasm/WasmOMGPlan.cpp >@@ -76,11 +76,11 @@ void OMGPlan::work(CompilationEffort) > > SignatureIndex signatureIndex = m_moduleInformation->internalFunctionSignatureIndices[m_functionIndex]; > const Signature& signature = SignatureInformation::get(signatureIndex); >- ASSERT(validateFunction(function.data.data(), function.data.size(), signature, m_moduleInformation.get())); >+ ASSERT(validateFunction(function, signature, m_moduleInformation.get())); > > Vector<UnlinkedWasmToWasmCall> unlinkedCalls; > CompilationContext context; >- auto parseAndCompileResult = parseAndCompile(context, function.data.data(), function.data.size(), signature, unlinkedCalls, m_moduleInformation.get(), m_mode, CompilationMode::OMGMode, m_functionIndex); >+ auto parseAndCompileResult = parseAndCompile(context, function, signature, unlinkedCalls, m_moduleInformation.get(), m_mode, CompilationMode::OMGMode, m_functionIndex); > > if (UNLIKELY(!parseAndCompileResult)) { > fail(holdLock(m_lock), makeString(parseAndCompileResult.error(), "when trying to tier up ", String::number(m_functionIndex))); >diff --git a/Source/JavaScriptCore/wasm/WasmPlan.cpp b/Source/JavaScriptCore/wasm/WasmPlan.cpp >index 9974ecfe55baf289eec565066a1cd49ae23a820a..e65f707396eca0a1477732add343c1947d05e2db 100644 >--- a/Source/JavaScriptCore/wasm/WasmPlan.cpp >+++ b/Source/JavaScriptCore/wasm/WasmPlan.cpp >@@ -35,7 +35,6 @@ > #include "WasmCallingConvention.h" > #include "WasmFaultSignalHandler.h" > #include "WasmMemory.h" >-#include "WasmModuleParser.h" > #include "WasmValidate.h" > #include <wtf/DataLog.h> > #include <wtf/Locker.h> >@@ -131,6 +130,9 @@ bool Plan::tryRemoveContextAndCancelIfLast(Context& context) > > void Plan::fail(const AbstractLocker& locker, String&& errorMessage) > { >+ ASSERT(errorMessage); >+ if (failed()) >+ return; > dataLogLnIf(WasmPlanInternal::verbose, "failing with message: ", errorMessage); > m_errorMessage = WTFMove(errorMessage); > complete(locker); >diff --git a/Source/JavaScriptCore/wasm/WasmSectionParser.cpp b/Source/JavaScriptCore/wasm/WasmSectionParser.cpp >index 9a9bacb67ded2504535d8c2de5c5ed833def1602..5c07b7a9d2f718f473c5b36dbb7d5de75d7f4fac 100644 >--- a/Source/JavaScriptCore/wasm/WasmSectionParser.cpp >+++ b/Source/JavaScriptCore/wasm/WasmSectionParser.cpp >@@ -399,29 +399,10 @@ auto SectionParser::parseElement() -> PartialResult > return { }; > } > >-// This function will be changed to be RELEASE_ASSERT_NOT_REACHED once we switch our parsing infrastructure to the streaming parser. > auto SectionParser::parseCode() -> PartialResult > { >- uint32_t count; >- WASM_PARSER_FAIL_IF(!parseVarUInt32(count), "can't get Code section's count"); >- WASM_PARSER_FAIL_IF(count == std::numeric_limits<uint32_t>::max(), "Code section's count is too big ", count); >- WASM_PARSER_FAIL_IF(count != m_info->functions.size(), "Code section count ", count, " exceeds the declared number of functions ", m_info->functions.size()); >- >- for (uint32_t i = 0; i < count; ++i) { >- uint32_t functionSize; >- WASM_PARSER_FAIL_IF(!parseVarUInt32(functionSize), "can't get ", i, "th Code function's size"); >- WASM_PARSER_FAIL_IF(functionSize > length(), "Code function's size ", functionSize, " exceeds the module's size ", length()); >- WASM_PARSER_FAIL_IF(functionSize > length() - m_offset, "Code function's size ", functionSize, " exceeds the module's remaining size", length() - m_offset); >- WASM_PARSER_FAIL_IF(functionSize > maxFunctionSize, "Code function's size ", functionSize, " is too big"); >- >- Vector<uint8_t> data(functionSize); >- std::memcpy(data.data(), source() + m_offset, functionSize); >- m_info->functions[i].start = m_offsetInSource + m_offset; >- m_info->functions[i].end = m_offsetInSource + m_offset + functionSize; >- m_info->functions[i].data = WTFMove(data); >- m_offset += functionSize; >- } >- >+ // The Code section is handled specially in StreamingParser. >+ RELEASE_ASSERT_NOT_REACHED(); > return { }; > } > >diff --git a/Source/JavaScriptCore/wasm/WasmStreamingParser.cpp b/Source/JavaScriptCore/wasm/WasmStreamingParser.cpp >index 9f372601d51332be25e07e0518235994eb4c0899..c958b914317bd5f9ae4d2eb2bfdf06591fbb6015 100644 >--- a/Source/JavaScriptCore/wasm/WasmStreamingParser.cpp >+++ b/Source/JavaScriptCore/wasm/WasmStreamingParser.cpp >@@ -28,7 +28,6 @@ > > #if ENABLE(WEBASSEMBLY) > >-#include "WasmModuleParser.h" > #include "WasmSectionParser.h" > #include <wtf/UnalignedAccess.h> > >@@ -66,8 +65,9 @@ NEVER_INLINE auto WARN_UNUSED_RETURN StreamingParser::fail(Args... args) -> Stat > return State::FatalError; > } > >-StreamingParser::StreamingParser(ModuleInformation& info) >+StreamingParser::StreamingParser(ModuleInformation& info, StreamingParserClient& client) > : m_info(info) >+ , m_client(client) > { > dataLogLnIf(WasmStreamingParserInternal::verbose, "starting validation"); > } >@@ -118,6 +118,7 @@ auto StreamingParser::parseCodeSectionSize(uint32_t functionCount) -> State > > if (m_functionIndex == m_functionCount) { > WASM_PARSER_FAIL_IF((m_codeOffset + m_sectionLength) != m_nextOffset, "parsing ended before the end of ", m_section, " section"); >+ m_client.didParseSection(m_section); > return State::SectionID; > } > return State::FunctionSize; >@@ -137,9 +138,12 @@ auto StreamingParser::parseFunctionPayload(Vector<uint8_t>&& data) -> State > function.end = m_offset + m_functionSize; > function.data = WTFMove(data); > dataLogLnIf(WasmStreamingParserInternal::verbose, "Processing function starting at: ", function.start, " and ending at: ", function.end); >+ m_client.didParseFunction(m_functionIndex, function); > ++m_functionIndex; >+ > if (m_functionIndex == m_functionCount) { > WASM_PARSER_FAIL_IF((m_codeOffset + m_sectionLength) != (m_offset + m_functionSize), "parsing ended before the end of ", m_section, " section"); >+ m_client.didParseSection(m_section); > return State::SectionID; > } > return State::FunctionSize; >@@ -170,6 +174,7 @@ auto StreamingParser::parseSectionPayload(Vector<uint8_t>&& data) -> State > > WASM_PARSER_FAIL_IF(parser.length() != parser.offset(), "parsing ended before the end of ", m_section, " section"); > >+ m_client.didParseSection(m_section); > return State::SectionID; > } > >@@ -380,6 +385,7 @@ auto StreamingParser::finalize() -> State > if (UNLIKELY(Options::useEagerWebAssemblyModuleHashing())) > m_info->nameSection->setHash(m_hasher.computeHexDigest()); > m_state = State::Finished; >+ m_client.didFinishParsing(); > } else > m_state = failOnState(State::SectionID); > break; >diff --git a/Source/JavaScriptCore/wasm/WasmStreamingParser.h b/Source/JavaScriptCore/wasm/WasmStreamingParser.h >index 1fbb6b22b3559af038b804f125a7efa5a9a5d818..9f17e28bffa413ce7c50f388313239e2cba2e7f8 100644 >--- a/Source/JavaScriptCore/wasm/WasmStreamingParser.h >+++ b/Source/JavaScriptCore/wasm/WasmStreamingParser.h >@@ -39,6 +39,10 @@ > namespace JSC { namespace Wasm { > > class StreamingParserClient { >+public: >+ virtual void didParseSection(Section) { } >+ virtual void didParseFunction(unsigned, const FunctionData&) { } >+ virtual void didFinishParsing() { } > }; > > class StreamingParser { >@@ -69,7 +73,7 @@ class StreamingParser { > > enum class IsEndOfStream { Yes, No }; > >- StreamingParser(ModuleInformation&); >+ StreamingParser(ModuleInformation&, StreamingParserClient&); > > State addBytes(const uint8_t* bytes, size_t length) { return addBytes(bytes, length, IsEndOfStream::No); } > State finalize(); >@@ -99,6 +103,7 @@ class StreamingParser { > State failOnState(State); > > Ref<ModuleInformation> m_info; >+ StreamingParserClient& m_client; > Vector<uint8_t> m_remaining; > String m_errorMessage; > >diff --git a/Source/JavaScriptCore/wasm/WasmValidate.cpp b/Source/JavaScriptCore/wasm/WasmValidate.cpp >index ea4a7598fa049544f87684a50e3cfcb913108eaf..0127372f23c5baced2bbbdaf4d350a3e54429160 100644 >--- a/Source/JavaScriptCore/wasm/WasmValidate.cpp >+++ b/Source/JavaScriptCore/wasm/WasmValidate.cpp >@@ -377,10 +377,10 @@ void Validate::dump(const Vector<ControlEntry>& controlStack, const ExpressionLi > dataLogLn(); > } > >-Expected<void, String> validateFunction(const uint8_t* source, size_t length, const Signature& signature, const ModuleInformation& module) >+Expected<void, String> validateFunction(const FunctionData& function, const Signature& signature, const ModuleInformation& module) > { > Validate context(module); >- FunctionParser<Validate> validator(context, source, length, signature, module); >+ FunctionParser<Validate> validator(context, function.data.data(), function.data.size(), signature, module); > WASM_FAIL_IF_HELPER_FAILS(validator.parse()); > return { }; > } >diff --git a/Source/JavaScriptCore/wasm/WasmValidate.h b/Source/JavaScriptCore/wasm/WasmValidate.h >index 28283cfea82af9141cbb0a930de02993a9905ab1..a952aac68a82f890fce929b62e78065338f02d26 100644 >--- a/Source/JavaScriptCore/wasm/WasmValidate.h >+++ b/Source/JavaScriptCore/wasm/WasmValidate.h >@@ -34,7 +34,7 @@ namespace JSC { > > namespace Wasm { > >-Expected<void, String> validateFunction(const uint8_t*, size_t, const Signature&, const ModuleInformation&); >+Expected<void, String> validateFunction(const FunctionData&, const Signature&, const ModuleInformation&); > > } } // namespace JSC::Wasm > >diff --git a/JSTests/ChangeLog b/JSTests/ChangeLog >index 698a160967477c4f5501aea3ce8785dc33a4d755..3d8ec44ca8530a6f9b4061d23e4bad6d29afcc24 100644 >--- a/JSTests/ChangeLog >+++ b/JSTests/ChangeLog >@@ -1,3 +1,15 @@ >+2018-08-27 Yusuke Suzuki <yusukesuzuki@slowstart.org> >+ >+ [WebAssembly] Use StreamingParser in existing Wasm::BBQPlan >+ https://bugs.webkit.org/show_bug.cgi?id=189043 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ The offset performing the validation becomes a bit different. >+ The offset 0 is nice since it is the starting offset of the Module header signature compared to the offset 8. >+ >+ * wasm/js-api/version.js: >+ > 2018-08-27 Yusuke Suzuki <yusukesuzuki@slowstart.org> > > [WebAssembly] Parse wasm modules in a streaming fashion >diff --git a/JSTests/wasm/js-api/version.js b/JSTests/wasm/js-api/version.js >index 0486fcfddefd0821d39246cb6408734bfebf22e2..4d10e8c15d0e1d77946d87cee8d20f7220d9d24f 100644 >--- a/JSTests/wasm/js-api/version.js >+++ b/JSTests/wasm/js-api/version.js >@@ -5,5 +5,5 @@ > if (version === 1) > continue; > const emptyModuleArray = Uint8Array.of(0x0, 0x61, 0x73, 0x6d, version, 0x00, 0x00, 0x00); >- assert.throws(() => new WebAssembly.Module(emptyModuleArray), WebAssembly.CompileError, `WebAssembly.Module doesn't parse at byte 8: unexpected version number ${version} expected 1`); >+ assert.throws(() => new WebAssembly.Module(emptyModuleArray), WebAssembly.CompileError, `WebAssembly.Module doesn't parse at byte 0: unexpected version number ${version} expected 1`); > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 189043
:
348269
|
348287
|
348292
|
376631
|
377857