summaryrefslogtreecommitdiffstats
path: root/js/src/frontend/smoosh/build.rs
blob: 3ae2cf54cd2c15b774c21bd0f234f17fe75b1525 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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(),
    );
}