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
983bbab5
Commit
983bbab5
authored
Aug 04, 2016
by
Jacek Caban
Committed by
Alexandre Julliard
Aug 04, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jscript: Replaced OP_ident with static binding when possible.
Signed-off-by:
Jacek Caban
<
jacek@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
04617ddf
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
48 additions
and
14 deletions
+48
-14
compile.c
dlls/jscript/compile.c
+9
-1
engine.c
dlls/jscript/engine.c
+38
-13
engine.h
dlls/jscript/engine.h
+1
-0
No files found.
dlls/jscript/compile.c
View file @
983bbab5
...
...
@@ -434,6 +434,14 @@ static HRESULT emit_identifier_ref(compiler_ctx_t *ctx, const WCHAR *identifier,
return
push_instr_bstr_uint
(
ctx
,
OP_identid
,
identifier
,
flags
);
}
static
HRESULT
emit_identifier
(
compiler_ctx_t
*
ctx
,
const
WCHAR
*
identifier
)
{
int
local_ref
;
if
(
bind_local
(
ctx
,
identifier
,
&
local_ref
))
return
push_instr_int
(
ctx
,
OP_local
,
local_ref
);
return
push_instr_bstr
(
ctx
,
OP_ident
,
identifier
);
}
static
HRESULT
compile_memberid_expression
(
compiler_ctx_t
*
ctx
,
expression_t
*
expr
,
unsigned
flags
)
{
HRESULT
hres
=
S_OK
;
...
...
@@ -994,7 +1002,7 @@ static HRESULT compile_expression(compiler_ctx_t *ctx, expression_t *expr, BOOL
hres
=
compile_binary_expression
(
ctx
,
(
binary_expression_t
*
)
expr
,
OP_gteq
);
break
;
case
EXPR_IDENT
:
hres
=
push_instr_bstr
(
ctx
,
OP_ident
,
((
identifier_expression_t
*
)
expr
)
->
identifier
);
hres
=
emit_identifier
(
ctx
,
((
identifier_expression_t
*
)
expr
)
->
identifier
);
break
;
case
EXPR_IN
:
hres
=
compile_binary_expression
(
ctx
,
(
binary_expression_t
*
)
expr
,
OP_in
);
...
...
dlls/jscript/engine.c
View file @
983bbab5
...
...
@@ -1225,6 +1225,26 @@ static HRESULT interp_identifier_ref(script_ctx_t *ctx, BSTR identifier, unsigne
return
stack_push_exprval
(
ctx
,
&
exprval
);
}
static
HRESULT
identifier_value
(
script_ctx_t
*
ctx
,
BSTR
identifier
)
{
exprval_t
exprval
;
jsval_t
v
;
HRESULT
hres
;
hres
=
identifier_eval
(
ctx
,
identifier
,
&
exprval
);
if
(
FAILED
(
hres
))
return
hres
;
if
(
exprval
.
type
==
EXPRVAL_INVALID
)
return
throw_type_error
(
ctx
,
exprval
.
u
.
hres
,
identifier
);
hres
=
exprval_to_value
(
ctx
,
&
exprval
,
&
v
);
if
(
FAILED
(
hres
))
return
hres
;
return
stack_push
(
ctx
,
v
);
}
static
HRESULT
interp_local_ref
(
script_ctx_t
*
ctx
)
{
const
int
arg
=
get_op_int
(
ctx
,
0
);
...
...
@@ -1242,28 +1262,33 @@ static HRESULT interp_local_ref(script_ctx_t *ctx)
return
stack_push_exprval
(
ctx
,
&
ref
);
}
/* ECMA-262 3rd Edition 10.1.4 */
static
HRESULT
interp_ident
(
script_ctx_t
*
ctx
)
static
HRESULT
interp_local
(
script_ctx_t
*
ctx
)
{
const
BSTR
arg
=
get_op_bstr
(
ctx
,
0
);
exprval_t
exprval
;
jsval_t
v
;
const
int
arg
=
get_op_int
(
ctx
,
0
);
call_frame_t
*
frame
=
ctx
->
call_ctx
;
jsval_t
copy
;
HRESULT
hres
;
TRACE
(
"%
s
\n
"
,
debugstr_w
(
arg
)
);
TRACE
(
"%
d
\n
"
,
arg
);
hres
=
identifier_eval
(
ctx
,
arg
,
&
exprval
);
if
(
!
frame
->
base_scope
||
!
frame
->
base_scope
->
frame
)
return
identifier_value
(
ctx
,
local_name
(
frame
,
arg
));
hres
=
jsval_copy
(
ctx
->
stack
[
local_off
(
frame
,
arg
)],
&
copy
);
if
(
FAILED
(
hres
))
return
hres
;
if
(
exprval
.
type
==
EXPRVAL_INVALID
)
return
throw_type_error
(
ctx
,
exprval
.
u
.
hres
,
arg
);
return
stack_push
(
ctx
,
copy
);
}
hres
=
exprval_to_value
(
ctx
,
&
exprval
,
&
v
);
if
(
FAILED
(
hres
))
return
hres
;
/* ECMA-262 3rd Edition 10.1.4 */
static
HRESULT
interp_ident
(
script_ctx_t
*
ctx
)
{
const
BSTR
arg
=
get_op_bstr
(
ctx
,
0
);
return
stack_push
(
ctx
,
v
);
TRACE
(
"%s
\n
"
,
debugstr_w
(
arg
));
return
identifier_value
(
ctx
,
arg
);
}
/* ECMA-262 3rd Edition 10.1.4 */
...
...
dlls/jscript/engine.h
View file @
983bbab5
...
...
@@ -48,6 +48,7 @@
X(int, 1, ARG_INT, 0) \
X(jmp, 0, ARG_ADDR, 0) \
X(jmp_z, 0, ARG_ADDR, 0) \
X(local, 1, ARG_INT, 0) \
X(local_ref, 1, ARG_INT, ARG_UINT) \
X(lshift, 1, 0,0) \
X(lt, 1, 0,0) \
...
...
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