Title: [199745] trunk/Source/_javascript_Core
Revision
199745
Author
mark....@apple.com
Date
2016-04-19 16:31:25 -0700 (Tue, 19 Apr 2016)

Log Message

Replace $vm.printValue() with $vm.value().
https://bugs.webkit.org/show_bug.cgi?id=156767

Reviewed by Saam Barati.

When debugging with $vm, this change allows us to do this:

    $vm.print("myObj = " + $vm.value(myObj) + "\n");

... instead of having to do this:

    $vm.print("myObj = ");
    $vm.printValue(myObj);
    $vm.print("\n");

* tools/JSDollarVMPrototype.cpp:
(JSC::JSDollarVMPrototype::printValue):
(JSC::functionValue):
(JSC::JSDollarVMPrototype::finishCreation):
(JSC::functionPrintValue): Deleted.

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (199744 => 199745)


--- trunk/Source/_javascript_Core/ChangeLog	2016-04-19 21:51:12 UTC (rev 199744)
+++ trunk/Source/_javascript_Core/ChangeLog	2016-04-19 23:31:25 UTC (rev 199745)
@@ -1,3 +1,26 @@
+2016-04-19  Mark Lam  <mark....@apple.com>
+
+        Replace $vm.printValue() with $vm.value().
+        https://bugs.webkit.org/show_bug.cgi?id=156767
+
+        Reviewed by Saam Barati.
+
+        When debugging with $vm, this change allows us to do this:
+
+            $vm.print("myObj = " + $vm.value(myObj) + "\n");
+
+        ... instead of having to do this:
+
+            $vm.print("myObj = ");
+            $vm.printValue(myObj);
+            $vm.print("\n");
+
+        * tools/JSDollarVMPrototype.cpp:
+        (JSC::JSDollarVMPrototype::printValue):
+        (JSC::functionValue):
+        (JSC::JSDollarVMPrototype::finishCreation):
+        (JSC::functionPrintValue): Deleted.
+
 2016-04-18  Oliver Hunt  <oli...@apple.com>
 
         Enable separated heap by default on ios

Modified: trunk/Source/_javascript_Core/tools/JSDollarVMPrototype.cpp (199744 => 199745)


--- trunk/Source/_javascript_Core/tools/JSDollarVMPrototype.cpp	2016-04-19 21:51:12 UTC (rev 199744)
+++ trunk/Source/_javascript_Core/tools/JSDollarVMPrototype.cpp	2016-04-19 23:31:25 UTC (rev 199745)
@@ -33,6 +33,7 @@
 #include "JSFunction.h"
 #include "StackVisitor.h"
 #include <wtf/DataLog.h>
+#include <wtf/StringPrintStream.h>
 
 namespace JSC {
 
@@ -388,14 +389,16 @@
     dataLog(value);
 }
 
-static EncodedJSValue JSC_HOST_CALL functionPrintValue(ExecState* exec)
+static EncodedJSValue JSC_HOST_CALL functionValue(ExecState* exec)
 {
+    WTF::StringPrintStream stream;
     for (unsigned i = 0; i < exec->argumentCount(); ++i) {
         if (i)
-            dataLog(" ");
-        dataLog(exec->uncheckedArgument(i));
+            stream.print(", ");
+        stream.print(exec->uncheckedArgument(i));
     }
-    return JSValue::encode(jsUndefined());
+    
+    return JSValue::encode(jsString(exec, stream.toString()));
 }
 
 void JSDollarVMPrototype::finishCreation(VM& vm, JSGlobalObject* globalObject)
@@ -420,7 +423,7 @@
     addFunction(vm, globalObject, "printCallFrame", functionPrintCallFrame, 0);
     addFunction(vm, globalObject, "printStack", functionPrintStack, 0);
 
-    addFunction(vm, globalObject, "printValue", functionPrintValue, 1);
+    addFunction(vm, globalObject, "value", functionValue, 1);
 }
 
 } // namespace JSC
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to