Bug 1545782 - Store BinVariant and BinField as int16_t r=arai
authorDavid Teller <dteller@mozilla.com>
Fri, 19 Apr 2019 18:57:40 +0000
changeset 470261 0905d8963ffab547436a67d3e7d5597fb1fd4846
parent 470260 081b83f886c2307bac0b0ee189d5faa6efe80b64
child 470262 29c131c2fd402f750064800c41037f534cea5cfd
push id83628
push userdteller@mozilla.com
push dateFri, 19 Apr 2019 20:31:08 +0000
treeherderautoland@0905d8963ffa [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersarai
bugs1545782
milestone68.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1545782 - Store BinVariant and BinField as int16_t r=arai This will help us convert between a context (BinVariant, BinField) and a int32_t. Differential Revision: https://phabricator.services.mozilla.com/D28208
js/src/frontend/binast/src/main.rs
--- a/js/src/frontend/binast/src/main.rs
+++ b/js/src/frontend/binast/src/main.rs
@@ -939,17 +939,17 @@ impl CPPExporter {
         let kind_limit = node_names.len();
         buffer.push_str(&format!("\n#define FOR_EACH_BIN_KIND(F) \\\n{nodes}\n",
             nodes = node_names.iter()
                 .map(|name| format!("    F({enum_name}, \"{spec_name}\")",
                     enum_name = name.to_cpp_enum_case(),
                     spec_name = name))
                 .format(" \\\n")));
         buffer.push_str("
-enum class BinASTKind {
+enum class BinASTKind: uint16_t {
 #define EMIT_ENUM(name, _) name,
     FOR_EACH_BIN_KIND(EMIT_ENUM)
 #undef EMIT_ENUM
 };
 ");
 
         buffer.push_str(&format!("\n// The number of distinct values of BinASTKind.\nconst size_t BINASTKIND_LIMIT = {};\n\n\n", kind_limit));
         buffer.push_str("\n\n");
@@ -963,17 +963,17 @@ enum class BinASTKind {
         let field_limit = field_names.len();
         buffer.push_str(&format!("\n#define FOR_EACH_BIN_FIELD(F) \\\n{nodes}\n",
             nodes = field_names.iter()
                 .map(|name| format!("    F({enum_name}, \"{spec_name}\")",
                     spec_name = name,
                     enum_name = name.to_cpp_enum_case()))
                 .format(" \\\n")));
         buffer.push_str("
-enum class BinASTField {
+enum class BinASTField: uint16_t {
 #define EMIT_ENUM(name, _) name,
     FOR_EACH_BIN_FIELD(EMIT_ENUM)
 #undef EMIT_ENUM
 };
 ");
         buffer.push_str(&format!("\n// The number of distinct values of BinASTField.\nconst size_t BINASTFIELD_LIMIT = {};\n\n\n", field_limit));
 
         if self.rules.hpp_tokens_variants_doc.is_some() {
@@ -990,17 +990,17 @@ enum class BinASTField {
         buffer.push_str(&format!("\n#define FOR_EACH_BIN_VARIANT(F) \\\n{nodes}\n",
             nodes = enum_variants.into_iter()
                 .map(|(symbol, name)| format!("    F({variant_name}, \"{spec_name}\")",
                     spec_name = symbol,
                     variant_name = name))
                 .format(" \\\n")));
 
         buffer.push_str("
-enum class BinASTVariant {
+enum class BinASTVariant: uint16_t {
 #define EMIT_ENUM(name, _) name,
     FOR_EACH_BIN_VARIANT(EMIT_ENUM)
 #undef EMIT_ENUM
 };
 ");
         buffer.push_str(&format!("\n// The number of distinct values of BinASTVariant.\nconst size_t BINASTVARIANT_LIMIT = {};\n\n\n",
             variants_limit));