js/src/frontend/smoosh/build.rs
author Tooru Fujisawa <arai_a@mac.com>
Thu, 04 Jun 2020 10:19:01 +0000
changeset 597949 dd65196892ffa181e0a68b78d64cf672c0d2dd44
parent 595044 31c34fc039e6f26eebdffb73e1dbecab95d9ee4d
child 599158 63ce2e510b001a183e5fe01dfd25614eee1c314e
permissions -rw-r--r--
Bug 1643273 - Disable consistency check for Opcodes.h in SM(nu) job. r=jandem Differential Revision: https://phabricator.services.mozilla.com/D78245

use jsparagus::stencil::opcode_info;

fn compare(name: &str, orig: &str, copied: &str) {
    if copied != orig {
        panic!(
            "{} is out of sync. \
                It's possible that the bytecode generated by jsparagus is \
                based on older opcodes. Please run \
                update_stencil.py in jsparagus. \
                You can disable this check by setting \
                JS_SMOOSH_DISABLE_OPCODE_CHECK environment variable.",
            name
        );
    }
}

fn main() {
    match std::env::var("JS_SMOOSH_DISABLE_OPCODE_CHECK") {
        Ok(_) => { return; },
        Err(_) => {}
    };

    compare(
        "Opcodes.h",
        include_str!("../../vm/Opcodes.h"),
        opcode_info::get_opcodes_source(),
    );
}