Diff
Modified: branches/safari-601-branch/LayoutTests/ChangeLog (191652 => 191653)
--- branches/safari-601-branch/LayoutTests/ChangeLog 2015-10-28 04:40:04 UTC (rev 191652)
+++ branches/safari-601-branch/LayoutTests/ChangeLog 2015-10-28 05:19:20 UTC (rev 191653)
@@ -1,3 +1,22 @@
+2015-10-26 Matthew Hanson <matthew_han...@apple.com>
+
+ Merge r191530. rdar://problem/23206864
+
+ 2015-10-23 Michael Saboff <msab...@apple.com>
+
+ REGRESSION (r179357-r179359): WebContent Crash using AOL Mail @ com.apple._javascript_Core JSC::linkPolymorphicCall(JSC::ExecState*, JSC::CallLinkInfo&, JSC::CallVariant, JSC::RegisterPreservationMode) + 1584
+ https://bugs.webkit.org/show_bug.cgi?id=150513
+
+ Reviewed by Saam Barati.
+
+ New regression test.
+
+ * js/regress-150513-expected.txt: Added.
+ * js/regress-150513.html: Added.
+ * js/script-tests/regress-150513.js: Added.
+ (test):
+ * resources/standalone-pre.js: Added failNextNewCodeBlock to testRunner object.
+
2015-10-22 Matthew Hanson <matthew_han...@apple.com>
Merge r191364. rdar://problem/22862879
Added: branches/safari-601-branch/LayoutTests/js/regress-150513-expected.txt (0 => 191653)
--- branches/safari-601-branch/LayoutTests/js/regress-150513-expected.txt (rev 0)
+++ branches/safari-601-branch/LayoutTests/js/regress-150513-expected.txt 2015-10-28 05:19:20 UTC (rev 191653)
@@ -0,0 +1,10 @@
+Regression test for https://webkit.org/b/150513.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS Didn't crash when calling a virtual _javascript_ function that doesn't have a CodeBlock.
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: branches/safari-601-branch/LayoutTests/js/regress-150513.html (0 => 191653)
--- branches/safari-601-branch/LayoutTests/js/regress-150513.html (rev 0)
+++ branches/safari-601-branch/LayoutTests/js/regress-150513.html 2015-10-28 05:19:20 UTC (rev 191653)
@@ -0,0 +1,10 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src=""
+</head>
+<body>
+<script src=""
+<script src=""
+</body>
+</html>
Added: branches/safari-601-branch/LayoutTests/js/script-tests/regress-150513.js (0 => 191653)
--- branches/safari-601-branch/LayoutTests/js/script-tests/regress-150513.js (rev 0)
+++ branches/safari-601-branch/LayoutTests/js/script-tests/regress-150513.js 2015-10-28 05:19:20 UTC (rev 191653)
@@ -0,0 +1,38 @@
+description("Regression test for https://webkit.org/b/150513.");
+
+// This test verifies that we can properly handle calling a virtual _javascript_
+// function that fails during CodeBlock generation.
+
+var functions = [];
+
+function init()
+{
+ functions.push(new Function("a", "return a"));
+ functions.push(new Function("a", "return a"));
+ functions.push(new Function("a", "return a"));
+}
+
+function test()
+{
+ for (var i = 0; i < 100000; i++) {
+ var f;
+ if (i % 1000 == 999) {
+ testRunner.failNextNewCodeBlock();
+ f = functions[2];
+ } else
+ f = functions[i % 2];
+
+ try {
+ var result = f(1);
+ if (result != 1)
+ testFailed("Wrong result, expected 1, got " + result);
+ } catch (e) {
+ }
+ }
+}
+
+init();
+
+test();
+
+testPassed("Didn't crash when calling a virtual _javascript_ function that doesn't have a CodeBlock.");
Modified: branches/safari-601-branch/LayoutTests/resources/standalone-pre.js (191652 => 191653)
--- branches/safari-601-branch/LayoutTests/resources/standalone-pre.js 2015-10-28 04:40:04 UTC (rev 191652)
+++ branches/safari-601-branch/LayoutTests/resources/standalone-pre.js 2015-10-28 05:19:20 UTC (rev 191653)
@@ -4,7 +4,8 @@
self.testRunner = {
neverInlineFunction: neverInlineFunction,
- numberOfDFGCompiles: numberOfDFGCompiles
+ numberOfDFGCompiles: numberOfDFGCompiles,
+ failNextNewCodeBlock: failNextNewCodeBlock
};
var silentTestPass, didPassSomeTestsSilently, didFailSomeTests, successfullyParsed;
Modified: branches/safari-601-branch/Source/_javascript_Core/API/JSCTestRunnerUtils.cpp (191652 => 191653)
--- branches/safari-601-branch/Source/_javascript_Core/API/JSCTestRunnerUtils.cpp 2015-10-28 04:40:04 UTC (rev 191652)
+++ branches/safari-601-branch/Source/_javascript_Core/API/JSCTestRunnerUtils.cpp 2015-10-28 05:19:20 UTC (rev 191653)
@@ -32,6 +32,14 @@
namespace JSC {
+
+JSValueRef failNextNewCodeBlock(JSContextRef context)
+{
+ ExecState* exec= toJS(context);
+ JSLockHolder holder(exec);
+ return toRef(exec, failNextNewCodeBlock(exec));
+}
+
JSValueRef numberOfDFGCompiles(JSContextRef context, JSValueRef theFunctionValueRef)
{
ExecState* exec= toJS(context);
Modified: branches/safari-601-branch/Source/_javascript_Core/API/JSCTestRunnerUtils.h (191652 => 191653)
--- branches/safari-601-branch/Source/_javascript_Core/API/JSCTestRunnerUtils.h 2015-10-28 04:40:04 UTC (rev 191652)
+++ branches/safari-601-branch/Source/_javascript_Core/API/JSCTestRunnerUtils.h 2015-10-28 05:19:20 UTC (rev 191653)
@@ -31,6 +31,7 @@
namespace JSC {
+JS_EXPORT_PRIVATE JSValueRef failNextNewCodeBlock(JSContextRef);
JS_EXPORT_PRIVATE JSValueRef numberOfDFGCompiles(JSContextRef, JSValueRef theFunction);
JS_EXPORT_PRIVATE JSValueRef setNeverInline(JSContextRef, JSValueRef theFunction);
Modified: branches/safari-601-branch/Source/_javascript_Core/ChangeLog (191652 => 191653)
--- branches/safari-601-branch/Source/_javascript_Core/ChangeLog 2015-10-28 04:40:04 UTC (rev 191652)
+++ branches/safari-601-branch/Source/_javascript_Core/ChangeLog 2015-10-28 05:19:20 UTC (rev 191653)
@@ -1,3 +1,45 @@
+2015-10-26 Matthew Hanson <matthew_han...@apple.com>
+
+ Merge r191530. rdar://problem/23206864
+
+ 2015-10-23 Michael Saboff <msab...@apple.com>
+
+ REGRESSION (r179357-r179359): WebContent Crash using AOL Mail @ com.apple._javascript_Core JSC::linkPolymorphicCall(JSC::ExecState*, JSC::CallLinkInfo&, JSC::CallVariant, JSC::RegisterPreservationMode) + 1584
+ https://bugs.webkit.org/show_bug.cgi?id=150513
+
+ Reviewed by Saam Barati.
+
+ Add check in linkPolymorphicCall() to make sure we have a CodeBlock for the newly added variant.
+ If not, we turn the call into a virtual call.
+
+ The bug was caused by a stack overflow when preparing the function for execution. This properly
+ threw an exception, however linkPolymorphicCall() didn't check for this error case.
+
+ Added a new test function "failNextNewCodeBlock()" to test tools to simplify the testing.
+
+ * API/JSCTestRunnerUtils.cpp:
+ (JSC::failNextNewCodeBlock):
+ (JSC::numberOfDFGCompiles):
+ * API/JSCTestRunnerUtils.h:
+ * jit/Repatch.cpp:
+ (JSC::linkPolymorphicCall):
+ * jsc.cpp:
+ (GlobalObject::finishCreation):
+ (functionTransferArrayBuffer):
+ (functionFailNextNewCodeBlock):
+ (functionQuit):
+ * runtime/Executable.cpp:
+ (JSC::ScriptExecutable::prepareForExecutionImpl):
+ * runtime/TestRunnerUtils.cpp:
+ (JSC::optimizeNextInvocation):
+ (JSC::failNextNewCodeBlock):
+ (JSC::numberOfDFGCompiles):
+ * runtime/TestRunnerUtils.h:
+ * runtime/VM.h:
+ (JSC::VM::setFailNextNewCodeBlock):
+ (JSC::VM::getAndClearFailNextNewCodeBlock):
+ (JSC::VM::stackPointerAtVMEntry):
+
2015-10-22 Matthew Hanson <matthew_han...@apple.com>
Rollout r191395. rdar://problem/22847057
Modified: branches/safari-601-branch/Source/_javascript_Core/jit/Repatch.cpp (191652 => 191653)
--- branches/safari-601-branch/Source/_javascript_Core/jit/Repatch.cpp 2015-10-28 04:40:04 UTC (rev 191652)
+++ branches/safari-601-branch/Source/_javascript_Core/jit/Repatch.cpp 2015-10-28 05:19:20 UTC (rev 191653)
@@ -1756,9 +1756,9 @@
else {
codeBlock = jsCast<FunctionExecutable*>(variant.executable())->codeBlockForCall();
- // If we cannot handle a callee, assume that it's better for this whole thing to be a
- // virtual call.
- if (exec->argumentCountIncludingThis() < static_cast<size_t>(codeBlock->numParameters()) || callLinkInfo.callType() == CallLinkInfo::CallVarargs || callLinkInfo.callType() == CallLinkInfo::ConstructVarargs) {
+ // If we cannot handle a callee, either because we don't have a CodeBlock or because arity mismatch,
+ // assume that it's better for this whole thing to be a virtual call.
+ if (!codeBlock || exec->argumentCountIncludingThis() < static_cast<size_t>(codeBlock->numParameters()) || callLinkInfo.callType() == CallLinkInfo::CallVarargs || callLinkInfo.callType() == CallLinkInfo::ConstructVarargs) {
linkVirtualFor(exec, callLinkInfo, CodeForCall, registers);
return;
}
Modified: branches/safari-601-branch/Source/_javascript_Core/jsc.cpp (191652 => 191653)
--- branches/safari-601-branch/Source/_javascript_Core/jsc.cpp 2015-10-28 04:40:04 UTC (rev 191652)
+++ branches/safari-601-branch/Source/_javascript_Core/jsc.cpp 2015-10-28 05:19:20 UTC (rev 191653)
@@ -475,6 +475,7 @@
static EncodedJSValue JSC_HOST_CALL functionNumberOfDFGCompiles(ExecState*);
static EncodedJSValue JSC_HOST_CALL functionReoptimizationRetryCount(ExecState*);
static EncodedJSValue JSC_HOST_CALL functionTransferArrayBuffer(ExecState*);
+static EncodedJSValue JSC_HOST_CALL functionFailNextNewCodeBlock(ExecState*);
static NO_RETURN_WITH_VALUE EncodedJSValue JSC_HOST_CALL functionQuit(ExecState*);
static EncodedJSValue JSC_HOST_CALL functionFalse1(ExecState*);
static EncodedJSValue JSC_HOST_CALL functionFalse2(ExecState*);
@@ -619,6 +620,7 @@
addFunction(vm, "optimizeNextInvocation", functionOptimizeNextInvocation, 1);
addFunction(vm, "reoptimizationRetryCount", functionReoptimizationRetryCount, 1);
addFunction(vm, "transferArrayBuffer", functionTransferArrayBuffer, 1);
+ addFunction(vm, "failNextNewCodeBlock", functionFailNextNewCodeBlock, 1);
#if ENABLE(SAMPLING_FLAGS)
addFunction(vm, "setSamplingFlags", functionSetSamplingFlags, 1);
addFunction(vm, "clearSamplingFlags", functionClearSamplingFlags, 1);
@@ -1069,6 +1071,12 @@
return JSValue::encode(jsUndefined());
}
+EncodedJSValue JSC_HOST_CALL functionFailNextNewCodeBlock(ExecState* exec)
+{
+ exec->vm().setFailNextNewCodeBlock();
+ return JSValue::encode(jsUndefined());
+}
+
EncodedJSValue JSC_HOST_CALL functionQuit(ExecState*)
{
jscExit(EXIT_SUCCESS);
Modified: branches/safari-601-branch/Source/_javascript_Core/runtime/Executable.cpp (191652 => 191653)
--- branches/safari-601-branch/Source/_javascript_Core/runtime/Executable.cpp 2015-10-28 04:40:04 UTC (rev 191652)
+++ branches/safari-601-branch/Source/_javascript_Core/runtime/Executable.cpp 2015-10-28 05:19:20 UTC (rev 191653)
@@ -325,7 +325,10 @@
{
VM& vm = exec->vm();
DeferGC deferGC(vm.heap);
-
+
+ if (vm.getAndClearFailNextNewCodeBlock())
+ return createError(exec->callerFrame(), ASCIILiteral("Forced Failure"));
+
JSObject* exception = 0;
RefPtr<CodeBlock> codeBlock = newCodeBlockFor(kind, function, scope, exception);
if (!codeBlock) {
Modified: branches/safari-601-branch/Source/_javascript_Core/runtime/TestRunnerUtils.cpp (191652 => 191653)
--- branches/safari-601-branch/Source/_javascript_Core/runtime/TestRunnerUtils.cpp 2015-10-28 04:40:04 UTC (rev 191652)
+++ branches/safari-601-branch/Source/_javascript_Core/runtime/TestRunnerUtils.cpp 2015-10-28 05:19:20 UTC (rev 191653)
@@ -95,6 +95,13 @@
return jsUndefined();
}
+JSValue failNextNewCodeBlock(ExecState* exec)
+{
+ exec->vm().setFailNextNewCodeBlock();
+
+ return jsUndefined();
+}
+
JSValue numberOfDFGCompiles(ExecState* exec)
{
if (exec->argumentCount() < 1)
Modified: branches/safari-601-branch/Source/_javascript_Core/runtime/TestRunnerUtils.h (191652 => 191653)
--- branches/safari-601-branch/Source/_javascript_Core/runtime/TestRunnerUtils.h 2015-10-28 04:40:04 UTC (rev 191652)
+++ branches/safari-601-branch/Source/_javascript_Core/runtime/TestRunnerUtils.h 2015-10-28 05:19:20 UTC (rev 191653)
@@ -40,6 +40,7 @@
JS_EXPORT_PRIVATE JSValue setNeverInline(JSValue function);
JS_EXPORT_PRIVATE JSValue optimizeNextInvocation(JSValue function);
+JS_EXPORT_PRIVATE JSValue failNextNewCodeBlock(ExecState*);
JS_EXPORT_PRIVATE JSValue numberOfDFGCompiles(ExecState*);
JS_EXPORT_PRIVATE JSValue setNeverInline(ExecState*);
JS_EXPORT_PRIVATE JSValue optimizeNextInvocation(ExecState*);
Modified: branches/safari-601-branch/Source/_javascript_Core/runtime/VM.h (191652 => 191653)
--- branches/safari-601-branch/Source/_javascript_Core/runtime/VM.h 2015-10-28 04:40:04 UTC (rev 191652)
+++ branches/safari-601-branch/Source/_javascript_Core/runtime/VM.h 2015-10-28 05:19:20 UTC (rev 191653)
@@ -381,6 +381,14 @@
JS_EXPORT_PRIVATE JSValue throwException(ExecState*, JSValue);
JS_EXPORT_PRIVATE JSObject* throwException(ExecState*, JSObject*);
+ void setFailNextNewCodeBlock() { m_failNextNewCodeBlock = true; }
+ bool getAndClearFailNextNewCodeBlock()
+ {
+ bool result = m_failNextNewCodeBlock;
+ m_failNextNewCodeBlock = false;
+ return result;
+ }
+
void* stackPointerAtVMEntry() const { return m_stackPointerAtVMEntry; }
void setStackPointerAtVMEntry(void*);
@@ -568,6 +576,7 @@
void* m_lastStackTop;
Exception* m_exception { nullptr };
Exception* m_lastException { nullptr };
+ bool m_failNextNewCodeBlock { false };
bool m_inDefineOwnProperty;
std::unique_ptr<CodeCache> m_codeCache;
LegacyProfiler* m_enabledProfiler;
Modified: branches/safari-601-branch/Tools/ChangeLog (191652 => 191653)
--- branches/safari-601-branch/Tools/ChangeLog 2015-10-28 04:40:04 UTC (rev 191652)
+++ branches/safari-601-branch/Tools/ChangeLog 2015-10-28 05:19:20 UTC (rev 191653)
@@ -1,3 +1,28 @@
+2015-10-26 Matthew Hanson <matthew_han...@apple.com>
+
+ Merge r191530. rdar://problem/23206864
+
+ 2015-10-23 Michael Saboff <msab...@apple.com>
+
+ REGRESSION (r179357-r179359): WebContent Crash using AOL Mail @ com.apple._javascript_Core JSC::linkPolymorphicCall(JSC::ExecState*, JSC::CallLinkInfo&, JSC::CallVariant, JSC::RegisterPreservationMode) + 1584
+ https://bugs.webkit.org/show_bug.cgi?id=150513
+
+ Reviewed by Saam Barati.
+
+ Added a new test function, failNextNewCodeBlock() to simplify the writing of a regression test.
+
+ * DumpRenderTree/TestRunner.cpp:
+ (simulateWebNotificationClickCallback):
+ (failNextCodeBlock):
+ (numberOfDFGCompiles):
+ (TestRunner::staticFunctions):
+ * WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:
+ * WebKitTestRunner/InjectedBundle/TestRunner.cpp:
+ (WTR::TestRunner::setBlockAllPlugins):
+ (WTR::TestRunner::failNextCodeBlock):
+ (WTR::TestRunner::numberOfDFGCompiles):
+ * WebKitTestRunner/InjectedBundle/TestRunner.h:
+
2015-10-22 Matthew Hanson <matthew_han...@apple.com>
Rollout r191395. rdar://problem/22847057
Modified: branches/safari-601-branch/Tools/DumpRenderTree/TestRunner.cpp (191652 => 191653)
--- branches/safari-601-branch/Tools/DumpRenderTree/TestRunner.cpp 2015-10-28 04:40:04 UTC (rev 191652)
+++ branches/safari-601-branch/Tools/DumpRenderTree/TestRunner.cpp 2015-10-28 05:19:20 UTC (rev 191653)
@@ -1920,11 +1920,16 @@
return JSValueMakeUndefined(context);
}
-static JSValueRef numberOfDFGCompiles(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
+static JSValueRef failNextNewCodeBlock(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
{
if (argumentCount < 1)
return JSValueMakeUndefined(context);
+ return JSC::failNextNewCodeBlock(context);
+}
+
+static JSValueRef numberOfDFGCompiles(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
+{
return JSC::numberOfDFGCompiles(context, arguments[0]);
}
@@ -2134,6 +2139,7 @@
{ "denyWebNotificationPermission", denyWebNotificationPermissionCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "removeAllWebNotificationPermissions", removeAllWebNotificationPermissionsCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "simulateWebNotificationClick", simulateWebNotificationClickCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
+ { "failNextNewCodeBlock", failNextNewCodeBlock, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "numberOfDFGCompiles", numberOfDFGCompiles, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "neverInlineFunction", neverInlineFunction, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ 0, 0, 0 }
Modified: branches/safari-601-branch/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl (191652 => 191653)
--- branches/safari-601-branch/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl 2015-10-28 04:40:04 UTC (rev 191652)
+++ branches/safari-601-branch/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl 2015-10-28 05:19:20 UTC (rev 191653)
@@ -200,6 +200,7 @@
void setBlockAllPlugins(boolean shouldBlock);
// Hooks to the JSC compiler.
+ object failNextNewCodeBlock();
object numberOfDFGCompiles(object function);
object neverInlineFunction(object function);
};
Modified: branches/safari-601-branch/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp (191652 => 191653)
--- branches/safari-601-branch/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp 2015-10-28 04:40:04 UTC (rev 191652)
+++ branches/safari-601-branch/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp 2015-10-28 05:19:20 UTC (rev 191653)
@@ -837,6 +837,13 @@
WKBundlePagePostMessage(InjectedBundle::singleton().page()->page(), messageName.get(), messageBody.get());
}
+JSValueRef TestRunner::failNextNewCodeBlock()
+{
+ WKBundleFrameRef mainFrame = WKBundlePageGetMainFrame(InjectedBundle::singleton().page()->page());
+ JSContextRef context = WKBundleFrameGetJavaScriptContext(mainFrame);
+ return JSC::failNextNewCodeBlock(context);
+}
+
JSValueRef TestRunner::numberOfDFGCompiles(JSValueRef theFunction)
{
WKBundleFrameRef mainFrame = WKBundlePageGetMainFrame(InjectedBundle::singleton().page()->page());
Modified: branches/safari-601-branch/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h (191652 => 191653)
--- branches/safari-601-branch/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h 2015-10-28 04:40:04 UTC (rev 191652)
+++ branches/safari-601-branch/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h 2015-10-28 05:19:20 UTC (rev 191653)
@@ -278,6 +278,7 @@
bool secureEventInputIsEnabled() const;
+ JSValueRef failNextNewCodeBlock();
JSValueRef numberOfDFGCompiles(JSValueRef theFunction);
JSValueRef neverInlineFunction(JSValueRef theFunction);