Modified: trunk/Source/_javascript_Core/ChangeLog (229604 => 229605)
--- trunk/Source/_javascript_Core/ChangeLog 2018-03-14 17:56:19 UTC (rev 229604)
+++ trunk/Source/_javascript_Core/ChangeLog 2018-03-14 19:44:35 UTC (rev 229605)
@@ -1,3 +1,17 @@
+2018-03-14 Keith Miller <[email protected]>
+
+ Move jsc CLI breakpoint function to $vm
+ https://bugs.webkit.org/show_bug.cgi?id=183512
+
+ Reviewed by Yusuke Suzuki.
+
+ * jsc.cpp:
+ (GlobalObject::finishCreation):
+ (functionBreakpoint): Deleted.
+ * tools/JSDollarVM.cpp:
+ (JSC::functionBreakpoint):
+ (JSC::JSDollarVM::finishCreation):
+
2018-03-14 Tim Horton <[email protected]>
Fix the build after r229567
Modified: trunk/Source/_javascript_Core/jsc.cpp (229604 => 229605)
--- trunk/Source/_javascript_Core/jsc.cpp 2018-03-14 17:56:19 UTC (rev 229604)
+++ trunk/Source/_javascript_Core/jsc.cpp 2018-03-14 19:44:35 UTC (rev 229605)
@@ -255,7 +255,6 @@
static EncodedJSValue JSC_HOST_CALL functionPrintStdOut(ExecState*);
static EncodedJSValue JSC_HOST_CALL functionPrintStdErr(ExecState*);
-static EncodedJSValue JSC_HOST_CALL functionBreakpoint(ExecState*);
static EncodedJSValue JSC_HOST_CALL functionDebug(ExecState*);
static EncodedJSValue JSC_HOST_CALL functionDescribe(ExecState*);
static EncodedJSValue JSC_HOST_CALL functionDescribeArray(ExecState*);
@@ -473,7 +472,6 @@
{
Base::finishCreation(vm);
- addFunction(vm, "breakpoint", functionBreakpoint, 0);
addFunction(vm, "debug", functionDebug, 1);
addFunction(vm, "describe", functionDescribe, 1);
addFunction(vm, "describeArray", functionDescribeArray, 1);
@@ -1044,18 +1042,6 @@
}
#endif
-EncodedJSValue JSC_HOST_CALL functionBreakpoint(ExecState* exec)
-{
- // Nothing should throw here but we might as well double check...
- VM& vm = exec->vm();
- auto scope = DECLARE_CATCH_SCOPE(vm);
- UNUSED_PARAM(scope);
- if (!exec->argumentCount() || exec->argument(0).toBoolean(exec))
- WTFBreakpointTrap();
-
- return encodedJSUndefined();
-}
-
EncodedJSValue JSC_HOST_CALL functionDebug(ExecState* exec)
{
VM& vm = exec->vm();
Modified: trunk/Source/_javascript_Core/tools/JSDollarVM.cpp (229604 => 229605)
--- trunk/Source/_javascript_Core/tools/JSDollarVM.cpp 2018-03-14 17:56:19 UTC (rev 229604)
+++ trunk/Source/_javascript_Core/tools/JSDollarVM.cpp 2018-03-14 19:44:35 UTC (rev 229605)
@@ -1042,6 +1042,20 @@
CRASH();
}
+// Executes a breakpoint instruction if the first argument is truthy or is unset.
+// Usage: $vm.breakpoint(<condition>)
+static EncodedJSValue JSC_HOST_CALL functionBreakpoint(ExecState* exec)
+{
+ // Nothing should throw here but we might as well double check...
+ VM& vm = exec->vm();
+ auto scope = DECLARE_CATCH_SCOPE(vm);
+ UNUSED_PARAM(scope);
+ if (!exec->argumentCount() || exec->argument(0).toBoolean(exec))
+ WTFBreakpointTrap();
+
+ return encodedJSUndefined();
+}
+
// Returns true if the current frame is a DFG frame.
// Usage: isDFG = $vm.dfgTrue()
static EncodedJSValue JSC_HOST_CALL functionDFGTrue(ExecState*)
@@ -1764,6 +1778,7 @@
addFunction(vm, "abort", functionCrash, 0);
addFunction(vm, "crash", functionCrash, 0);
+ addFunction(vm, "breakpoint", functionBreakpoint, 0);
putDirectNativeFunction(vm, globalObject, Identifier::fromString(&vm, "dfgTrue"), 0, functionDFGTrue, DFGTrueIntrinsic, static_cast<unsigned>(PropertyAttribute::DontEnum));
putDirectNativeFunction(vm, globalObject, Identifier::fromString(&vm, "ftlTrue"), 0, functionFTLTrue, FTLTrueIntrinsic, static_cast<unsigned>(PropertyAttribute::DontEnum));