# US 8,752,016 B2 · Converting JavaScript into a device-independent representation

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 8,752,016 B2
- Document ID: US8752016B2
- Status: Granted
- Kind: B2
- Application number: 12/316,730
- Filed: 2008-12-15
- Published: 2010-06-17
- Granted: 2014-06-10
- Earliest claimed: 2008-12-15
- Assignees: Apple Inc.
- Applicants: Victor Leonel Hernandez Porras; Thomas John O'Brien; Roger Scott Hoover; Christopher Arthur Lattner; Eric Marshall Christopher; Pratik Solanki; Jia-Hong Chen; Michael Alan Kahl
- Inventors: Victor Leonel Hernandez Porras; Thomas John O'Brien; Roger Scott Hoover; Christopher Arthur Lattner; Eric Marshall Christopher; Pratik Solanki; Jia-Hong Chen; Michael Alan Kahl
- Web page: https://patentgrep.com/patent/US8752016B2

## CPC

- G06F 8/71: Version control (security arrangements therefor G06F21/57); Configuration management
- G06F 8/47: {Retargetable compilers}
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

A device-independent intermediate representation of a source code is generated and stored, e.g., in a memory or other storage mechanism. The stored intermediate representation of the source code is used to generate a device-specific machine code corresponding to the source code. The stored intermediate representation may be updated, e.g., periodically, for example by obtaining an updated version of the source code and compiling the updated source code to generate an updated intermediate representation. The stored intermediate representation may be based on source code received from a device that is synchronized with which a compiling device that generates the device-specific machine code. In some cases, the stored intermediate representation may be used to generate for each of a plurality of devices a corresponding device-specific machine code.

## Claims

### Claim 1

A method for processing computer code, comprising:
receiving, by a mobile phone from a first remote system, a source code, wherein the source code is in an interpretable programming language;
caching the source code on the mobile phone;
establishing a wireless connection with a second remote system;
transmitting, through the wireless connection and to the second remote system, the source code as well as information that identifies the first remote system;
receiving, through the wireless connection from the second remote system, at least one of an intermediate representation of the source code and a machine code representation of the source code, wherein:
the machine code representation of the source code is specific to a hardware configuration of the mobile phone,
the second remote system is configured to periodically check the first remote system to determine if the source code has changed,
the second remote system is configured to acquire the changed source code and generate and cache at least one of an intermediate representation of the changed source code and a machine code representation of the changed source code, and
the machine code representation of the changed source code is specific to the hardware configuration of the mobile phone;
closing the wireless connection between the mobile phone and the second remote system;
storing, on the mobile phone, the intermediate representation of the source code or the machine code representation of the source code;
establishing a subsequent wireless connection with the second remote system;
receiving, through the subsequent wireless connection with the second remote system, the intermediate representation of the changed source code or the machine code representation of the changed source code; and
caching, by the mobile phone, the intermediate representation of the changed source code or the machine code representation of the changed source code on the mobile phone.

### Claim 2 (depends on 1)

The method of claim 1, wherein the source code comprises JavaScript.

### Claim 3 (depends on 1)

The method of claim 1, wherein the intermediate representation of the source code comprises an LLVM intermediate representation (IR), an LLVM byte code or other byte code, or another appropriate device-independent intermediate representation.

### Claim 4 (depends on 1)

The method of claim 1, wherein the intermediate representation of the source code is stored on the mobile phone at a first time, and the mobile phone uses the intermediate representation to generate machine code at a second time subsequent to the first time.

### Claim 5 (depends on 1)

The method of claim 1, wherein determining whether the source code has changed comprises using a resource identifier associated with the intermediate representation of the source code to check whether the source code has changed.

### Claim 6 (depends on 5)

The method of claim 5, wherein using the resource identifier associated with the intermediate representation to check whether the source code has changed comprises using the resource identifier to retrieve a current version of the source code and comparing a value associated with the retrieved current version of the source code to a corresponding previously stored value.

### Claim 7 (depends on 6)

The method of claim 6, wherein the value comprises a value computed based at least in part on at least a portion of the retrieved current version of the source code.

### Claim 8 (depends on 5)

The method of claim 5, wherein using the resource identifier associated with the intermediate representation to check whether the source code has changed comprises using the resource identifier to access a metadata associated with the source code and using the metadata to determine whether the source code has changed.

### Claim 9

A mobile phone, comprising:
a storage mechanism; and
a processor coupled to the storage mechanism and configured to:
receive, from a first remote system, a source code, wherein the source code is in an interpretable programming language;
cache the source code;
establish a wireless connection with a second remote system;
transmit, through the wireless connection and to the second remote system, the source code as well as information that identifies the first remote system;
receive, through the wireless connection from the second remote system, at least one of an intermediate representation of the source code and a machine code representation of the source code, wherein:
the machine code representation of the source code is specific to a hardware configuration of the mobile phone,
the second remote system is configured to periodically check the first remote system to determine if the source code has changed,
the second remote system is configured to acquire the changed source code and generate and cache at least one of an intermediate representation of the changed source code and a machine code representation of the changed source code, and
the machine code representation of the changed source code is specific to the hardware configuration of the mobile phone;
close the wireless connection with the second remote system;
store the intermediate representation of the source code or the machine code representation of the source code;
establish a subsequent wireless connection with the second remote system;
receive, through the subsequent wireless connection with the second remote system, the intermediate representation of the changed source code or the machine code representation of the changed source code; and
cache the intermediate representation of the changed source code or the machine code representation of the changed source code on the mobile phone.

### Claim 10 (depends on 9)

The mobile phone of claim 9, wherein the intermediate representation of the source code comprises an LLVM intermediate representation (IR), an LLVM byte code or other byte code, or another appropriate device-independent intermediate representation.

### Claim 11 (depends on 9)

The mobile phone of claim 9, wherein the intermediate representation of the source code is stored on the mobile phone at a first time, and the mobile phone uses the intermediate representation to generate machine code at a second time subsequent to the first time.

### Claim 12 (depends on 9)

The mobile phone of claim 9, further comprising a device interface configured to enable the processor to communicate with the first remote system.

### Claim 13 (depends on 9)

The mobile phone of claim 9, further comprising a network interface configured to enable the processor to wirelessly communicate with the second remote system.

### Claim 14

A non-transitory computer readable storage medium configured to store instructions that, when executed by a processor included in a computing device, cause the computing device to:
establish a wireless connection with a mobile phone;
receive, through the wireless connection and from the mobile phone, a source code as well as information that identifies a first remote system, wherein the source code is in an interpretable programming language and received by the mobile phone from the first remote system, and the mobile phone is configured to cache the source code;
generate and cache at least one of an intermediate representation of the source code and a machine code representation of the source code, wherein the machine code representation of the source code is specific to a hardware configuration of the mobile phone;
send, through the wireless connection to the mobile phone, the intermediate representation of the source code or the machine code representation of the source code;
close the wireless connection to the mobile phone,
wherein the mobile phone is configured to store the intermediate representation of the source code or the machine code representation of the source code;
periodically check the first remote system to determine if the source code has changed;
acquire the changed source code;
generate and cache at least one of an intermediate representation of the changed source code and a machine code representation of the changed source code;
establish a subsequent wireless connection with the mobile phone; and
send, through the subsequent wireless connection to the mobile phone, the intermediate representation of the changed source code or the machine code representation of the changed source code, wherein the mobile phone is configured to cache the intermediate representation of the changed source code or the machine code representation of the changed source code.

### Claim 15 (depends on 14)

The non-transitory computer-readable storage medium of claim 14, wherein the intermediate representation of the source code comprises an LLVM intermediate representation (IR), an LLVM byte code or other byte code, or another appropriate device-independent intermediate representation.

### Claim 16 (depends on 14)

The non-transitory computer-readable storage medium of claim 14, wherein the intermediate representation of the source code is stored on the mobile phone at a first time, and the mobile phone uses the intermediate representation to generate machine code at a second time subsequent to the first time.

### Claim 17

A device, comprising:
a communication interface configured to provide communication with an external node; and
a processor coupled to the communication interface and configured to:
establish a wireless connection with a mobile phone;
receive, through the wireless connection and from the mobile phone, a source code and information that identifies a first remote system, wherein the source code is in an interpretable programming language and received by the mobile phone from the first remote system, and the mobile phone is configured to cache the source code;
generate and cache at least one of an intermediate representation of the source code and a machine code representation of the source code, wherein the machine code representation of the source code is specific to a hardware configuration of the mobile phone;
send, through the wireless connection to the mobile phone, the intermediate representation of the source code or the machine code representation of the source code;
close the wireless connection to the mobile phone,
wherein the mobile phone is configured to store the intermediate representation of the source code or the machine code representation of the source code;
periodically check the first remote system to determine if the source code has changed;
acquire the changed source code;
generate and cache at least one of an intermediate representation of the changed source code and a machine code representation of the changed source code;
establish a subsequent wireless connection with the mobile phone; and
send, through the subsequent wireless connection to the mobile phone, the intermediate representation of the changed source code or the machine code representation of the changed source code, wherein the mobile phone is configured to cache the intermediate representation of the changed source code or the machine code representation of the changed source code.

### Claim 18 (depends on 17)

The device of claim 17, wherein the intermediate representation of the source code comprises an LLVM intermediate representation (IR), an LLVM byte code or other byte code, or another appropriate device-independent intermediate representation.

### Claim 19 (depends on 17)

The device of claim 17, wherein the intermediate representation of the source code is stored on the mobile phone at a first time, and the mobile phone uses the intermediate representation to generate machine code at a second time subsequent to the first time.

### Claim 20 (depends on 17)

The device of claim 17, wherein determining whether the source code has changed comprises using a resource identifier associated with the intermediate representation of the source code to check whether the source code has changed.
