diff --git a/feed.xml b/feed.xml index bd2fc1848..e04cc2e54 100644 --- a/feed.xml +++ b/feed.xml @@ -6,8 +6,8 @@ http://samsung.github.io/jerryscript/ - Sat, 13 Jun 2015 19:21:11 +0300 - Sat, 13 Jun 2015 19:21:11 +0300 + Sat, 13 Jun 2015 19:22:47 +0300 + Sat, 13 Jun 2015 19:22:47 +0300 Jekyll v2.5.3 diff --git a/internals/index.html b/internals/index.html index 17a819dae..804f95ef1 100644 --- a/internals/index.html +++ b/internals/index.html @@ -225,21 +225,21 @@ As byte-code decomposition into blocks is not possible until parsing is finished

Byte-code

Every instruction of bytecode consists of opcode and up to three operands. Operand (idx) can be either a “register” or a string
literal, specifying identifier to evaluate (i.e. var //Storage idx). General structure of instruction is shown on the picture.
-Structure of instruction

+Structure of instruction

Special kinds of instructions are described below.

Arithmetic/bitwise-logic/logic/comparison/shift

Arithmetic instruction can have the following structure:

-

Arithmetic instructions

+

Arithmetic instructions

where dst/left/right/value identify an operand.

Control (jumps)

Control instructions utilize two bytes to encode jump location. Destination offset is contained inside offset_high and offset_low fields.

-

Control instructions

+

Control instructions

Condition jump checks cond value field, which identifies an operand, and performs a jump if the operand has true value.

@@ -247,7 +247,7 @@ literal, specifying identifier to evaluate (i.e. var //Storage idx)

Assignment instructions perform assignment of immediate value (contained inside instruction) to the operand, which is marked as idx on the picture.

-

Assignment instruction

+

Assignment instruction

Type of the immediate value is encoded in the type field of instruction. The following values are supported:
- “simple value” (see ECMA types encoding)
@@ -260,7 +260,7 @@ literal, specifying identifier to evaluate (i.e. var //Storage idx)

Exit instruction serves to stop the execution and exit with a specified status.

-

Exit instruction

+

Exit instruction

Exit instruction is employed in following cases:
- at script end (exit with “succesful” stats);
@@ -270,35 +270,35 @@ literal, specifying identifier to evaluate (i.e. var //Storage idx)

Native call instruction is used to call intrinsics. Arguments are not encoded directly inside this instruction, instead they follow it as special “meta” instructions (see the according section). Id of desired intrinsic is encoded in the intrinsic id field.

-

Native call instruction

+

Native call instruction

Function call/Constructor call

Function/constructor call are utilized to perform calls to functions and constructors. Destination operand is encoded in dst field. Operand name_idx specifies the name of the function to call. Arguments are encoded the same way as in native call instruction.

-

Function/constructor instruction

+

Function/constructor instruction

Function declaration

Function declarations are represented by special kind of instructions. Function name and number of arguments are located in name_idx and arg_list fields respectively.

-

Function declaration instruction

+

Function declaration instruction

Function expression

Very similar to function declaration. But additionally contains destination (dst) field and name operand is optional, because anonymous functions are possible.

-

Function expression instruction

+

Function expression instruction

Return from function/eval

Return instructions perfrom unconditional return from function/eval code. Return value can be specified (idx field).

-

Return instruction

+

Return instruction

“Meta” (special marker opcode)

-

Meta instruction

+

Meta instruction

Meta instructions are usually utilized as continuations of other instructions. Depending on type field, meta instruction can have the following meaning:

@@ -315,49 +315,49 @@ literal, specifying identifier to evaluate (i.e. var //Storage idx)

JavaScript delete operator is modeled with delete instruction in the bytecode. There are two types of delete instruction, applied either to element of lexical environment or to object’s property.

-

Delete instructions

+

Delete instructions

This binding (evaluate “this”)

This binding instruction writes value of “this” to the dst operand.

-

This instruction

+

This instruction

typeof (typeof operation)

Typeof instruction executes JavaScript operator with the same name. Result is written to the dst operand.

-

Typeof instruction

+

Typeof instruction

with block

To specify bounds of “with” block, a pair of instructions is used. “With” instruction specifies its start. Followed by a number of arbitrary instructions, the block ends with end_with meta instruction.

-

With block instruction

+

With block instruction

try block

Try block consists of try instruction, followed by a number of arbitrary instructions, meta instruction catch or finally or both of them, separating catch and finally blocks respectively and meta instruction end_try_catch_finally, which finishes the whole construction.

-

Try block instruction

+

Try block instruction

Object declaration

Obect declaration instruction represents object literal in JavaScript specification. It consists of op_obj_decl instruction, followed by a list of prop_data, prop_getter and prop_setter meta instructions. A series of instructions which evaluate property values can precede meta instructions. Number of meta instructions, e.g. number of properties, is specified in the prop_num field.

-

Object declaration instruction

+

Object declaration instruction

Arguments and array declarartion

The strategy descibed in previous section is also used for encoding of arguments in function/constructor calls and elements in array declarations.
See the according pictures.

-

Arguments/Array elements representation

+

Arguments/Array elements representation

Virtual machine

Virtual machine executes bytecode by interpreting instructions one by one. Bytecode is a continuous array of instructions, divided into blocks of fixed size. Main loop of interpreter calls opfunc_* for every instruction. This function returns completion value and position of the next instruction.

-

Bytecode storage

+

Bytecode storage

Instruction can have up to three operands which are represented by idx values. Meaning of idx value depends on opcode and can be the following:

@@ -410,7 +410,7 @@ position, ‘this’ binding, lexical environment.
  • object
  • -

    ECMA value representation

    +

    ECMA value representation

    The immediate value is placed in higher bits. “Simple value” is an enumeration, which consists of the following elements:
    - undefined
    @@ -426,7 +426,7 @@ position, ‘this’ binding, lexical environment.

    Compressed pointers were introduced to save heap space. They are possible because heap size is currently limited by 256 KB, which requires 18 bits to cover it. ECMA values in heap are aligned by 8 bytes and this allows to save three more bits, so that compressed pointer consumes 15 bits only.

    -

    Heap and ECMA elements

    +

    Heap and ECMA elements

    ECMA data elements are allocated in pools (pools are allocated on heap)
    Chunk size of the pool is 8 bytes (reduces fragmentation).

    @@ -466,7 +466,7 @@ Chunk size of the pool is 8 bytes (reduces fragmentation).

    Remaining fields of these structures are different and are shown on the picture.

    -

    Object/Lexicat environment structures

    +

    Object/Lexicat environment structures

    Property of an object / description of a lexical environment variable

    @@ -480,7 +480,7 @@ Chunk size of the pool is 8 bytes (reduces fragmentation).

    - next property/variable in the object/lexical environment (compressed pointer)

    The remaining parts are differnt:
    -Object property/lexcial environment variable

    +Object property/lexcial environment variable

    Collections

    @@ -530,7 +530,7 @@ Chunk size of the pool is 8 bytes (reduces fragmentation).

    LCache is a cache for property variable search requests.

    -

    LCache

    +

    LCache

    Entry of LCache has the following layout:
    - object pointer
    @@ -556,7 +556,7 @@ or

    Many algorithms/routines described in ECMA return a value of “completion” type, that is triplet of the following form:

    -

    ECMA completion

    +

    ECMA completion

    Jerry introduces two additional completion types:
    - exit - produced by exitval opcode, indicates request to finish execution