An implementation of Facebook's HipHop VM runtime in JavaScript.
hhvm.js is defined as a RequireJS module.
require([
'hhvm'
], function(Hhvm) {
var vm = new Hhvm();
var myProgram = /* ... */;
vm.program(myProgram);
vm.run();
}
);
To create and configure a new virtual machine:
var options = {
outputHandler: function(str) { // Do something with the output }
};
var vm = new Hhvm(options);
Use vm.hhbc
to retrieve and execute HipHop bytecode instructions.
vm.hhbc.Int(); // Execute the Int instruction
console.log(vm.hhbc.Int.opcode); // 14
console.log(vm.hhbc.Int.mnemonic); // "Int"