Log Message
Wasm error message should be cross-thread-copied https://bugs.webkit.org/show_bug.cgi?id=204143
Reviewed by Mark Lam. JSTests: * stress/wasm-error-message-cross-threads.js: Added. (f): Source/_javascript_Core: It is shared by multiple threads, so we should copy it via crossThreadCopy. * wasm/WasmCodeBlock.h: (JSC::Wasm::CodeBlock::errorMessage): * wasm/WasmEntryPlan.cpp: (JSC::Wasm::EntryPlan::parseAndValidateModule): * wasm/WasmPlan.h: (JSC::Wasm::Plan::errorMessage const): (JSC::Wasm::Plan::failed const): * wasm/WasmStreamingParser.h: (JSC::Wasm::StreamingParser::errorMessage const):
Modified Paths
- trunk/JSTests/ChangeLog
- trunk/Source/_javascript_Core/ChangeLog
- trunk/Source/_javascript_Core/wasm/WasmCodeBlock.h
- trunk/Source/_javascript_Core/wasm/WasmEntryPlan.cpp
- trunk/Source/_javascript_Core/wasm/WasmPlan.h
- trunk/Source/_javascript_Core/wasm/WasmStreamingParser.h
Added Paths
Diff
Modified: trunk/JSTests/ChangeLog (252512 => 252513)
--- trunk/JSTests/ChangeLog 2019-11-16 00:42:43 UTC (rev 252512)
+++ trunk/JSTests/ChangeLog 2019-11-16 00:44:30 UTC (rev 252513)
@@ -1,3 +1,13 @@
+2019-11-15 Yusuke Suzuki <[email protected]>
+
+ Wasm error message should be cross-thread-copied
+ https://bugs.webkit.org/show_bug.cgi?id=204143
+
+ Reviewed by Mark Lam.
+
+ * stress/wasm-error-message-cross-threads.js: Added.
+ (f):
+
2019-11-14 Alexey Shvayka <[email protected]>
Use toLength() and getIndexQuickly() in JSON.stringify
Added: trunk/JSTests/stress/wasm-error-message-cross-threads.js (0 => 252513)
--- trunk/JSTests/stress/wasm-error-message-cross-threads.js (rev 0)
+++ trunk/JSTests/stress/wasm-error-message-cross-threads.js 2019-11-16 00:44:30 UTC (rev 252513)
@@ -0,0 +1,18 @@
+var counter = 0;
+obj1 = {[Symbol.asyncIterator]:[-4.0,0x1e3],[Symbol.search]:[-5.0,4294967297,-5.0],"construct":Uint8ClampedArray.__proto__,[Symbol.replace]:WeakSet,[Symbol.species]:()=>null,9007199254740992:[0,64,"length",,"deleteProperty",2147483648,,"symbol",4294967297,"get",128,Symbol.toPrimitive],"Q":6};
+buffer1 = new ArrayBuffer(2048);
+proxy1 = new Proxy(obj1,{get:f,deleteProperty:f,get:encodeURI});
+wasmCode1=new Uint8Array([0x00,0x61,0x73,0x6d,0x01,0x00,0x00,0x00,2,1,3,3,81,97,88,78,66,80,69,103,7,109,111,100,117,108,101,57,1,84,66,98,1,0x70,1,0b11111011,0b10111001,0b1101100,2,7,109,111,100,117,108,101,52,7,109,111,100,117,108,101,56,6,102,105,101,108,100,54,2,0,0b10010111,0b10110010,0b11011101,0b11101110,0b1000100,5,122,1,110,0,1,0x70,1,5,3,9,0b10111001,0b11110101,0b11001010,0b0010101,2,0,0x43,767132387,0x0b,5,2,0,2,0b1110000,0b1000001,0b11101101,0b1000111,0x23,0b10111011,0b11001100,0b10110011,0b0011001,0x0b,5,1,0,0b10100100,0b1101000,3,1,0b11011111,0b11000011,0b0011010,1,0x60,4,0x7c,0x7f,0x7e,0x7e,1,0x7d,3,5,4,1,0b11000101,0b10100011,0b11011110,0b0100010,2,3,8,1,3]);
+function f ( ) {
+;
+if (counter++ > 10000)
+ return;
+let o = buffer1 ;
+for ( let i in (WebAssembly.compile(wasmCode1)).catch(f) ){ ;
+for ( i of "Symbol.split" ){ ;
+} ;
+
+Date.prototype.toString.call(proxy1 );; ;
+} ;
+} ;
+( f ) ( ) ;
Modified: trunk/Source/_javascript_Core/ChangeLog (252512 => 252513)
--- trunk/Source/_javascript_Core/ChangeLog 2019-11-16 00:42:43 UTC (rev 252512)
+++ trunk/Source/_javascript_Core/ChangeLog 2019-11-16 00:44:30 UTC (rev 252513)
@@ -1,3 +1,22 @@
+2019-11-15 Yusuke Suzuki <[email protected]>
+
+ Wasm error message should be cross-thread-copied
+ https://bugs.webkit.org/show_bug.cgi?id=204143
+
+ Reviewed by Mark Lam.
+
+ It is shared by multiple threads, so we should copy it via crossThreadCopy.
+
+ * wasm/WasmCodeBlock.h:
+ (JSC::Wasm::CodeBlock::errorMessage):
+ * wasm/WasmEntryPlan.cpp:
+ (JSC::Wasm::EntryPlan::parseAndValidateModule):
+ * wasm/WasmPlan.h:
+ (JSC::Wasm::Plan::errorMessage const):
+ (JSC::Wasm::Plan::failed const):
+ * wasm/WasmStreamingParser.h:
+ (JSC::Wasm::StreamingParser::errorMessage const):
+
2019-11-15 Mark Lam <[email protected]>
Rename InPlaceAbstractState's m_foundConstant to m_shouldTryConstantFolding.
Modified: trunk/Source/_javascript_Core/wasm/WasmCodeBlock.h (252512 => 252513)
--- trunk/Source/_javascript_Core/wasm/WasmCodeBlock.h 2019-11-16 00:42:43 UTC (rev 252512)
+++ trunk/Source/_javascript_Core/wasm/WasmCodeBlock.h 2019-11-16 00:44:30 UTC (rev 252513)
@@ -30,6 +30,7 @@
#include "MacroAssemblerCodeRef.h"
#include "WasmCallee.h"
#include "WasmEmbedder.h"
+#include <wtf/CrossThreadCopier.h>
#include <wtf/Lock.h>
#include <wtf/RefPtr.h>
#include <wtf/SharedTask.h>
@@ -68,8 +69,7 @@
String errorMessage()
{
ASSERT(!runnable());
- CString cString = m_errorMessage.ascii();
- return String(cString.data());
+ return crossThreadCopy(m_errorMessage);
}
unsigned functionImportCount() const { return m_wasmToWasmExitStubs.size(); }
Modified: trunk/Source/_javascript_Core/wasm/WasmEntryPlan.cpp (252512 => 252513)
--- trunk/Source/_javascript_Core/wasm/WasmEntryPlan.cpp 2019-11-16 00:42:43 UTC (rev 252512)
+++ trunk/Source/_javascript_Core/wasm/WasmEntryPlan.cpp 2019-11-16 00:44:30 UTC (rev 252513)
@@ -31,6 +31,7 @@
#include "WasmMemory.h"
#include "WasmSignatureInlines.h"
#include "WasmValidate.h"
+#include <wtf/CrossThreadCopier.h>
#include <wtf/DataLog.h>
#include <wtf/Locker.h>
#include <wtf/MonotonicTime.h>
@@ -136,7 +137,7 @@
}
if (m_streamingParser.finalize() != StreamingParser::State::Finished) {
- fail(holdLock(m_lock), String(m_streamingParser.errorMessage()));
+ fail(holdLock(m_lock), m_streamingParser.errorMessage());
return false;
}
Modified: trunk/Source/_javascript_Core/wasm/WasmPlan.h (252512 => 252513)
--- trunk/Source/_javascript_Core/wasm/WasmPlan.h 2019-11-16 00:42:43 UTC (rev 252512)
+++ trunk/Source/_javascript_Core/wasm/WasmPlan.h 2019-11-16 00:44:30 UTC (rev 252513)
@@ -32,6 +32,7 @@
#include "WasmEmbedder.h"
#include "WasmModuleInformation.h"
#include <wtf/Bag.h>
+#include <wtf/CrossThreadCopier.h>
#include <wtf/SharedTask.h>
#include <wtf/ThreadSafeRefCounted.h>
#include <wtf/Vector.h>
@@ -64,9 +65,9 @@
void setMode(MemoryMode mode) { m_mode = mode; }
MemoryMode mode() const { return m_mode; }
- const String& errorMessage() const { return m_errorMessage; }
+ String errorMessage() const { return crossThreadCopy(m_errorMessage); }
- bool WARN_UNUSED_RETURN failed() const { return !errorMessage().isNull(); }
+ bool WARN_UNUSED_RETURN failed() const { return !m_errorMessage.isNull(); }
virtual bool hasWork() const = 0;
enum CompilationEffort { All, Partial };
virtual void work(CompilationEffort = All) = 0;
Modified: trunk/Source/_javascript_Core/wasm/WasmStreamingParser.h (252512 => 252513)
--- trunk/Source/_javascript_Core/wasm/WasmStreamingParser.h 2019-11-16 00:42:43 UTC (rev 252512)
+++ trunk/Source/_javascript_Core/wasm/WasmStreamingParser.h 2019-11-16 00:44:30 UTC (rev 252513)
@@ -30,6 +30,7 @@
#include "WasmModuleInformation.h"
#include "WasmParser.h"
#include "WasmSections.h"
+#include <wtf/CrossThreadCopier.h>
#include <wtf/SHA1.h>
#include <wtf/Vector.h>
#include <wtf/text/WTFString.h>
@@ -77,7 +78,7 @@
State addBytes(const uint8_t* bytes, size_t length) { return addBytes(bytes, length, IsEndOfStream::No); }
State finalize();
- const String& errorMessage() const { return m_errorMessage; }
+ String errorMessage() const { return crossThreadCopy(m_errorMessage); }
void reportError() { moveToStateIfNotFailed(failOnState(State::FatalError)); }
_______________________________________________ webkit-changes mailing list [email protected] https://lists.webkit.org/mailman/listinfo/webkit-changes
