Changeset 253314 in webkit
- Timestamp:
- Dec 9, 2019 5:54:07 PM (4 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 2 deleted
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r253303 r253314 1 2019-12-09 Tadeu Zagallo <tzagallo@apple.com> 2 3 [WebAssembly] Remove WasmValidate 4 https://bugs.webkit.org/show_bug.cgi?id=205037 5 6 Reviewed by Saam Barati. 7 8 It's currently only used when JSC_useWasmLLInt is false and it creates an additional instantiation 9 of Wasm::FunctionParser, which adds about 100kb to the binary size. This does not introduce any 10 behavior changes with the default options, but it means that we'll generate bytecode when calling 11 WebAssembly.validate/new WebAssembly.Module even when the WasmLLInt is disabled. 12 13 * JavaScriptCore.xcodeproj/project.pbxproj: 14 * Sources.txt: 15 * wasm/WasmBBQPlan.cpp: 16 (JSC::Wasm::BBQPlan::didReceiveFunctionData): 17 * wasm/WasmEntryPlan.cpp: 18 * wasm/WasmLLIntPlan.cpp: 19 * wasm/WasmModule.cpp: 20 (JSC::Wasm::makeValidationResult): 21 (JSC::Wasm::makeValidationCallback): 22 (JSC::Wasm::Module::validateSync): 23 (JSC::Wasm::Module::validateAsync): 24 * wasm/WasmModule.h: 25 * wasm/WasmOMGForOSREntryPlan.cpp: 26 (JSC::Wasm::OMGForOSREntryPlan::work): 27 * wasm/WasmOMGPlan.cpp: 28 (JSC::Wasm::OMGPlan::work): 29 * wasm/WasmPlan.cpp: 30 * wasm/WasmValidate.cpp: Removed. 31 * wasm/WasmValidate.h: Removed. 32 1 33 2019-12-09 Tadeu Zagallo <tzagallo@apple.com> 2 34 -
trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
r253263 r253314 1116 1116 53FA2AE11CF37F3F0022711D /* LLIntPrototypeLoadAdaptiveStructureWatchpoint.h in Headers */ = {isa = PBXBuildFile; fileRef = 53FA2AE01CF37F3F0022711D /* LLIntPrototypeLoadAdaptiveStructureWatchpoint.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1117 1117 53FD04D41D7AB291003287D3 /* WasmCallingConvention.h in Headers */ = {isa = PBXBuildFile; fileRef = 53FD04D21D7AB187003287D3 /* WasmCallingConvention.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1118 53FF7F991DBFCD9000A26CCC /* WasmValidate.h in Headers */ = {isa = PBXBuildFile; fileRef = 53FF7F981DBFCD9000A26CCC /* WasmValidate.h */; };1119 1118 5B70CFDE1DB69E6600EC23F9 /* JSAsyncFunction.h in Headers */ = {isa = PBXBuildFile; fileRef = 5B70CFD81DB69E5C00EC23F9 /* JSAsyncFunction.h */; }; 1120 1119 5B70CFE01DB69E6600EC23F9 /* AsyncFunctionPrototype.h in Headers */ = {isa = PBXBuildFile; fileRef = 5B70CFDA1DB69E5C00EC23F9 /* AsyncFunctionPrototype.h */; }; … … 3820 3819 53FD04D11D7AB187003287D3 /* WasmCallingConvention.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WasmCallingConvention.cpp; sourceTree = "<group>"; }; 3821 3820 53FD04D21D7AB187003287D3 /* WasmCallingConvention.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WasmCallingConvention.h; sourceTree = "<group>"; }; 3822 53FF7F981DBFCD9000A26CCC /* WasmValidate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WasmValidate.h; sourceTree = "<group>"; };3823 53FF7F9A1DBFD2B900A26CCC /* WasmValidate.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WasmValidate.cpp; sourceTree = "<group>"; };3824 3821 5B70CFD81DB69E5C00EC23F9 /* JSAsyncFunction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSAsyncFunction.h; sourceTree = "<group>"; }; 3825 3822 5B70CFD91DB69E5C00EC23F9 /* JSAsyncFunction.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSAsyncFunction.cpp; sourceTree = "<group>"; }; … … 6869 6866 E3C694B223026874006FBE42 /* WasmTierUpCount.cpp */, 6870 6867 53E9E0AE1EAEC45700FEE251 /* WasmTierUpCount.h */, 6871 53FF7F9A1DBFD2B900A26CCC /* WasmValidate.cpp */,6872 53FF7F981DBFCD9000A26CCC /* WasmValidate.h */,6873 6868 530FB3031E7A1146003C19DD /* WasmWorklist.cpp */, 6874 6869 530FB3011E7A0B6E003C19DD /* WasmWorklist.h */, … … 10299 10294 53E9E0AF1EAEC45700FEE251 /* WasmTierUpCount.h in Headers */, 10300 10295 AD5C36EC1F75AD7C000BCAAF /* WasmToJS.h in Headers */, 10301 53FF7F991DBFCD9000A26CCC /* WasmValidate.h in Headers */,10302 10296 530FB3021E7A0B6E003C19DD /* WasmWorklist.h in Headers */, 10303 10297 FED94F2F171E3E2300BE77A4 /* Watchdog.h in Headers */, -
trunk/Source/JavaScriptCore/Sources.txt
r253097 r253314 1039 1039 wasm/WasmThunks.cpp 1040 1040 wasm/WasmTierUpCount.cpp 1041 wasm/WasmValidate.cpp1042 1041 wasm/WasmWorklist.cpp 1043 1042 -
trunk/Source/JavaScriptCore/wasm/WasmBBQPlan.cpp
r253188 r253314 41 41 #include "WasmSignatureInlines.h" 42 42 #include "WasmTierUpCount.h" 43 #include "WasmValidate.h"44 43 #include <wtf/DataLog.h> 45 44 #include <wtf/Locker.h> … … 223 222 unsigned functionIndexSpace = m_moduleInformation->importFunctionCount() + functionIndex; 224 223 ASSERT_UNUSED(functionIndexSpace, m_moduleInformation->signatureIndexFromFunctionIndexSpace(functionIndexSpace) == signatureIndex); 225 ASSERT(validateFunction(function, signature, m_moduleInformation.get()));226 224 Expected<std::unique_ptr<InternalFunction>, String> parseAndCompileResult; 227 225 unsigned osrEntryScratchBufferSize = 0; … … 318 316 } 319 317 320 bool BBQPlan::didReceiveFunctionData(unsigned functionIndex, const FunctionData& function) 321 { 322 dataLogLnIf(WasmBBQPlanInternal::verbose, "Processing function starting at: ", function.start, " and ending at: ", function.end); 323 size_t functionLength = function.end - function.start; 324 ASSERT(functionLength == function.data.size()); 325 SignatureIndex signatureIndex = m_moduleInformation->internalFunctionSignatureIndices[functionIndex]; 326 const Signature& signature = SignatureInformation::get(signatureIndex); 327 328 auto validationResult = validateFunction(function, signature, m_moduleInformation.get()); 329 if (!validationResult) { 330 if (WasmBBQPlanInternal::verbose) { 331 for (unsigned i = 0; i < functionLength; ++i) 332 dataLog(RawPointer(reinterpret_cast<void*>(function.data[i])), ", "); 333 dataLogLn(); 334 } 335 fail(holdLock(m_lock), makeString(validationResult.error(), ", in function at index ", String::number(functionIndex))); // FIXME make this an Expected. 336 } 337 return !!validationResult; 318 bool BBQPlan::didReceiveFunctionData(unsigned, const FunctionData&) 319 { 320 return true; 338 321 } 339 322 -
trunk/Source/JavaScriptCore/wasm/WasmEntryPlan.cpp
r253140 r253314 31 31 #include "WasmMemory.h" 32 32 #include "WasmSignatureInlines.h" 33 #include "WasmValidate.h"34 33 #include <wtf/CrossThreadCopier.h> 35 34 #include <wtf/DataLog.h> -
trunk/Source/JavaScriptCore/wasm/WasmLLIntPlan.cpp
r253168 r253314 38 38 #include "WasmLLIntGenerator.h" 39 39 #include "WasmSignatureInlines.h" 40 #include "WasmValidate.h"41 40 42 41 namespace JSC { namespace Wasm { -
trunk/Source/JavaScriptCore/wasm/WasmModule.cpp
r253188 r253314 43 43 } 44 44 45 Module::Module(BBQPlan& plan)46 : m_moduleInformation(plan.takeModuleInformation())47 {48 }49 50 45 Module::~Module() { } 51 46 … … 55 50 } 56 51 57 template<typename Plan> 58 static Module::ValidationResult makeValidationResult(Plan& plan) 52 static Module::ValidationResult makeValidationResult(LLIntPlan& plan) 59 53 { 60 54 ASSERT(!plan.hasWork()); … … 64 58 } 65 59 66 template<typename PlanT>67 60 static Plan::CompletionTask makeValidationCallback(Module::AsyncValidationCallback&& callback) 68 61 { 69 62 return createSharedTask<Plan::CallbackType>([callback = WTFMove(callback)] (Plan& plan) { 70 63 ASSERT(!plan.hasWork()); 71 callback->run(makeValidationResult(static_cast< PlanT&>(plan)));64 callback->run(makeValidationResult(static_cast<LLIntPlan&>(plan))); 72 65 }); 73 66 } … … 75 68 Module::ValidationResult Module::validateSync(Context* context, Vector<uint8_t>&& source) 76 69 { 77 if (Options::useWasmLLInt()) { 78 Ref<LLIntPlan> plan = adoptRef(*new LLIntPlan(context, WTFMove(source), EntryPlan::Validation, Plan::dontFinalize())); 79 Wasm::ensureWorklist().enqueue(plan.get()); 80 plan->waitForCompletion(); 81 return makeValidationResult(plan.get()); 82 } 83 84 Ref<BBQPlan> plan = adoptRef(*new BBQPlan(context, WTFMove(source), EntryPlan::Validation, Plan::dontFinalize())); 85 plan->parseAndValidateModule(); 70 Ref<LLIntPlan> plan = adoptRef(*new LLIntPlan(context, WTFMove(source), EntryPlan::Validation, Plan::dontFinalize())); 71 Wasm::ensureWorklist().enqueue(plan.get()); 72 plan->waitForCompletion(); 86 73 return makeValidationResult(plan.get()); 87 74 } … … 89 76 void Module::validateAsync(Context* context, Vector<uint8_t>&& source, Module::AsyncValidationCallback&& callback) 90 77 { 91 if (Options::useWasmLLInt()) { 92 Ref<Plan> plan = adoptRef(*new LLIntPlan(context, WTFMove(source), EntryPlan::Validation, makeValidationCallback<LLIntPlan>(WTFMove(callback)))); 93 Wasm::ensureWorklist().enqueue(WTFMove(plan)); 94 } else { 95 Ref<Plan> plan = adoptRef(*new BBQPlan(context, WTFMove(source), EntryPlan::Validation, makeValidationCallback<BBQPlan>(WTFMove(callback)))); 96 Wasm::ensureWorklist().enqueue(WTFMove(plan)); 97 } 78 Ref<Plan> plan = adoptRef(*new LLIntPlan(context, WTFMove(source), EntryPlan::Validation, makeValidationCallback(WTFMove(callback)))); 79 Wasm::ensureWorklist().enqueue(WTFMove(plan)); 98 80 } 99 81 -
trunk/Source/JavaScriptCore/wasm/WasmModule.h
r253188 r253314 38 38 namespace JSC { namespace Wasm { 39 39 40 class BBQPlan;41 40 class LLIntPlan; 42 41 struct Context; … … 53 52 static ValidationResult validateSync(Context*, Vector<uint8_t>&& source); 54 53 static void validateAsync(Context*, Vector<uint8_t>&& source, Module::AsyncValidationCallback&&); 55 56 static Ref<Module> create(BBQPlan& plan)57 {58 return adoptRef(*new Module(plan));59 }60 54 61 55 static Ref<Module> create(LLIntPlan& plan) … … 76 70 Ref<CodeBlock> getOrCreateCodeBlock(Context*, MemoryMode); 77 71 78 Module(BBQPlan&);79 72 Module(LLIntPlan&); 80 73 Ref<ModuleInformation> m_moduleInformation; -
trunk/Source/JavaScriptCore/wasm/WasmOMGForOSREntryPlan.cpp
r251886 r253314 41 41 #include "WasmNameSection.h" 42 42 #include "WasmSignatureInlines.h" 43 #include "WasmValidate.h"44 43 #include "WasmWorklist.h" 45 44 #include <wtf/DataLog.h> … … 80 79 SignatureIndex signatureIndex = m_moduleInformation->internalFunctionSignatureIndices[m_functionIndex]; 81 80 const Signature& signature = SignatureInformation::get(signatureIndex); 82 ASSERT(validateFunction(function, signature, m_moduleInformation.get()));83 81 84 82 Vector<UnlinkedWasmToWasmCall> unlinkedCalls; -
trunk/Source/JavaScriptCore/wasm/WasmOMGPlan.cpp
r253188 r253314 41 41 #include "WasmNameSection.h" 42 42 #include "WasmSignatureInlines.h" 43 #include "WasmValidate.h"44 43 #include "WasmWorklist.h" 45 44 #include <wtf/DataLog.h> … … 78 77 SignatureIndex signatureIndex = m_moduleInformation->internalFunctionSignatureIndices[m_functionIndex]; 79 78 const Signature& signature = SignatureInformation::get(signatureIndex); 80 ASSERT(validateFunction(function, signature, m_moduleInformation.get()));81 79 82 80 Vector<UnlinkedWasmToWasmCall> unlinkedCalls; -
trunk/Source/JavaScriptCore/wasm/WasmPlan.cpp
r253140 r253314 36 36 #include "WasmFaultSignalHandler.h" 37 37 #include "WasmMemory.h" 38 #include "WasmValidate.h"39 38 #include <wtf/DataLog.h> 40 39 #include <wtf/Locker.h>
Note: See TracChangeset
for help on using the changeset viewer.