[Win] Support $vm.getpid()
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 17 May 2017 23:13:29 +0000 (23:13 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 17 May 2017 23:13:29 +0000 (23:13 +0000)
https://bugs.webkit.org/show_bug.cgi?id=172248

Patch by Don Olmstead <don.olmstead@am.sony.com> on 2017-05-17
Reviewed by Mark Lam.

* tools/JSDollarVMPrototype.cpp:
(JSC::functionGetPID):
(JSC::JSDollarVMPrototype::finishCreation):

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

Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/tools/JSDollarVMPrototype.cpp

index 60235e2..819d7a5 100644 (file)
@@ -1,3 +1,14 @@
+2017-05-17  Don Olmstead  <don.olmstead@am.sony.com>
+
+        [Win] Support $vm.getpid()
+        https://bugs.webkit.org/show_bug.cgi?id=172248
+
+        Reviewed by Mark Lam.
+
+        * tools/JSDollarVMPrototype.cpp:
+        (JSC::functionGetPID):
+        (JSC::JSDollarVMPrototype::finishCreation):
+
 2017-05-17  Michael Saboff  <msaboff@apple.com>
 
         [iOS] The Garbage Collector shouldn't rely on the bmalloc scavenger for up to date memory footprint info
index af7472b..46bf1e1 100644 (file)
@@ -35,6 +35,7 @@
 #include "MarkedSpaceInlines.h"
 #include "StackVisitor.h"
 #include <wtf/DataLog.h>
+#include <wtf/ProcessID.h>
 #include <wtf/StringPrintStream.h>
 
 namespace JSC {
@@ -438,12 +439,10 @@ static EncodedJSValue JSC_HOST_CALL functionValue(ExecState* exec)
     return JSValue::encode(jsString(exec, stream.toString()));
 }
 
-#if !PLATFORM(WIN)
 static EncodedJSValue JSC_HOST_CALL functionGetPID(ExecState*)
 {
-    return JSValue::encode(jsNumber(getpid()));
+    return JSValue::encode(jsNumber(getCurrentProcessID()));
 }
-#endif
 
 void JSDollarVMPrototype::finishCreation(VM& vm, JSGlobalObject* globalObject)
 {
@@ -469,9 +468,7 @@ void JSDollarVMPrototype::finishCreation(VM& vm, JSGlobalObject* globalObject)
     addFunction(vm, globalObject, "printStack", functionPrintStack, 0);
 
     addFunction(vm, globalObject, "value", functionValue, 1);
-#if !PLATFORM(WIN)
     addFunction(vm, globalObject, "getpid", functionGetPID, 0);
-#endif
 }
 
 } // namespace JSC