summaryrefslogtreecommitdiffstats
path: root/js/src/frontend/smoosh/build.rs
blob: 367c682f8687cd84a095a77c4af01d1d9ed0d403 (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
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() {
    if std::env::var("JS_SMOOSH_DISABLE_OPCODE_CHECK").is_ok() {
        return;
    }

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