Unreviewed, rolling out r237084, r237088, r237098, and
[WebKit-https.git] / Source / JavaScriptCore / offlineasm / generate_offset_extractor.rb
index 160b94c..fff3982 100644 (file)
@@ -39,11 +39,8 @@ IncludeFile.processIncludeOptions()
 inputFlnm = ARGV.shift
 outputFlnm = ARGV.shift
 
-validBackends = ARGV.shift
-if validBackends
-    $stderr.puts "Only dealing with backends: #{validBackends}"
-    includeOnlyBackends(validBackends.split(","))
-end
+validBackends = canonicalizeBackendNames(ARGV.shift.split(/[,\s]+/))
+includeOnlyBackends(validBackends)
 
 def emitMagicNumber
     OFFSET_MAGIC_NUMBERS.each {
@@ -121,6 +118,17 @@ File.open(outputFlnm, "w") {
     $output = outp
     outp.puts inputHash
     length = 0
+
+    emitCodeInAllConfigurations(prunedAST) {
+        | settings, ast, backend, index |
+        constsList = ast.filter(ConstExpr).uniq.sort
+
+        constsList.each_with_index {
+            | const, index |
+            outp.puts "constexpr int64_t constValue#{index} = static_cast<int64_t>(#{const.value});"
+        }
+    }
+
     emitCodeInAllConfigurations(prunedAST) {
         | settings, ast, backend, index |
         offsetsList = ast.filter(StructOffset).uniq.sort
@@ -152,24 +160,12 @@ File.open(outputFlnm, "w") {
             emitMagicNumber
             outp.puts "sizeof(#{sizeof.struct}),"
         }
-        constsList.each {
-            | const |
+        constsList.each_index {
+            | index |
             emitMagicNumber
-            outp.puts "static_cast<int64_t>(#{const.value}),"
+            outp.puts "constValue#{index},"
         }
     }
     outp.puts "};"
 
-    emitCodeInAllConfigurations(prunedAST) {
-        | settings, ast, backend, index |
-        constsList = ast.filter(ConstExpr).uniq.sort
-
-        constsList.each_with_index {
-            | const, index |
-            outp.puts "constexpr int64_t isConst#{index} = static_cast<int64_t>(#{const.value});"
-            # Make a trivally true static assert that uses the last value...
-            outp.puts "static_assert(isConst#{index} || true, \"\");"
-        }
-    }
-
 }