JavaScript Engine Caching Optimized Machine Code

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Conventional JAVASCRIPT engines face limitations in achieving high performance due to inefficient compilation times, inability to apply typical compiler optimizations, and underutilization of multi-core processors, particularly in embedded environments with limited hardware resources.

Innovation Solution

A web browsing method and apparatus that optimizes JAVASCRIPT code by caching machine codes, stub codes, and type information, using incremental optimization and compiler optimizations across multiple cores, allowing for simultaneous compilation and optimization of JAVASCRIPT code on separate processing cores.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Speed

If JIT compilation is used to improve JavaScript execution performance, then execution speed is improved, but compilation time is not separated from execution time causing overhead

Engineering Contradiction:
ImproveJavaScript execution speedVSAvoidcompilation overhead time
Core Design Contradiction:
SpeedVSLoss of time

Solution Approach 1:

The patent performs JIT compilation in advance during idle periods or when resources are available, separating compilation from execution time. This preliminary compilation action stores optimized machine code that can be directly executed later without incurring compilation overhead during actual JavaScript execution, thus resolving the contradiction between execution speed and compilation time overhead.

Inventive Principle:
Principle #10Preliminary action

2Loss of time

If JIT compiler does not perform optimization to reduce compilation time, then compilation is faster, but inefficient machine codes are generated

Engineering Contradiction:
Improvecompilation timeVSAvoidmachine code efficiency
Core Design Contradiction:
Loss of timeVSProductivity

Solution Approach 1:

The system performs full optimization during preliminary compilation phases when time is not constrained, generating efficient machine code. This optimized code is then cached and reused, eliminating the need for repeated compilation and optimization cycles, thus achieving both time efficiency and code optimization.

Inventive Principle:
Principle #10Preliminary action

Solution Approach 2:

The compilation process is segmented into multiple phases: initial compilation, optimization, and execution. By separating these phases, the system can perform comprehensive optimization without blocking execution time, as each phase operates independently and optimized results are cached for reuse.

Inventive Principle:
Principle #1Segmentation

3Adaptability or versatility

If JavaScript engine needs to recompile machine code after it is released from main memory, then code can be reused, but compilation overhead increases

Engineering Contradiction:
Improvemachine code reusabilityVSAvoidcompilation overhead
Core Design Contradiction:
Adaptability or versatilityVSLoss of time

Solution Approach 1:

The patent creates and stores copies of optimized machine code in persistent storage or long-term cache. When the original code is released from main memory, these pre-generated copies can be quickly restored or regenerated without performing full compilation again, thus maintaining code reusability while minimizing compilation overhead.

Inventive Principle:
Principle #26Copying

4Productivity

If typical compiler optimization methods are applied to JavaScript, then code optimization is improved, but JavaScript's dynamic characteristics make optimization difficult

Engineering Contradiction:
Improvecode optimization effectivenessVSAvoidoptimization complexity
Core Design Contradiction:
ProductivityVSDevice complexity

Solution Approach 1:

The system performs preliminary type inference and static analysis on JavaScript code before execution, gathering type information and usage patterns in advance. This preliminary action enables the application of typical compiler optimization methods by providing the static information that JavaScript's dynamic nature normally lacks, thus improving optimization effectiveness without excessive complexity.

Inventive Principle:
Principle #10Preliminary action

Data Source

PatentUS8887127B2Web browsing apparatus and method through storing and optimizing JAVASCRIPT® code
Publication Date: 2014.11.11 SAMSUNG ELECTRONICS CO LTD
  • US8887127B2 patent drawing
  • US8887127B2 patent drawing
  • US8887127B2 patent drawing

AI summary

A web browsing method and apparatus for enhancing a user's convenience in web browsing is provided in a system that uses a multi-core processor. The web browsing method and apparatus is applicable in a system, such as a smart phone that has a low computing power or that has a storage device like a flash memory operating in a rapid manner. Optimized machine codes are stored in files and incremental optimization is achieved, so the JAVASCRIPT® program of the web application has a small compilation overhead and achieves fast execution.