JavaScript Symbolic Execution via Java Bytecode Translation

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Existing software validation tools are inadequate for JavaScript code due to incompatibilities with Java code, lacking the ability to perform symbolic execution and generate test cases effectively for JavaScript programs, which are inherently different from Java programs in terms of typing, object orientation, and execution environments.

Innovation Solution

A system that conducts symbolic execution of JavaScript code by utilizing a hybrid of Java and JavaScript processing, translating JavaScript statements into Java bytecodes and specific instructions, and using a JavaScript runtime engine to handle semantic operations, allowing for the generation of test cases that validate the code's execution paths and detect errors.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Reliability

If existing software validation tools are used for JavaScript code, then they cannot perform symbolic execution and generate test cases effectively, but adapting them would require overcoming fundamental language incompatibilities

Engineering Contradiction:
Improvetest case generation effectivenessVSAvoidlanguage compatibility
Core Design Contradiction:
ReliabilityVSAdaptability or versatility

Solution Approach 1:

The patent introduces Java as an intermediary language between the JavaScript code under test and the validation tooling. JavaScript code is translated into Java bytecode, which can then be executed by standard Java-based symbolic execution tools. This intermediary approach allows existing reliable Java validation tools to effectively test JavaScript code without requiring the tools to be adapted for JavaScript's different syntax and semantics.

Inventive Principle:
Principle #24Intermediary (Mediator)

Solution Approach 2:

The system changes the parameter of language representation by translating JavaScript code into Java bytecode. This parameter change allows the code to be processed by Java-based tools while maintaining the original JavaScript semantics through careful translation of JavaScript-specific constructs into equivalent Java operations.

Inventive Principle:
Principle #35Parameter changes

2Productivity

If JavaScript code is directly executed without translation, then execution is fast and simple, but symbolic execution and test case generation are not possible

Engineering Contradiction:
Improveexecution speedVSAvoidsymbolic execution capability
Core Design Contradiction:
ProductivityVSExtent of automation

Solution Approach 1:

Instead of modifying the original JavaScript code or requiring complex symbolic execution engines for JavaScript, the system creates a copy of the JavaScript code in the form of Java bytecode. This bytecode copy preserves the logical structure and control flow of the original JavaScript while being compatible with Java's mature symbolic execution infrastructure, enabling automated test case generation without sacrificing the ability to execute the original code quickly.

Inventive Principle:
Principle #26Copying

3Reliability

If JavaScript-specific instructions are handled natively, then semantic operations are preserved, but integration with Java execution engine becomes complex

Engineering Contradiction:
Improvesemantic operation accuracyVSAvoidhybrid engine integration
Core Design Contradiction:
ReliabilityVSDevice complexity

Solution Approach 1:

The execution engine is segmented into distinct components: a Java execution engine that handles the bulk of execution and a JavaScript runtime engine that handles JavaScript-specific semantic operations. The Java engine executes translated bytecode for general control flow and operations, while the JavaScript runtime engine is invoked specifically for operations that require JavaScript semantics. This segmentation allows each component to specialize in what it does best while integrating through well-defined interfaces.

Inventive Principle:
Principle #1Segmentation

Solution Approach 2:

The system dynamically selects which engine handles each operation based on the instruction type. During execution, the Java execution engine monitors the bytecode stream and dynamically invokes the JavaScript runtime engine only when JavaScript-specific semantic operations are encountered. This dynamic approach allows the system to maintain simplicity for most operations while preserving semantic accuracy when needed, without requiring the entire system to be complex.

Inventive Principle:
Principle #15Dynamics

Data Source

PatentUS9038032B2Symbolic execution and automatic test case generation for JavaScript programs
Publication Date: 2015.05.19 FUJITSU LTD
  • US9038032B2 patent drawing
  • US9038032B2 patent drawing
  • US9038032B2 patent drawing

AI summary

A method includes, by one or more computing devices, determining JavaScript statements to be evaluated, parsing the JavaScript statements, translating the JavaScript statements into Java bytecodes and JavaScript-specific instructions, executing the Java bytecodes in a Java execution engine, calling a JavaScript run-time engine from the Java execution engine, handling one or more semantic operations associated with the JavaScript-specific instructions through use of the JavaScript run-time engine, and providing return values to the Java execution engine. The statements are configured for execution on a computing device. The set of Java bytecodes and JavaScript-specific instructions is configured to conduct symbolic execution of one or more portions of the JavaScript statements. The symbolic execution is configured to evaluate the JavaScript statements.