Github User Fetcher 1.0.0
C Application with Server and GUI
Loading...
Searching...
No Matches
duk_js_compiler.h File Reference

Go to the source code of this file.

Data Structures

struct  duk_ispec
 
struct  duk_ivalue
 
struct  duk_compiler_instr
 
struct  duk_labelinfo
 
struct  duk_compiler_func
 
struct  duk_compiler_ctx
 

Macros

#define DUK_COMPILER_TOKEN_LIMIT   100000000L /* 1e8: protects against deeply nested inner functions */
 
#define DUK_COMPILER_PEEPHOLE_MAXITER   3
 
#define DUK_COMPILER_MAX_BYTECODE_LENGTH   (256L * 1024L * 1024L) /* 1 GB */
 
#define DUK_IVAL_NONE   0 /* no value */
 
#define DUK_IVAL_PLAIN   1 /* register, constant, or value */
 
#define DUK_IVAL_ARITH   2 /* binary arithmetic; DUK_OP_ADD, DUK_OP_EQ, other binary ops */
 
#define DUK_IVAL_ARITH_EXTRAOP   3 /* binary arithmetic using extraops; DUK_EXTRAOP_INSTOF etc */
 
#define DUK_IVAL_PROP   4 /* property access */
 
#define DUK_IVAL_VAR   5 /* variable access */
 
#define DUK_ISPEC_NONE   0 /* no value */
 
#define DUK_ISPEC_VALUE   1 /* value resides in 'valstack_idx' */
 
#define DUK_ISPEC_REGCONST   2 /* value resides in a register or constant */
 
#define DUK_JS_CONST_MARKER   0x80000000UL
 
#define DUK_LABEL_FLAG_ALLOW_BREAK   (1 << 0)
 
#define DUK_LABEL_FLAG_ALLOW_CONTINUE   (1 << 1)
 
#define DUK_DECL_TYPE_VAR   0
 
#define DUK_DECL_TYPE_FUNC   1
 
#define DUK_JS_COMPILE_FLAG_EVAL   (1 << 0) /* source is eval code (not global) */
 
#define DUK_JS_COMPILE_FLAG_STRICT   (1 << 1) /* strict outer context */
 
#define DUK_JS_COMPILE_FLAG_FUNCEXPR   (1 << 2) /* source is a function expression (used for Function constructor) */
 

Typedefs

typedef duk_uint32_t duk_regconst_t
 
typedef duk_int32_t duk_reg_t
 

Functions

DUK_INTERNAL_DECL void duk_js_compile (duk_hthread *thr, const duk_uint8_t *src_buffer, duk_size_t src_length, duk_small_uint_t flags)
 

Macro Definition Documentation

◆ DUK_COMPILER_MAX_BYTECODE_LENGTH

#define DUK_COMPILER_MAX_BYTECODE_LENGTH   (256L * 1024L * 1024L) /* 1 GB */

Definition at line 15 of file duktape-1.5.2/src-separate/duk_js_compiler.h.

◆ DUK_COMPILER_PEEPHOLE_MAXITER

#define DUK_COMPILER_PEEPHOLE_MAXITER   3

Definition at line 12 of file duktape-1.5.2/src-separate/duk_js_compiler.h.

◆ DUK_COMPILER_TOKEN_LIMIT

#define DUK_COMPILER_TOKEN_LIMIT   100000000L /* 1e8: protects against deeply nested inner functions */

Definition at line 9 of file duktape-1.5.2/src-separate/duk_js_compiler.h.

◆ DUK_DECL_TYPE_FUNC

#define DUK_DECL_TYPE_FUNC   1

Definition at line 87 of file duktape-1.5.2/src-separate/duk_js_compiler.h.

◆ DUK_DECL_TYPE_VAR

#define DUK_DECL_TYPE_VAR   0

Definition at line 86 of file duktape-1.5.2/src-separate/duk_js_compiler.h.

◆ DUK_ISPEC_NONE

#define DUK_ISPEC_NONE   0 /* no value */

Definition at line 32 of file duktape-1.5.2/src-separate/duk_js_compiler.h.

◆ DUK_ISPEC_REGCONST

#define DUK_ISPEC_REGCONST   2 /* value resides in a register or constant */

Definition at line 34 of file duktape-1.5.2/src-separate/duk_js_compiler.h.

◆ DUK_ISPEC_VALUE

#define DUK_ISPEC_VALUE   1 /* value resides in 'valstack_idx' */

Definition at line 33 of file duktape-1.5.2/src-separate/duk_js_compiler.h.

◆ DUK_IVAL_ARITH

#define DUK_IVAL_ARITH   2 /* binary arithmetic; DUK_OP_ADD, DUK_OP_EQ, other binary ops */

Definition at line 27 of file duktape-1.5.2/src-separate/duk_js_compiler.h.

◆ DUK_IVAL_ARITH_EXTRAOP

#define DUK_IVAL_ARITH_EXTRAOP   3 /* binary arithmetic using extraops; DUK_EXTRAOP_INSTOF etc */

Definition at line 28 of file duktape-1.5.2/src-separate/duk_js_compiler.h.

◆ DUK_IVAL_NONE

#define DUK_IVAL_NONE   0 /* no value */

Definition at line 25 of file duktape-1.5.2/src-separate/duk_js_compiler.h.

◆ DUK_IVAL_PLAIN

#define DUK_IVAL_PLAIN   1 /* register, constant, or value */

Definition at line 26 of file duktape-1.5.2/src-separate/duk_js_compiler.h.

◆ DUK_IVAL_PROP

#define DUK_IVAL_PROP   4 /* property access */

Definition at line 29 of file duktape-1.5.2/src-separate/duk_js_compiler.h.

◆ DUK_IVAL_VAR

#define DUK_IVAL_VAR   5 /* variable access */

Definition at line 30 of file duktape-1.5.2/src-separate/duk_js_compiler.h.

◆ DUK_JS_COMPILE_FLAG_EVAL

#define DUK_JS_COMPILE_FLAG_EVAL   (1 << 0) /* source is eval code (not global) */

◆ DUK_JS_COMPILE_FLAG_FUNCEXPR

#define DUK_JS_COMPILE_FLAG_FUNCEXPR   (1 << 2) /* source is a function expression (used for Function constructor) */

◆ DUK_JS_COMPILE_FLAG_STRICT

#define DUK_JS_COMPILE_FLAG_STRICT   (1 << 1) /* strict outer context */

◆ DUK_JS_CONST_MARKER

#define DUK_JS_CONST_MARKER   0x80000000UL

Definition at line 37 of file duktape-1.5.2/src-separate/duk_js_compiler.h.

◆ DUK_LABEL_FLAG_ALLOW_BREAK

#define DUK_LABEL_FLAG_ALLOW_BREAK   (1 << 0)

Definition at line 83 of file duktape-1.5.2/src-separate/duk_js_compiler.h.

◆ DUK_LABEL_FLAG_ALLOW_CONTINUE

#define DUK_LABEL_FLAG_ALLOW_CONTINUE   (1 << 1)

Definition at line 84 of file duktape-1.5.2/src-separate/duk_js_compiler.h.

Typedef Documentation

◆ duk_reg_t

typedef duk_int32_t duk_reg_t

Definition at line 43 of file duktape-1.5.2/src-separate/duk_js_compiler.h.

◆ duk_regconst_t

typedef duk_uint32_t duk_regconst_t

Definition at line 40 of file duktape-1.5.2/src-separate/duk_js_compiler.h.

Function Documentation

◆ duk_js_compile()

DUK_INTERNAL_DECL void duk_js_compile ( duk_hthread * thr,
const duk_uint8_t * src_buffer,
duk_size_t src_length,
duk_small_uint_t flags )

Definition at line 65184 of file duktape-1.5.2/src-noline/duktape.c.

65201 {
65202 duk_context *ctx = (duk_context *) thr;
65203 duk__compiler_stkstate comp_stk;
65204 duk_compiler_ctx *prev_ctx;
65205 duk_ret_t safe_rc;
65206
65207 /* XXX: this illustrates that a C catchpoint implemented using duk_safe_call()
65208 * is a bit heavy at the moment. The wrapper compiles to ~180 bytes on x64.
65209 * Alternatives would be nice.
65210 */
65211
65212 DUK_ASSERT(thr != NULL);
65213 DUK_ASSERT(src_buffer != NULL);
65214
65215 /* preinitialize lexer state partially */
65216 DUK_MEMZERO(&comp_stk, sizeof(comp_stk));
65217 comp_stk.flags = flags;
65219 comp_stk.comp_ctx_alloc.lex.input = src_buffer;
duk_small_int_t duk_ret_t
#define DUK_MEMZERO(p, n)
#define DUK_LEXER_INITCTX(ctx)
#define NULL
Definition gmacros.h:924