Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
b3feafab
Commit
b3feafab
authored
Nov 23, 2011
by
Jacek Caban
Committed by
Alexandre Julliard
Nov 23, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jscript: Use bytecode for int literal implementation.
parent
1c824ea6
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
43 additions
and
1 deletion
+43
-1
compile.c
dlls/jscript/compile.c
+26
-0
engine.c
dlls/jscript/engine.c
+13
-0
engine.h
dlls/jscript/engine.h
+4
-1
No files found.
dlls/jscript/compile.c
View file @
b3feafab
...
...
@@ -66,6 +66,18 @@ static inline instr_t *instr_ptr(compiler_ctx_t *ctx, unsigned off)
return
ctx
->
code
->
instrs
+
off
;
}
static
HRESULT
push_instr_int
(
compiler_ctx_t
*
ctx
,
jsop_t
op
,
LONG
arg
)
{
unsigned
instr
;
instr
=
push_instr
(
ctx
,
op
);
if
(
instr
==
-
1
)
return
E_OUTOFMEMORY
;
instr_ptr
(
ctx
,
instr
)
->
arg1
.
lng
=
arg
;
return
S_OK
;
}
static
HRESULT
compile_binary_expression
(
compiler_ctx_t
*
ctx
,
binary_expression_t
*
expr
,
jsop_t
op
)
{
HRESULT
hres
;
...
...
@@ -104,6 +116,18 @@ static HRESULT compile_interp_fallback(compiler_ctx_t *ctx, expression_t *expr)
return
S_OK
;
}
static
HRESULT
compile_literal
(
compiler_ctx_t
*
ctx
,
literal_expression_t
*
expr
)
{
literal_t
*
literal
=
expr
->
literal
;
switch
(
literal
->
type
)
{
case
LT_INT
:
return
push_instr_int
(
ctx
,
OP_int
,
literal
->
u
.
lval
);
default:
return
compile_interp_fallback
(
ctx
,
&
expr
->
expr
);
}
}
static
HRESULT
compile_expression
(
compiler_ctx_t
*
ctx
,
expression_t
*
expr
)
{
switch
(
expr
->
type
)
{
...
...
@@ -115,6 +139,8 @@ static HRESULT compile_expression(compiler_ctx_t *ctx, expression_t *expr)
return
compile_binary_expression
(
ctx
,
(
binary_expression_t
*
)
expr
,
OP_eq2
);
case
EXPR_IN
:
return
compile_binary_expression
(
ctx
,
(
binary_expression_t
*
)
expr
,
OP_in
);
case
EXPR_LITERAL
:
return
compile_literal
(
ctx
,
(
literal_expression_t
*
)
expr
);
case
EXPR_LOGNEG
:
return
compile_unary_expression
(
ctx
,
(
unary_expression_t
*
)
expr
,
OP_neg
);
case
EXPR_NOTEQEQ
:
...
...
dlls/jscript/engine.c
View file @
b3feafab
...
...
@@ -1724,6 +1724,19 @@ HRESULT identifier_expression_eval(script_ctx_t *ctx, expression_t *_expr, DWORD
return
hres
;
}
/* ECMA-262 3rd Edition 7.8.3 */
HRESULT
interp_int
(
exec_ctx_t
*
ctx
)
{
const
LONG
arg
=
ctx
->
parser
->
code
->
instrs
[
ctx
->
ip
].
arg1
.
lng
;
VARIANT
v
;
TRACE
(
"%d
\n
"
,
arg
);
V_VT
(
&
v
)
=
VT_I4
;
V_I4
(
&
v
)
=
arg
;
return
stack_push
(
ctx
,
&
v
);
}
/* ECMA-262 3rd Edition 7.8 */
HRESULT
literal_expression_eval
(
script_ctx_t
*
ctx
,
expression_t
*
_expr
,
DWORD
flags
,
jsexcept_t
*
ei
,
exprval_t
*
ret
)
{
...
...
dlls/jscript/engine.h
View file @
b3feafab
...
...
@@ -46,6 +46,7 @@ typedef struct _func_stack {
X(bneg, 1, 0) \
X(eq2, 1, 0) \
X(in, 1, 0) \
X(int, 1, ARG_INT) \
X(neg, 1, 0) \
X(neq2, 1, 0) \
X(tonum, 1, 0) \
...
...
@@ -61,11 +62,13 @@ OP_LIST
typedef
union
{
expression_t
*
expr
;
LONG
lng
;
}
instr_arg_t
;
typedef
enum
{
ARG_NONE
=
0
,
ARG_EXPR
ARG_EXPR
,
ARG_INT
}
instr_arg_type_t
;
typedef
struct
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment