Move jsc CLI breakpoint function to $vm
authorkeith_miller@apple.com <keith_miller@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 14 Mar 2018 19:44:35 +0000 (19:44 +0000)
committerkeith_miller@apple.com <keith_miller@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 14 Mar 2018 19:44:35 +0000 (19:44 +0000)
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):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@229605 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/jsc.cpp
Source/JavaScriptCore/tools/JSDollarVM.cpp

index 409a43d..9cc35f0 100644 (file)
@@ -1,3 +1,17 @@
+2018-03-14  Keith Miller  <keith_miller@apple.com>
+
+        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  <timothy_horton@apple.com>
 
         Fix the build after r229567
index 6cd238a..40c7edc 100644 (file)
@@ -255,7 +255,6 @@ static EncodedJSValue JSC_HOST_CALL functionCreateGlobalObject(ExecState*);
 
 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 @@ protected:
     {
         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 @@ EncodedJSValue JSC_HOST_CALL functionDumpCallFrame(ExecState* exec)
 }
 #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();
index 42a9b5f..77f6039 100644 (file)
@@ -1042,6 +1042,20 @@ static NO_RETURN_DUE_TO_CRASH EncodedJSValue JSC_HOST_CALL functionCrash(ExecSta
     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 @@ void JSDollarVM::finishCreation(VM& vm)
 
     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));