The invention discloses a
JavaScript language security reinforcement method based on a
virtual machine technology, and belongs to the field of
JavaScript languages. The method comprises the following steps: firstly, building a test
system comprising a
compiler, an assembler, a
virtual machine and a packer; then, a developer submits the
JavaScript program or the function requirement to be tested to the test
system; a test
system constructs a to-be-tested program by using a
Yarn environment, and a
compiler compiles a JavaScript
source code and analyzes and converts the JavaScript
source code into an intermediate representation IR; the assembler converts the IR into
byte codes, and converts the relative reference address into an absolute address by generating a character string table and a
lookup table; and the generated
byte code is optimized. The test system submits the optimized
byte code to the
virtual machine, the virtual
machine runs a
byte code program, and after execution is completed, the test system collects an execution result of the virtual
machine and compares the execution result with an expected result; and finally generating a
test report and delivering the
test report to developers for confirmation. According to the method, the security of the JavaScript code is enhanced through a
virtualization technology, and malicious access and analysis are prevented.