Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
wine
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Package registry
Container Registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Lorenzo Ferrillo
wine
Commits
b3feafab
Commit
b3feafab
authored
13 years ago
by
Jacek Caban
Committed by
Alexandre Julliard
13 years ago
Browse files
Options
Downloads
Patches
Plain Diff
jscript: Use bytecode for int literal implementation.
parent
1c824ea6
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
dlls/jscript/compile.c
+26
-0
26 additions, 0 deletions
dlls/jscript/compile.c
dlls/jscript/engine.c
+13
-0
13 additions, 0 deletions
dlls/jscript/engine.c
dlls/jscript/engine.h
+4
-1
4 additions, 1 deletion
dlls/jscript/engine.h
with
43 additions
and
1 deletion
dlls/jscript/compile.c
+
26
−
0
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
:
...
...
This diff is collapsed.
Click to expand it.
dlls/jscript/engine.c
+
13
−
0
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
)
{
...
...
This diff is collapsed.
Click to expand it.
dlls/jscript/engine.h
+
4
−
1
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
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment