Title: [198660] trunk
Revision
198660
Author
[email protected]
Date
2016-03-24 22:14:16 -0700 (Thu, 24 Mar 2016)

Log Message

Determine architecture for running jsc stress tests on windows
https://bugs.webkit.org/show_bug.cgi?id=155840

Patch by Bill Ming <[email protected]> on 2016-03-24
Reviewed by Alex Christensen.

* Tools/Scripts/run-jsc-stress-tests:

Modified Paths

Diff

Modified: trunk/ChangeLog (198659 => 198660)


--- trunk/ChangeLog	2016-03-25 03:59:30 UTC (rev 198659)
+++ trunk/ChangeLog	2016-03-25 05:14:16 UTC (rev 198660)
@@ -1,3 +1,12 @@
+2016-03-24  Bill Ming  <[email protected]>
+
+        Determine architecture for running jsc stress tests on windows
+        https://bugs.webkit.org/show_bug.cgi?id=155840
+
+        Reviewed by Alex Christensen.
+
+        * Tools/Scripts/run-jsc-stress-tests:
+
 2016-03-23  Bill Ming  <[email protected]>
 
         Fixed ninja build path.

Modified: trunk/Tools/Scripts/run-jsc-stress-tests (198659 => 198660)


--- trunk/Tools/Scripts/run-jsc-stress-tests	2016-03-25 03:59:30 UTC (rev 198659)
+++ trunk/Tools/Scripts/run-jsc-stress-tests	2016-03-25 05:14:16 UTC (rev 198660)
@@ -355,12 +355,43 @@
     end
 end
 
+def determineArchitectureFromPEBinary
+    f = File.open($jscPath.to_s)
+    data = ""
+
+    if !(data[0, 2] == "MZ")
+        $stderr.puts "Warning: Missing PE magic in file #{Shellwords.shellescape($jscPath.to_s)}"
+        return nil
+    end
+
+    peHeaderAddr = data[0x3c, 4].unpack('V').first # 32-bit unsigned int little endian
+
+    if !(data[peHeaderAddr, 4] == "PE\0\0")
+        $stderr.puts "Warning: Incorrect PE header in file #{Shellwords.shellescape($jscPath.to_s)}"
+        return nil
+    end
+
+    machine = data[peHeaderAddr + 4, 2].unpack('v').first # 16-bit unsigned short, little endian
+
+    case machine
+    when 0x014c
+        "x86"
+    when 0x8664
+        "x86-64"
+    else
+        $stderr.puts "Warning: unsupported machine type: #{machine}"
+        nil
+    end
+end
+
 def determineArchitecture
     case $hostOS
     when "darwin"
         determineArchitectureFromMachOBinary
     when "linux"
         determineArchitectureFromELFBinary
+    when "windows"
+        determineArchitectureFromPEBinary
     else
         $stderr.puts "Warning: unable to determine architecture on this platform."
         nil
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to