Diff
Modified: trunk/JSTests/ChangeLog (262990 => 262991)
--- trunk/JSTests/ChangeLog 2020-06-13 00:06:42 UTC (rev 262990)
+++ trunk/JSTests/ChangeLog 2020-06-13 00:22:31 UTC (rev 262991)
@@ -1,3 +1,17 @@
+2020-06-12 Keith Miller <keith_mil...@apple.com>
+
+ Tests expecting a crash should use a signal handler in the JSC CLI process
+ https://bugs.webkit.org/show_bug.cgi?id=212479
+
+ Reviewed by Yusuke Suzuki.
+
+ * stress/ensure-crash.js:
+ * stress/incorrect-put-could-generate-invalid-ic-but-still-not-causing-bad-behavior-bad-transition-debug.js:
+ * stress/incorrect-put-could-generate-invalid-ic-but-still-not-causing-bad-behavior-bad-transition.js:
+ * stress/incorrect-put-could-generate-invalid-ic-but-still-not-causing-bad-behavior-debug.js: Removed.
+ * stress/incorrect-put-could-generate-invalid-ic-but-still-not-causing-bad-behavior.js:
+ * stress/incorrect-put-could-generate-invalid-ic-involving-dictionary-flatten-debug.js:
+
2020-06-12 Alexey Shvayka <shvaikal...@gmail.com>
AsyncGenerator should await "return" completions
Modified: trunk/JSTests/stress/ensure-crash.js (262990 => 262991)
--- trunk/JSTests/stress/ensure-crash.js 2020-06-13 00:06:42 UTC (rev 262990)
+++ trunk/JSTests/stress/ensure-crash.js 2020-06-13 00:22:31 UTC (rev 262991)
@@ -1,3 +1,6 @@
-//@ crash!
+//@ skip if ["arm", "mips"].include?($architecture)
+//@ crashOK!
$vm.crash();
+
+throw new Error();
Modified: trunk/JSTests/stress/incorrect-put-could-generate-invalid-ic-but-still-not-causing-bad-behavior-bad-transition-debug.js (262990 => 262991)
--- trunk/JSTests/stress/incorrect-put-could-generate-invalid-ic-but-still-not-causing-bad-behavior-bad-transition-debug.js 2020-06-13 00:06:42 UTC (rev 262990)
+++ trunk/JSTests/stress/incorrect-put-could-generate-invalid-ic-but-still-not-causing-bad-behavior-bad-transition-debug.js 2020-06-13 00:22:31 UTC (rev 262991)
@@ -1,5 +1,4 @@
-//@ skip if $buildType != "debug"
-//@ crash!
+//@ crashOK!
function shouldBe(actual, expected) {
if (actual !== expected)
throw new Error('bad value: ' + actual);
@@ -28,3 +27,6 @@
shouldBe(object._unsupported, "Hey");
}
shouldBe(counter, 1000);
+
+if ($vm.assertEnabled())
+ throw new Error();
Modified: trunk/JSTests/stress/incorrect-put-could-generate-invalid-ic-but-still-not-causing-bad-behavior-bad-transition.js (262990 => 262991)
--- trunk/JSTests/stress/incorrect-put-could-generate-invalid-ic-but-still-not-causing-bad-behavior-bad-transition.js 2020-06-13 00:06:42 UTC (rev 262990)
+++ trunk/JSTests/stress/incorrect-put-could-generate-invalid-ic-but-still-not-causing-bad-behavior-bad-transition.js 2020-06-13 00:22:31 UTC (rev 262991)
@@ -1,4 +1,4 @@
-//@ skip if $buildType == "debug"
+//@ crashOK!
function shouldBe(actual, expected) {
if (actual !== expected)
throw new Error('bad value: ' + actual);
Deleted: trunk/JSTests/stress/incorrect-put-could-generate-invalid-ic-but-still-not-causing-bad-behavior-debug.js (262990 => 262991)
--- trunk/JSTests/stress/incorrect-put-could-generate-invalid-ic-but-still-not-causing-bad-behavior-debug.js 2020-06-13 00:06:42 UTC (rev 262990)
+++ trunk/JSTests/stress/incorrect-put-could-generate-invalid-ic-but-still-not-causing-bad-behavior-debug.js 2020-06-13 00:22:31 UTC (rev 262991)
@@ -1,28 +0,0 @@
-//@ skip if $buildType != "debug"
-//@ crash!
-//@ runDefault("--useLLInt=true")
-
-function shouldBe(actual, expected) {
- if (actual !== expected)
- throw new Error('bad value: ' + actual);
-}
-
-var putter = function(o) {
- o._unsupported = not_string;
-}
-
-var object;
-var counter = 0;
-var not_string = {
- toString() {
- counter++;
- object.ok = 42;
- return "Hey";
- }
-};
-
-for (var i = 0; i < 1000; ++i) {
- object = $vm.createObjectDoingSideEffectPutWithoutCorrectSlotStatus();
- putter(object);
-}
-shouldBe(counter, 1000);
Modified: trunk/JSTests/stress/incorrect-put-could-generate-invalid-ic-but-still-not-causing-bad-behavior.js (262990 => 262991)
--- trunk/JSTests/stress/incorrect-put-could-generate-invalid-ic-but-still-not-causing-bad-behavior.js 2020-06-13 00:06:42 UTC (rev 262990)
+++ trunk/JSTests/stress/incorrect-put-could-generate-invalid-ic-but-still-not-causing-bad-behavior.js 2020-06-13 00:22:31 UTC (rev 262991)
@@ -1,8 +1,6 @@
-//@ skip if $buildType == "debug"
+//@ crashOK!
+//@ runDefault("--useLLInt=1")
-if ($vm.assertEnabled())
- quit();
-
function shouldBe(actual, expected) {
if (actual !== expected)
throw new Error('bad value: ' + actual);
@@ -27,3 +25,6 @@
putter(object);
}
shouldBe(counter, 1000);
+
+if ($vm.assertEnabled())
+ throw new Error();
Modified: trunk/JSTests/stress/incorrect-put-could-generate-invalid-ic-involving-dictionary-flatten-debug.js (262990 => 262991)
--- trunk/JSTests/stress/incorrect-put-could-generate-invalid-ic-involving-dictionary-flatten-debug.js 2020-06-13 00:06:42 UTC (rev 262990)
+++ trunk/JSTests/stress/incorrect-put-could-generate-invalid-ic-involving-dictionary-flatten-debug.js 2020-06-13 00:22:31 UTC (rev 262991)
@@ -1,5 +1,4 @@
-//@ skip if $buildType != "debug"
-//@ crash!
+//@ crashOK!
//@ runDefault("--useLLInt=true")
function shouldBe(actual, expected) {
@@ -33,3 +32,6 @@
putter(d);
shouldBe('p3' in d, false);
}
+
+if ($vm.assertEnabled())
+ throw new Error();
Modified: trunk/Source/_javascript_Core/ChangeLog (262990 => 262991)
--- trunk/Source/_javascript_Core/ChangeLog 2020-06-13 00:06:42 UTC (rev 262990)
+++ trunk/Source/_javascript_Core/ChangeLog 2020-06-13 00:22:31 UTC (rev 262991)
@@ -1,3 +1,19 @@
+2020-06-12 Keith Miller <keith_mil...@apple.com>
+
+ Tests expecting a crash should use a signal handler in the JSC CLI process
+ https://bugs.webkit.org/show_bug.cgi?id=212479
+
+ Reviewed by Yusuke Suzuki.
+
+ Have the -s option use WTF::Signals and make sure it adds breakpoint catching
+ as well.
+
+ * jsc.cpp:
+ (printUsageStatement):
+ (CommandLine::parseArguments):
+ * tools/SigillCrashAnalyzer.cpp:
+ (JSC::installCrashHandler):
+
2020-06-12 Alexey Shvayka <shvaikal...@gmail.com>
AsyncGenerator should await "return" completions
Modified: trunk/Source/_javascript_Core/jsc.cpp (262990 => 262991)
--- trunk/Source/_javascript_Core/jsc.cpp 2020-06-13 00:06:42 UTC (rev 262990)
+++ trunk/Source/_javascript_Core/jsc.cpp 2020-06-13 00:22:31 UTC (rev 262991)
@@ -83,6 +83,7 @@
#include <wtf/URL.h>
#include <wtf/WallTime.h>
#include <wtf/text/StringBuilder.h>
+#include <wtf/threads/Signals.h>
#if OS(WINDOWS)
#include <direct.h>
@@ -105,10 +106,6 @@
#undef Function
#endif
-#if HAVE(SIGNAL_H)
-#include <signal.h>
-#endif
-
#if COMPILER(MSVC)
#include <crtdbg.h>
#include <mmsystem.h>
@@ -2890,8 +2887,8 @@
fprintf(stderr, " -h|--help Prints this help message\n");
fprintf(stderr, " -i Enables interactive mode (default if no files are specified)\n");
fprintf(stderr, " -m Execute as a module\n");
-#if HAVE(SIGNAL_H)
- fprintf(stderr, " -s Installs signal handlers that exit on a crash (Unix platforms only)\n");
+#if USE(PTHREADS) && HAVE(MACHINE_CONTEXT)
+ fprintf(stderr, " -s Installs signal handlers that exit on a crash (Unix platforms only, lldb will not work with this option) \n");
#endif
fprintf(stderr, " -p <file> Outputs profiling data to a file\n");
fprintf(stderr, " -x Output exit code before terminating\n");
@@ -2982,11 +2979,18 @@
continue;
}
if (!strcmp(arg, "-s")) {
-#if HAVE(SIGNAL_H)
- signal(SIGILL, _exit);
- signal(SIGFPE, _exit);
- signal(SIGBUS, _exit);
- signal(SIGSEGV, _exit);
+#if USE(PTHREADS) && HAVE(MACHINE_CONTEXT)
+ SignalAction (*exit)(Signal, SigInfo&, PlatformRegisters&) = [] (Signal, SigInfo&, PlatformRegisters&) {
+ dataLogLn("Signal handler hit. Exiting with status 0");
+ _exit(0);
+ return SignalAction::ForceDefault;
+ };
+
+ installSignalHandler(Signal::IllegalInstruction, SignalHandler(exit));
+ installSignalHandler(Signal::AccessFault, SignalHandler(exit));
+ installSignalHandler(Signal::FloatingPoint, SignalHandler(exit));
+ // once we do this lldb won't work anymore because we will exit on any breakpoints it sets.
+ installSignalHandler(Signal::Breakpoint, SignalHandler(exit));
#endif
continue;
}
Modified: trunk/Source/_javascript_Core/tools/SigillCrashAnalyzer.cpp (262990 => 262991)
--- trunk/Source/_javascript_Core/tools/SigillCrashAnalyzer.cpp 2020-06-13 00:06:42 UTC (rev 262990)
+++ trunk/Source/_javascript_Core/tools/SigillCrashAnalyzer.cpp 2020-06-13 00:22:31 UTC (rev 262991)
@@ -156,7 +156,7 @@
static void installCrashHandler()
{
#if CPU(X86_64) || CPU(ARM64)
- installSignalHandler(Signal::Ill, [] (Signal, SigInfo&, PlatformRegisters& registers) {
+ installSignalHandler(Signal::IllegalInstruction, [] (Signal, SigInfo&, PlatformRegisters& registers) {
auto signalContext = SignalContext::tryCreate(registers);
if (!signalContext)
return SignalAction::NotHandled;
Modified: trunk/Source/WTF/ChangeLog (262990 => 262991)
--- trunk/Source/WTF/ChangeLog 2020-06-13 00:06:42 UTC (rev 262990)
+++ trunk/Source/WTF/ChangeLog 2020-06-13 00:22:31 UTC (rev 262991)
@@ -1,3 +1,22 @@
+2020-06-12 Keith Miller <keith_mil...@apple.com>
+
+ Tests expecting a crash should use a signal handler in the JSC CLI process
+ https://bugs.webkit.org/show_bug.cgi?id=212479
+
+ Reviewed by Yusuke Suzuki.
+
+ Add signals for floating point exceptions and breakpoints. There's a
+ note for breakpoints that explains how using them in the same process
+ as lldb will cause badness. Fortunately, the only place I plan on using
+ the breakpoint handler is to check for tests where crashing is expected.
+
+ * wtf/threads/Signals.cpp:
+ (WTF::fromMachException):
+ (WTF::toMachMask):
+ * wtf/threads/Signals.h:
+ (WTF::toSystemSignal):
+ (WTF::fromSystemSignal):
+
2020-06-12 Jason Lawrence <lawrenc...@apple.com>
Unreviewed, reverting r262904.
Modified: trunk/Source/WTF/wtf/threads/Signals.cpp (262990 => 262991)
--- trunk/Source/WTF/wtf/threads/Signals.cpp 2020-06-13 00:06:42 UTC (rev 262990)
+++ trunk/Source/WTF/wtf/threads/Signals.cpp 2020-06-13 00:22:31 UTC (rev 262991)
@@ -126,7 +126,9 @@
{
switch (type) {
case EXC_BAD_ACCESS: return Signal::AccessFault;
- case EXC_BAD_INSTRUCTION: return Signal::Ill;
+ case EXC_BAD_INSTRUCTION: return Signal::IllegalInstruction;
+ case EXC_ARITHMETIC: return Signal::FloatingPoint;
+ case EXC_BREAKPOINT: return Signal::Breakpoint;
default: break;
}
return Signal::Unknown;
@@ -136,7 +138,9 @@
{
switch (signal) {
case Signal::AccessFault: return EXC_MASK_BAD_ACCESS;
- case Signal::Ill: return EXC_MASK_BAD_INSTRUCTION;
+ case Signal::IllegalInstruction: return EXC_MASK_BAD_INSTRUCTION;
+ case Signal::FloatingPoint: return EXC_MASK_ARITHMETIC;
+ case Signal::Breakpoint: return EXC_MASK_BREAKPOINT;
default: break;
}
RELEASE_ASSERT_NOT_REACHED();
Modified: trunk/Source/WTF/wtf/threads/Signals.h (262990 => 262991)
--- trunk/Source/WTF/wtf/threads/Signals.h 2020-06-13 00:06:42 UTC (rev 262990)
+++ trunk/Source/WTF/wtf/threads/Signals.h 2020-06-13 00:22:31 UTC (rev 262991)
@@ -48,7 +48,9 @@
// These signals will only chain if we don't have a handler that can process them. If there is nothing
// to chain to we restore the default handler and crash.
- Ill,
+ FloatingPoint,
+ Breakpoint, // Be VERY careful with this, installing a handler for this will break lldb/gdb.
+ IllegalInstruction,
AccessFault, // For posix this is both SIGSEGV and SIGBUS
NumberOfSignals = AccessFault + 2, // AccessFault is really two signals.
Unknown = NumberOfSignals
@@ -58,8 +60,10 @@
{
switch (signal) {
case Signal::AccessFault: return std::make_tuple(SIGSEGV, SIGBUS);
- case Signal::Ill: return std::make_tuple(SIGILL, WTF::nullopt);
+ case Signal::IllegalInstruction: return std::make_tuple(SIGILL, WTF::nullopt);
case Signal::Usr: return std::make_tuple(SIGILL, WTF::nullopt);
+ case Signal::FloatingPoint: return std::make_tuple(SIGFPE, WTF::nullopt);
+ case Signal::Breakpoint: return std::make_tuple(SIGTRAP, WTF::nullopt);
default: break;
}
RELEASE_ASSERT_NOT_REACHED();
@@ -70,7 +74,9 @@
switch (signal) {
case SIGSEGV: return Signal::AccessFault;
case SIGBUS: return Signal::AccessFault;
- case SIGILL: return Signal::Ill;
+ case SIGFPE: return Signal::FloatingPoint;
+ case SIGTRAP: return Signal::Breakpoint;
+ case SIGILL: return Signal::IllegalInstruction;
case SIGUSR2: return Signal::Usr;
default: return Signal::Unknown;
}
@@ -97,7 +103,7 @@
void forEachHandler(Signal, const Func&) const;
static constexpr size_t numberOfSignals = static_cast<size_t>(Signal::NumberOfSignals);
- static constexpr size_t maxNumberOfHandlers = 2;
+ static constexpr size_t maxNumberOfHandlers = 4;
static_assert(numberOfSignals < std::numeric_limits<uint8_t>::max());
@@ -140,6 +146,7 @@
using WTF::toSystemSignal;
using WTF::fromSystemSignal;
using WTF::SignalAction;
+using WTF::SignalHandler;
using WTF::installSignalHandler;
#endif // USE(PTHREADS) && HAVE(MACHINE_CONTEXT)
Modified: trunk/Tools/ChangeLog (262990 => 262991)
--- trunk/Tools/ChangeLog 2020-06-13 00:06:42 UTC (rev 262990)
+++ trunk/Tools/ChangeLog 2020-06-13 00:22:31 UTC (rev 262991)
@@ -1,3 +1,17 @@
+2020-06-12 Keith Miller <keith_mil...@apple.com>
+
+ Tests expecting a crash should use a signal handler in the JSC CLI process
+ https://bugs.webkit.org/show_bug.cgi?id=212479
+
+ Reviewed by Yusuke Suzuki.
+
+ Crashing tests should now exit with status zero.
+
+ * Scripts/run-jsc-stress-tests:
+ * Scripts/webkitruby/jsc-stress-test-writer-default.rb:
+ * Scripts/webkitruby/jsc-stress-test-writer-playstation.rb:
+ * Scripts/webkitruby/jsc-stress-test-writer-ruby.rb:
+
2020-06-12 Alex Christensen <achristen...@webkit.org>
Make API tests tolerant of our relatively new use of WebPageProxy::preconnectTo
Modified: trunk/Tools/Scripts/run-jsc-stress-tests (262990 => 262991)
--- trunk/Tools/Scripts/run-jsc-stress-tests 2020-06-13 00:06:42 UTC (rev 262990)
+++ trunk/Tools/Scripts/run-jsc-stress-tests 2020-06-13 00:22:31 UTC (rev 262991)
@@ -633,8 +633,9 @@
skip() if ($mode == "quick")
end
-def crash!
- $runCommandOptions[:shouldCrash] = true
+def crashOK!
+ $testSpecificRequiredOptions += ["-s"]
+ $runCommandOptions[:crashOK] = true
end
def requireOptions(*options)
Modified: trunk/Tools/Scripts/webkitruby/jsc-stress-test-writer-default.rb (262990 => 262991)
--- trunk/Tools/Scripts/webkitruby/jsc-stress-test-writer-default.rb 2020-06-13 00:06:42 UTC (rev 262990)
+++ trunk/Tools/Scripts/webkitruby/jsc-stress-test-writer-default.rb 2020-06-13 00:22:31 UTC (rev 262991)
@@ -226,8 +226,8 @@
@outputHandler = outputHandler
@errorHandler = errorHandler
@isSlow = !!$runCommandOptions[:isSlow]
- @shouldCrash = !!$runCommandOptions[:shouldCrash]
- if @shouldCrash
+ @crashOK = !!$runCommandOptions[:crashOK]
+ if @crashOK
@outputHandler = noisyOutputHandler
end
@additionalEnv = []
@@ -237,7 +237,7 @@
# It's important to remember that the test is actually run in a subshell, so if we change directory
# in the subshell when we return we will be in our original directory. This is nice because we don't
# have to bend over backwards to do things relative to the root.
- script = "(cd ../#{Shellwords.shellescape(@directory.to_s)} && #{@shouldCrash ? "!" : ""}("
+ script = "(cd ../#{Shellwords.shellescape(@directory.to_s)} && ("
($envVars + additionalEnv).each { |var| script += "export " << var << "; " }
script += "\"$@\" " + escapeAll(@arguments) + "))"
return script
Modified: trunk/Tools/Scripts/webkitruby/jsc-stress-test-writer-playstation.rb (262990 => 262991)
--- trunk/Tools/Scripts/webkitruby/jsc-stress-test-writer-playstation.rb 2020-06-13 00:06:42 UTC (rev 262990)
+++ trunk/Tools/Scripts/webkitruby/jsc-stress-test-writer-playstation.rb 2020-06-13 00:22:31 UTC (rev 262991)
@@ -272,8 +272,8 @@
@outputHandler = outputHandler
@errorHandler = errorHandler
@isSlow = !!$runCommandOptions[:isSlow]
- @shouldCrash = !!$runCommandOptions[:shouldCrash]
- if @shouldCrash
+ @crashOK = !!$runCommandOptions[:crashOK]
+ if @crashOK
@outputHandler = noisyOutputHandler
end
@additionalEnv = []
@@ -291,9 +291,6 @@
script += "if (status == 0)\n"
script += " success = true\n"
script += "end\n"
- script += "if (#{@shouldCrash})\n"
- script += " success = !success\n"
- script += "end\n"
script += "out = File.open(\"#{n}-stdout\", \"r\").read\n"
script += "err = File.open(\"#{n}-stderr\", \"r\").read\n"
Modified: trunk/Tools/Scripts/webkitruby/jsc-stress-test-writer-ruby.rb (262990 => 262991)
--- trunk/Tools/Scripts/webkitruby/jsc-stress-test-writer-ruby.rb 2020-06-13 00:06:42 UTC (rev 262990)
+++ trunk/Tools/Scripts/webkitruby/jsc-stress-test-writer-ruby.rb 2020-06-13 00:22:31 UTC (rev 262991)
@@ -272,8 +272,8 @@
@outputHandler = outputHandler
@errorHandler = errorHandler
@isSlow = !!$runCommandOptions[:isSlow]
- @shouldCrash = !!$runCommandOptions[:shouldCrash]
- if @shouldCrash
+ @crashOK = !!$runCommandOptions[:crashOK]
+ if @crashOK
@outputHandler = noisyOutputHandler
end
@additionalEnv = []
@@ -302,10 +302,7 @@
script += " <<-END_OF_SCRIPT\n"
script += " require 'open3'\n"
script += " def success(status)\n"
- script += " if (#{@shouldCrash})\n"
- script += " !status.success?\n"
- script += " else\n"
- script += " status.success?\n"
+ script += " status.success?\n"
script += " end\n"
script += " script_location = File.expand_path(File.dirname(__FILE__))\n"
script += " Dir.chdir(\"\\\#{script_location}"
@@ -378,10 +375,7 @@
outp.puts "require 'open3'"
outp.puts "require 'fileutils'"
outp.puts "def success(status)"
- outp.puts " if (#{@shouldCrash})"
- outp.puts " !status.success?"
- outp.puts " else"
- outp.puts " status.success?"
+ outp.puts " status.success?"
outp.puts "end"
cmd = shellCommand