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
ccba279b
Commit
ccba279b
authored
Dec 19, 2011
by
Jacek Caban
Committed by
Alexandre Julliard
Dec 19, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jscript: Use compiler for handling expression statements.
parent
2f3e27f0
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
83 additions
and
77 deletions
+83
-77
compile.c
dlls/jscript/compile.c
+19
-0
engine.c
dlls/jscript/engine.c
+62
-74
engine.h
dlls/jscript/engine.h
+1
-2
parser.y
dlls/jscript/parser.y
+1
-1
No files found.
dlls/jscript/compile.c
View file @
ccba279b
...
...
@@ -865,11 +865,30 @@ static HRESULT compile_block_statement(compiler_ctx_t *ctx, statement_t *iter)
return
S_OK
;
}
/* ECMA-262 3rd Edition 12.4 */
static
HRESULT
compile_expression_statement
(
compiler_ctx_t
*
ctx
,
expression_statement_t
*
stat
)
{
BOOL
no_ret
=
FALSE
;
HRESULT
hres
;
hres
=
compile_expression_noret
(
ctx
,
stat
->
expr
,
&
no_ret
);
if
(
FAILED
(
hres
))
return
hres
;
/* FIXME: that's a big potential optimization */
if
(
no_ret
&&
!
push_instr
(
ctx
,
OP_undefined
)
==
-
1
)
return
E_OUTOFMEMORY
;
return
S_OK
;
}
static
HRESULT
compile_statement
(
compiler_ctx_t
*
ctx
,
statement_t
*
stat
)
{
switch
(
stat
->
type
)
{
case
STAT_BLOCK
:
return
compile_block_statement
(
ctx
,
((
block_statement_t
*
)
stat
)
->
stat_list
);
case
STAT_EXPR
:
return
compile_expression_statement
(
ctx
,
(
expression_statement_t
*
)
stat
);
default:
return
compile_interp_fallback
(
ctx
,
stat
);
}
...
...
dlls/jscript/engine.c
View file @
ccba279b
...
...
@@ -161,7 +161,7 @@ static HRESULT stack_pop_number(exec_ctx_t *ctx, VARIANT *r)
HRESULT
hres
;
v
=
stack_pop
(
ctx
);
hres
=
to_number
(
ctx
->
parser
->
script
,
v
,
&
ctx
->
ei
,
r
);
hres
=
to_number
(
ctx
->
parser
->
script
,
v
,
ctx
->
ei
,
r
);
VariantClear
(
v
);
return
hres
;
}
...
...
@@ -174,7 +174,7 @@ static HRESULT stack_pop_object(exec_ctx_t *ctx, IDispatch **r)
v
=
stack_pop
(
ctx
);
if
(
V_VT
(
v
)
==
VT_DISPATCH
)
{
if
(
!
V_DISPATCH
(
v
))
return
throw_type_error
(
ctx
->
parser
->
script
,
&
ctx
->
ei
,
JS_E_OBJECT_REQUIRED
,
NULL
);
return
throw_type_error
(
ctx
->
parser
->
script
,
ctx
->
ei
,
JS_E_OBJECT_REQUIRED
,
NULL
);
*
r
=
V_DISPATCH
(
v
);
return
S_OK
;
}
...
...
@@ -186,12 +186,12 @@ static HRESULT stack_pop_object(exec_ctx_t *ctx, IDispatch **r)
static
inline
HRESULT
stack_pop_int
(
exec_ctx_t
*
ctx
,
INT
*
r
)
{
return
to_int32
(
ctx
->
parser
->
script
,
stack_pop
(
ctx
),
&
ctx
->
ei
,
r
);
return
to_int32
(
ctx
->
parser
->
script
,
stack_pop
(
ctx
),
ctx
->
ei
,
r
);
}
static
inline
HRESULT
stack_pop_uint
(
exec_ctx_t
*
ctx
,
DWORD
*
r
)
{
return
to_uint32
(
ctx
->
parser
->
script
,
stack_pop
(
ctx
),
&
ctx
->
ei
,
r
);
return
to_uint32
(
ctx
->
parser
->
script
,
stack_pop
(
ctx
),
ctx
->
ei
,
r
);
}
static
inline
IDispatch
*
stack_pop_objid
(
exec_ctx_t
*
ctx
,
DISPID
*
id
)
...
...
@@ -712,24 +712,6 @@ HRESULT empty_statement_eval(script_ctx_t *ctx, statement_t *stat, return_type_t
return
S_OK
;
}
/* ECMA-262 3rd Edition 12.4 */
HRESULT
expression_statement_eval
(
script_ctx_t
*
ctx
,
statement_t
*
_stat
,
return_type_t
*
rt
,
VARIANT
*
ret
)
{
expression_statement_t
*
stat
=
(
expression_statement_t
*
)
_stat
;
VARIANT
val
;
HRESULT
hres
;
TRACE
(
"
\n
"
);
hres
=
expr_eval
(
ctx
,
stat
->
expr
,
EXPR_NOVAL
,
&
rt
->
ei
,
&
val
);
if
(
FAILED
(
hres
))
return
hres
;
*
ret
=
val
;
TRACE
(
"= %s
\n
"
,
debugstr_variant
(
ret
));
return
S_OK
;
}
/* ECMA-262 3rd Edition 12.5 */
HRESULT
if_statement_eval
(
script_ctx_t
*
ctx
,
statement_t
*
_stat
,
return_type_t
*
rt
,
VARIANT
*
ret
)
{
...
...
@@ -1190,7 +1172,7 @@ static HRESULT interp_throw(exec_ctx_t *ctx)
TRACE
(
"%08x
\n
"
,
arg
);
return
throw_reference_error
(
ctx
->
parser
->
script
,
&
ctx
->
ei
,
arg
,
NULL
);
return
throw_reference_error
(
ctx
->
parser
->
script
,
ctx
->
ei
,
arg
,
NULL
);
}
static
HRESULT
interp_throw_type
(
exec_ctx_t
*
ctx
)
...
...
@@ -1200,7 +1182,7 @@ static HRESULT interp_throw_type(exec_ctx_t *ctx)
TRACE
(
"%08x %s
\n
"
,
hres
,
debugstr_w
(
str
));
return
throw_type_error
(
ctx
->
parser
->
script
,
&
ctx
->
ei
,
hres
,
str
);
return
throw_type_error
(
ctx
->
parser
->
script
,
ctx
->
ei
,
hres
,
str
);
}
/* ECMA-262 3rd Edition 12.14 */
...
...
@@ -1344,7 +1326,7 @@ static HRESULT interp_array(exec_ctx_t *ctx)
return
hres
;
}
hres
=
to_string
(
ctx
->
parser
->
script
,
namev
,
&
ctx
->
ei
,
&
name
);
hres
=
to_string
(
ctx
->
parser
->
script
,
namev
,
ctx
->
ei
,
&
name
);
VariantClear
(
namev
);
if
(
FAILED
(
hres
))
{
IDispatch_Release
(
obj
);
...
...
@@ -1354,7 +1336,7 @@ static HRESULT interp_array(exec_ctx_t *ctx)
hres
=
disp_get_id
(
ctx
->
parser
->
script
,
obj
,
name
,
0
,
&
id
);
SysFreeString
(
name
);
if
(
SUCCEEDED
(
hres
))
{
hres
=
disp_propget
(
ctx
->
parser
->
script
,
obj
,
id
,
&
v
,
&
ctx
->
ei
,
NULL
/*FIXME*/
);
hres
=
disp_propget
(
ctx
->
parser
->
script
,
obj
,
id
,
&
v
,
ctx
->
ei
,
NULL
/*FIXME*/
);
}
else
if
(
hres
==
DISP_E_UNKNOWNNAME
)
{
V_VT
(
&
v
)
=
VT_EMPTY
;
hres
=
S_OK
;
...
...
@@ -1420,7 +1402,7 @@ static HRESULT interp_member(exec_ctx_t *ctx)
hres
=
disp_get_id
(
ctx
->
parser
->
script
,
obj
,
arg
,
0
,
&
id
);
if
(
SUCCEEDED
(
hres
))
{
V_VT
(
&
v
)
=
VT_EMPTY
;
hres
=
disp_propget
(
ctx
->
parser
->
script
,
obj
,
id
,
&
v
,
&
ctx
->
ei
,
NULL
/*FIXME*/
);
hres
=
disp_propget
(
ctx
->
parser
->
script
,
obj
,
id
,
&
v
,
ctx
->
ei
,
NULL
/*FIXME*/
);
}
else
if
(
hres
==
DISP_E_UNKNOWNNAME
)
{
V_VT
(
&
v
)
=
VT_EMPTY
;
hres
=
S_OK
;
...
...
@@ -1450,7 +1432,7 @@ static HRESULT interp_memberid(exec_ctx_t *ctx)
hres
=
to_object
(
ctx
->
parser
->
script
,
objv
,
&
obj
);
VariantClear
(
objv
);
if
(
SUCCEEDED
(
hres
))
{
hres
=
to_string
(
ctx
->
parser
->
script
,
namev
,
&
ctx
->
ei
,
&
name
);
hres
=
to_string
(
ctx
->
parser
->
script
,
namev
,
ctx
->
ei
,
&
name
);
if
(
FAILED
(
hres
))
IDispatch_Release
(
obj
);
}
...
...
@@ -1485,9 +1467,9 @@ static HRESULT interp_refval(exec_ctx_t *ctx)
disp
=
stack_topn_objid
(
ctx
,
0
,
&
id
);
if
(
!
disp
)
return
throw_reference_error
(
ctx
->
parser
->
script
,
&
ctx
->
ei
,
JS_E_ILLEGAL_ASSIGN
,
NULL
);
return
throw_reference_error
(
ctx
->
parser
->
script
,
ctx
->
ei
,
JS_E_ILLEGAL_ASSIGN
,
NULL
);
hres
=
disp_propget
(
ctx
->
parser
->
script
,
disp
,
id
,
&
v
,
&
ctx
->
ei
,
NULL
/*FIXME*/
);
hres
=
disp_propget
(
ctx
->
parser
->
script
,
disp
,
id
,
&
v
,
ctx
->
ei
,
NULL
/*FIXME*/
);
if
(
FAILED
(
hres
))
return
hres
;
...
...
@@ -1529,15 +1511,15 @@ static HRESULT interp_new(exec_ctx_t *ctx)
/* NOTE: Should use to_object here */
if
(
V_VT
(
constr
)
==
VT_NULL
)
return
throw_type_error
(
ctx
->
parser
->
script
,
&
ctx
->
ei
,
JS_E_OBJECT_EXPECTED
,
NULL
);
return
throw_type_error
(
ctx
->
parser
->
script
,
ctx
->
ei
,
JS_E_OBJECT_EXPECTED
,
NULL
);
else
if
(
V_VT
(
constr
)
!=
VT_DISPATCH
)
return
throw_type_error
(
ctx
->
parser
->
script
,
&
ctx
->
ei
,
JS_E_INVALID_ACTION
,
NULL
);
return
throw_type_error
(
ctx
->
parser
->
script
,
ctx
->
ei
,
JS_E_INVALID_ACTION
,
NULL
);
else
if
(
!
V_DISPATCH
(
constr
))
return
throw_type_error
(
ctx
->
parser
->
script
,
&
ctx
->
ei
,
JS_E_INVALID_PROPERTY
,
NULL
);
return
throw_type_error
(
ctx
->
parser
->
script
,
ctx
->
ei
,
JS_E_INVALID_PROPERTY
,
NULL
);
jsstack_to_dp
(
ctx
,
arg
,
&
dp
);
hres
=
disp_call
(
ctx
->
parser
->
script
,
V_DISPATCH
(
constr
),
DISPID_VALUE
,
DISPATCH_CONSTRUCT
,
&
dp
,
&
v
,
&
ctx
->
ei
,
NULL
/*FIXME*/
);
DISPATCH_CONSTRUCT
,
&
dp
,
&
v
,
ctx
->
ei
,
NULL
/*FIXME*/
);
if
(
FAILED
(
hres
))
return
hres
;
...
...
@@ -1558,11 +1540,11 @@ static HRESULT interp_call(exec_ctx_t *ctx)
objv
=
stack_topn
(
ctx
,
argn
);
if
(
V_VT
(
objv
)
!=
VT_DISPATCH
)
return
throw_type_error
(
ctx
->
parser
->
script
,
&
ctx
->
ei
,
JS_E_INVALID_PROPERTY
,
NULL
);
return
throw_type_error
(
ctx
->
parser
->
script
,
ctx
->
ei
,
JS_E_INVALID_PROPERTY
,
NULL
);
jsstack_to_dp
(
ctx
,
argn
,
&
dp
);
hres
=
disp_call
(
ctx
->
parser
->
script
,
V_DISPATCH
(
objv
),
DISPID_VALUE
,
DISPATCH_METHOD
,
&
dp
,
do_ret
?
&
v
:
NULL
,
&
ctx
->
ei
,
NULL
/*FIXME*/
);
do_ret
?
&
v
:
NULL
,
ctx
->
ei
,
NULL
/*FIXME*/
);
if
(
FAILED
(
hres
))
return
hres
;
...
...
@@ -1586,10 +1568,10 @@ static HRESULT interp_call_member(exec_ctx_t *ctx)
obj
=
stack_topn_objid
(
ctx
,
argn
,
&
id
);
if
(
!
obj
)
return
throw_type_error
(
ctx
->
parser
->
script
,
&
ctx
->
ei
,
id
,
NULL
);
return
throw_type_error
(
ctx
->
parser
->
script
,
ctx
->
ei
,
id
,
NULL
);
jsstack_to_dp
(
ctx
,
argn
,
&
dp
);
hres
=
disp_call
(
ctx
->
parser
->
script
,
obj
,
id
,
DISPATCH_METHOD
,
&
dp
,
do_ret
?
&
v
:
NULL
,
&
ctx
->
ei
,
NULL
/*FIXME*/
);
hres
=
disp_call
(
ctx
->
parser
->
script
,
obj
,
id
,
DISPATCH_METHOD
,
&
dp
,
do_ret
?
&
v
:
NULL
,
ctx
->
ei
,
NULL
/*FIXME*/
);
if
(
FAILED
(
hres
))
return
hres
;
...
...
@@ -1640,11 +1622,11 @@ static HRESULT interp_ident(exec_ctx_t *ctx)
TRACE
(
"%s
\n
"
,
debugstr_w
(
arg
));
hres
=
identifier_eval
(
ctx
->
parser
->
script
,
arg
,
0
,
&
ctx
->
ei
,
&
exprval
);
hres
=
identifier_eval
(
ctx
->
parser
->
script
,
arg
,
0
,
ctx
->
ei
,
&
exprval
);
if
(
FAILED
(
hres
))
return
hres
;
hres
=
exprval_to_value
(
ctx
->
parser
->
script
,
&
exprval
,
&
ctx
->
ei
,
&
v
);
hres
=
exprval_to_value
(
ctx
->
parser
->
script
,
&
exprval
,
ctx
->
ei
,
&
v
);
exprval_release
(
&
exprval
);
if
(
FAILED
(
hres
))
return
hres
;
...
...
@@ -1662,7 +1644,7 @@ static HRESULT interp_identid(exec_ctx_t *ctx)
TRACE
(
"%s %x
\n
"
,
debugstr_w
(
arg
),
flags
);
hres
=
identifier_eval
(
ctx
->
parser
->
script
,
arg
,
flags
,
&
ctx
->
ei
,
&
exprval
);
hres
=
identifier_eval
(
ctx
->
parser
->
script
,
arg
,
flags
,
ctx
->
ei
,
&
exprval
);
if
(
FAILED
(
hres
))
return
hres
;
...
...
@@ -1775,7 +1757,7 @@ static HRESULT interp_carray(exec_ctx_t *ctx)
i
=
arg
;
while
(
i
--
)
{
v
=
stack_pop
(
ctx
);
hres
=
jsdisp_propput_idx
(
array
,
i
,
v
,
&
ctx
->
ei
,
NULL
/*FIXME*/
);
hres
=
jsdisp_propput_idx
(
array
,
i
,
v
,
ctx
->
ei
,
NULL
/*FIXME*/
);
VariantClear
(
v
);
if
(
FAILED
(
hres
))
{
jsdisp_release
(
array
);
...
...
@@ -1819,7 +1801,7 @@ HRESULT interp_obj_prop(exec_ctx_t *ctx)
assert
(
V_VT
(
stack_top
(
ctx
))
==
VT_DISPATCH
);
obj
=
as_jsdisp
(
V_DISPATCH
(
stack_top
(
ctx
)));
hres
=
jsdisp_propput_name
(
obj
,
name
,
v
,
&
ctx
->
ei
,
NULL
/*FIXME*/
);
hres
=
jsdisp_propput_name
(
obj
,
name
,
v
,
ctx
->
ei
,
NULL
/*FIXME*/
);
VariantClear
(
v
);
return
hres
;
}
...
...
@@ -1938,7 +1920,7 @@ static HRESULT interp_instanceof(exec_ctx_t *ctx)
v
=
stack_pop
(
ctx
);
if
(
V_VT
(
v
)
!=
VT_DISPATCH
||
!
V_DISPATCH
(
v
))
{
VariantClear
(
v
);
return
throw_type_error
(
ctx
->
parser
->
script
,
&
ctx
->
ei
,
JS_E_FUNCTION_EXPECTED
,
NULL
);
return
throw_type_error
(
ctx
->
parser
->
script
,
ctx
->
ei
,
JS_E_FUNCTION_EXPECTED
,
NULL
);
}
obj
=
iface_to_jsdisp
((
IUnknown
*
)
V_DISPATCH
(
v
));
...
...
@@ -1949,9 +1931,9 @@ static HRESULT interp_instanceof(exec_ctx_t *ctx)
}
if
(
is_class
(
obj
,
JSCLASS_FUNCTION
))
{
hres
=
jsdisp_propget_name
(
obj
,
prototypeW
,
&
prot
,
&
ctx
->
ei
,
NULL
/*FIXME*/
);
hres
=
jsdisp_propget_name
(
obj
,
prototypeW
,
&
prot
,
ctx
->
ei
,
NULL
/*FIXME*/
);
}
else
{
hres
=
throw_type_error
(
ctx
->
parser
->
script
,
&
ctx
->
ei
,
JS_E_FUNCTION_EXPECTED
,
NULL
);
hres
=
throw_type_error
(
ctx
->
parser
->
script
,
ctx
->
ei
,
JS_E_FUNCTION_EXPECTED
,
NULL
);
}
jsdisp_release
(
obj
);
if
(
FAILED
(
hres
))
...
...
@@ -2000,10 +1982,10 @@ static HRESULT interp_in(exec_ctx_t *ctx)
if
(
V_VT
(
obj
)
!=
VT_DISPATCH
||
!
V_DISPATCH
(
obj
))
{
VariantClear
(
obj
);
VariantClear
(
v
);
return
throw_type_error
(
ctx
->
parser
->
script
,
&
ctx
->
ei
,
JS_E_OBJECT_EXPECTED
,
NULL
);
return
throw_type_error
(
ctx
->
parser
->
script
,
ctx
->
ei
,
JS_E_OBJECT_EXPECTED
,
NULL
);
}
hres
=
to_string
(
ctx
->
parser
->
script
,
v
,
&
ctx
->
ei
,
&
str
);
hres
=
to_string
(
ctx
->
parser
->
script
,
v
,
ctx
->
ei
,
&
str
);
VariantClear
(
v
);
if
(
FAILED
(
hres
))
{
IDispatch_Release
(
V_DISPATCH
(
obj
));
...
...
@@ -2097,7 +2079,7 @@ static HRESULT interp_add(exec_ctx_t *ctx)
TRACE
(
"%s + %s
\n
"
,
debugstr_variant
(
l
),
debugstr_variant
(
r
));
hres
=
add_eval
(
ctx
->
parser
->
script
,
l
,
r
,
&
ctx
->
ei
,
&
ret
);
hres
=
add_eval
(
ctx
->
parser
->
script
,
l
,
r
,
ctx
->
ei
,
&
ret
);
VariantClear
(
l
);
VariantClear
(
r
);
if
(
FAILED
(
hres
))
...
...
@@ -2204,7 +2186,7 @@ static HRESULT interp_delete(exec_ctx_t *ctx)
return
hres
;
}
hres
=
to_string
(
ctx
->
parser
->
script
,
name_var
,
&
ctx
->
ei
,
&
name
);
hres
=
to_string
(
ctx
->
parser
->
script
,
name_var
,
ctx
->
ei
,
&
name
);
VariantClear
(
name_var
);
if
(
FAILED
(
hres
))
{
IDispatch_Release
(
obj
);
...
...
@@ -2240,7 +2222,7 @@ static HRESULT interp_delete_ident(exec_ctx_t *ctx)
TRACE
(
"%s
\n
"
,
debugstr_w
(
arg
));
hres
=
identifier_eval
(
ctx
->
parser
->
script
,
arg
,
0
,
&
ctx
->
ei
,
&
exprval
);
hres
=
identifier_eval
(
ctx
->
parser
->
script
,
arg
,
0
,
ctx
->
ei
,
&
exprval
);
if
(
FAILED
(
hres
))
return
hres
;
...
...
@@ -2334,7 +2316,7 @@ static HRESULT interp_typeofid(exec_ctx_t *ctx)
return
stack_push_string
(
ctx
,
undefinedW
);
V_VT
(
&
v
)
=
VT_EMPTY
;
hres
=
disp_propget
(
ctx
->
parser
->
script
,
obj
,
id
,
&
v
,
&
ctx
->
ei
,
NULL
/*FIXME*/
);
hres
=
disp_propget
(
ctx
->
parser
->
script
,
obj
,
id
,
&
v
,
ctx
->
ei
,
NULL
/*FIXME*/
);
IDispatch_Release
(
obj
);
if
(
FAILED
(
hres
))
return
stack_push_string
(
ctx
,
unknownW
);
...
...
@@ -2358,7 +2340,7 @@ static HRESULT interp_typeofident(exec_ctx_t *ctx)
TRACE
(
"%s
\n
"
,
debugstr_w
(
arg
));
hres
=
identifier_eval
(
ctx
->
parser
->
script
,
arg
,
0
,
&
ctx
->
ei
,
&
exprval
);
hres
=
identifier_eval
(
ctx
->
parser
->
script
,
arg
,
0
,
ctx
->
ei
,
&
exprval
);
if
(
FAILED
(
hres
))
return
hres
;
...
...
@@ -2368,7 +2350,7 @@ static HRESULT interp_typeofident(exec_ctx_t *ctx)
return
hres
;
}
hres
=
exprval_to_value
(
ctx
->
parser
->
script
,
&
exprval
,
&
ctx
->
ei
,
&
v
);
hres
=
exprval_to_value
(
ctx
->
parser
->
script
,
&
exprval
,
ctx
->
ei
,
&
v
);
exprval_release
(
&
exprval
);
if
(
FAILED
(
hres
))
return
hres
;
...
...
@@ -2423,7 +2405,7 @@ static HRESULT interp_tonum(exec_ctx_t *ctx)
TRACE
(
"
\n
"
);
v
=
stack_pop
(
ctx
);
hres
=
to_number
(
ctx
->
parser
->
script
,
v
,
&
ctx
->
ei
,
&
num
);
hres
=
to_number
(
ctx
->
parser
->
script
,
v
,
ctx
->
ei
,
&
num
);
VariantClear
(
v
);
if
(
FAILED
(
hres
))
return
hres
;
...
...
@@ -2444,16 +2426,16 @@ static HRESULT interp_postinc(exec_ctx_t *ctx)
obj
=
stack_pop_objid
(
ctx
,
&
id
);
if
(
!
obj
)
return
throw_type_error
(
ctx
->
parser
->
script
,
&
ctx
->
ei
,
JS_E_OBJECT_EXPECTED
,
NULL
);
return
throw_type_error
(
ctx
->
parser
->
script
,
ctx
->
ei
,
JS_E_OBJECT_EXPECTED
,
NULL
);
hres
=
disp_propget
(
ctx
->
parser
->
script
,
obj
,
id
,
&
v
,
&
ctx
->
ei
,
NULL
/*FIXME*/
);
hres
=
disp_propget
(
ctx
->
parser
->
script
,
obj
,
id
,
&
v
,
ctx
->
ei
,
NULL
/*FIXME*/
);
if
(
SUCCEEDED
(
hres
))
{
VARIANT
n
,
inc
;
hres
=
to_number
(
ctx
->
parser
->
script
,
&
v
,
&
ctx
->
ei
,
&
n
);
hres
=
to_number
(
ctx
->
parser
->
script
,
&
v
,
ctx
->
ei
,
&
n
);
if
(
SUCCEEDED
(
hres
))
{
num_set_val
(
&
inc
,
num_val
(
&
n
)
+
(
double
)
arg
);
hres
=
disp_propput
(
ctx
->
parser
->
script
,
obj
,
id
,
&
inc
,
&
ctx
->
ei
,
NULL
/*FIXME*/
);
hres
=
disp_propput
(
ctx
->
parser
->
script
,
obj
,
id
,
&
inc
,
ctx
->
ei
,
NULL
/*FIXME*/
);
}
if
(
FAILED
(
hres
))
VariantClear
(
&
v
);
...
...
@@ -2478,17 +2460,17 @@ static HRESULT interp_preinc(exec_ctx_t *ctx)
obj
=
stack_pop_objid
(
ctx
,
&
id
);
if
(
!
obj
)
return
throw_type_error
(
ctx
->
parser
->
script
,
&
ctx
->
ei
,
JS_E_OBJECT_EXPECTED
,
NULL
);
return
throw_type_error
(
ctx
->
parser
->
script
,
ctx
->
ei
,
JS_E_OBJECT_EXPECTED
,
NULL
);
hres
=
disp_propget
(
ctx
->
parser
->
script
,
obj
,
id
,
&
v
,
&
ctx
->
ei
,
NULL
/*FIXME*/
);
hres
=
disp_propget
(
ctx
->
parser
->
script
,
obj
,
id
,
&
v
,
ctx
->
ei
,
NULL
/*FIXME*/
);
if
(
SUCCEEDED
(
hres
))
{
VARIANT
n
;
hres
=
to_number
(
ctx
->
parser
->
script
,
&
v
,
&
ctx
->
ei
,
&
n
);
hres
=
to_number
(
ctx
->
parser
->
script
,
&
v
,
ctx
->
ei
,
&
n
);
VariantClear
(
&
v
);
if
(
SUCCEEDED
(
hres
))
{
num_set_val
(
&
v
,
num_val
(
&
n
)
+
(
double
)
arg
);
hres
=
disp_propput
(
ctx
->
parser
->
script
,
obj
,
id
,
&
v
,
&
ctx
->
ei
,
NULL
/*FIXME*/
);
hres
=
disp_propput
(
ctx
->
parser
->
script
,
obj
,
id
,
&
v
,
ctx
->
ei
,
NULL
/*FIXME*/
);
}
}
IDispatch_Release
(
obj
);
...
...
@@ -2608,7 +2590,7 @@ static HRESULT interp_eq(exec_ctx_t *ctx)
TRACE
(
"%s == %s
\n
"
,
debugstr_variant
(
l
),
debugstr_variant
(
r
));
hres
=
equal_values
(
ctx
->
parser
->
script
,
l
,
r
,
&
ctx
->
ei
,
&
b
);
hres
=
equal_values
(
ctx
->
parser
->
script
,
l
,
r
,
ctx
->
ei
,
&
b
);
VariantClear
(
l
);
VariantClear
(
r
);
if
(
FAILED
(
hres
))
...
...
@@ -2629,7 +2611,7 @@ static HRESULT interp_neq(exec_ctx_t *ctx)
TRACE
(
"%s != %s
\n
"
,
debugstr_variant
(
l
),
debugstr_variant
(
r
));
hres
=
equal_values
(
ctx
->
parser
->
script
,
l
,
r
,
&
ctx
->
ei
,
&
b
);
hres
=
equal_values
(
ctx
->
parser
->
script
,
l
,
r
,
ctx
->
ei
,
&
b
);
VariantClear
(
l
);
VariantClear
(
r
);
if
(
FAILED
(
hres
))
...
...
@@ -2735,7 +2717,7 @@ static HRESULT interp_lt(exec_ctx_t *ctx)
TRACE
(
"%s < %s
\n
"
,
debugstr_variant
(
l
),
debugstr_variant
(
r
));
hres
=
less_eval
(
ctx
->
parser
->
script
,
l
,
r
,
FALSE
,
&
ctx
->
ei
,
&
b
);
hres
=
less_eval
(
ctx
->
parser
->
script
,
l
,
r
,
FALSE
,
ctx
->
ei
,
&
b
);
VariantClear
(
l
);
VariantClear
(
r
);
if
(
FAILED
(
hres
))
...
...
@@ -2756,7 +2738,7 @@ static HRESULT interp_lteq(exec_ctx_t *ctx)
TRACE
(
"%s <= %s
\n
"
,
debugstr_variant
(
l
),
debugstr_variant
(
r
));
hres
=
less_eval
(
ctx
->
parser
->
script
,
r
,
l
,
TRUE
,
&
ctx
->
ei
,
&
b
);
hres
=
less_eval
(
ctx
->
parser
->
script
,
r
,
l
,
TRUE
,
ctx
->
ei
,
&
b
);
VariantClear
(
l
);
VariantClear
(
r
);
if
(
FAILED
(
hres
))
...
...
@@ -2777,7 +2759,7 @@ static HRESULT interp_gt(exec_ctx_t *ctx)
TRACE
(
"%s > %s
\n
"
,
debugstr_variant
(
l
),
debugstr_variant
(
r
));
hres
=
less_eval
(
ctx
->
parser
->
script
,
r
,
l
,
FALSE
,
&
ctx
->
ei
,
&
b
);
hres
=
less_eval
(
ctx
->
parser
->
script
,
r
,
l
,
FALSE
,
ctx
->
ei
,
&
b
);
VariantClear
(
l
);
VariantClear
(
r
);
if
(
FAILED
(
hres
))
...
...
@@ -2798,7 +2780,7 @@ static HRESULT interp_gteq(exec_ctx_t *ctx)
TRACE
(
"%s >= %s
\n
"
,
debugstr_variant
(
l
),
debugstr_variant
(
r
));
hres
=
less_eval
(
ctx
->
parser
->
script
,
l
,
r
,
TRUE
,
&
ctx
->
ei
,
&
b
);
hres
=
less_eval
(
ctx
->
parser
->
script
,
l
,
r
,
TRUE
,
ctx
->
ei
,
&
b
);
VariantClear
(
l
);
VariantClear
(
r
);
if
(
FAILED
(
hres
))
...
...
@@ -2817,7 +2799,7 @@ static HRESULT interp_bneg(exec_ctx_t *ctx)
TRACE
(
"
\n
"
);
v
=
stack_pop
(
ctx
);
hres
=
to_int32
(
ctx
->
parser
->
script
,
v
,
&
ctx
->
ei
,
&
i
);
hres
=
to_int32
(
ctx
->
parser
->
script
,
v
,
ctx
->
ei
,
&
i
);
VariantClear
(
v
);
if
(
FAILED
(
hres
))
return
hres
;
...
...
@@ -2912,9 +2894,9 @@ static HRESULT interp_assign(exec_ctx_t *ctx)
disp
=
stack_pop_objid
(
ctx
,
&
id
);
if
(
!
disp
)
return
throw_reference_error
(
ctx
->
parser
->
script
,
&
ctx
->
ei
,
JS_E_ILLEGAL_ASSIGN
,
NULL
);
return
throw_reference_error
(
ctx
->
parser
->
script
,
ctx
->
ei
,
JS_E_ILLEGAL_ASSIGN
,
NULL
);
hres
=
disp_propput
(
ctx
->
parser
->
script
,
disp
,
id
,
v
,
&
ctx
->
ei
,
NULL
/*FIXME*/
);
hres
=
disp_propput
(
ctx
->
parser
->
script
,
disp
,
id
,
v
,
ctx
->
ei
,
NULL
/*FIXME*/
);
IDispatch_Release
(
disp
);
if
(
FAILED
(
hres
))
{
VariantClear
(
v
);
...
...
@@ -2994,6 +2976,7 @@ HRESULT compiled_statement_eval(script_ctx_t *ctx, statement_t *stat, return_typ
exec_ctx_t
*
exec_ctx
=
ctx
->
exec_ctx
;
unsigned
prev_ip
,
prev_top
;
return_type_t
*
prev_rt
;
jsexcept_t
*
prev_ei
;
jsop_t
op
;
HRESULT
hres
=
S_OK
;
...
...
@@ -3008,8 +2991,10 @@ HRESULT compiled_statement_eval(script_ctx_t *ctx, statement_t *stat, return_typ
prev_rt
=
exec_ctx
->
rt
;
prev_top
=
exec_ctx
->
top
;
prev_ip
=
exec_ctx
->
ip
;
prev_ei
=
exec_ctx
->
ei
;
exec_ctx
->
ip
=
stat
->
instr_off
;
exec_ctx
->
rt
=
rt
;
exec_ctx
->
ei
=
&
rt
->
ei
;
while
(
exec_ctx
->
ip
!=
-
1
&&
exec_ctx
->
rt
->
type
==
RT_NORMAL
)
{
op
=
exec_ctx
->
parser
->
code
->
instrs
[
exec_ctx
->
ip
].
op
;
...
...
@@ -3021,6 +3006,7 @@ HRESULT compiled_statement_eval(script_ctx_t *ctx, statement_t *stat, return_typ
exec_ctx
->
rt
=
prev_rt
;
exec_ctx
->
ip
=
prev_ip
;
exec_ctx
->
ei
=
prev_ei
;
if
(
FAILED
(
hres
))
{
stack_popn
(
exec_ctx
,
exec_ctx
->
top
-
prev_top
);
...
...
@@ -3040,6 +3026,7 @@ static HRESULT expr_eval(script_ctx_t *ctx, expression_t *expr, DWORD flags, jse
{
exec_ctx_t
*
exec_ctx
=
ctx
->
exec_ctx
;
unsigned
prev_ip
,
prev_top
;
jsexcept_t
*
prev_ei
;
jsop_t
op
;
HRESULT
hres
=
S_OK
;
...
...
@@ -3053,7 +3040,9 @@ static HRESULT expr_eval(script_ctx_t *ctx, expression_t *expr, DWORD flags, jse
prev_top
=
exec_ctx
->
top
;
prev_ip
=
exec_ctx
->
ip
;
prev_ei
=
exec_ctx
->
ei
;
exec_ctx
->
ip
=
expr
->
instr_off
;
exec_ctx
->
ei
=
ei
;
while
(
exec_ctx
->
ip
!=
-
1
)
{
op
=
exec_ctx
->
parser
->
code
->
instrs
[
exec_ctx
->
ip
].
op
;
...
...
@@ -3064,11 +3053,10 @@ static HRESULT expr_eval(script_ctx_t *ctx, expression_t *expr, DWORD flags, jse
}
exec_ctx
->
ip
=
prev_ip
;
exec_ctx
->
ei
=
prev_ei
;
if
(
FAILED
(
hres
))
{
stack_popn
(
exec_ctx
,
exec_ctx
->
top
-
prev_top
);
*
ei
=
exec_ctx
->
ei
;
memset
(
&
exec_ctx
->
ei
,
0
,
sizeof
(
exec_ctx
->
ei
));
return
hres
;
}
...
...
dlls/jscript/engine.h
View file @
ccba279b
...
...
@@ -229,7 +229,7 @@ struct _exec_ctx_t {
unsigned
top
;
unsigned
ip
;
jsexcept_t
ei
;
jsexcept_t
*
ei
;
return_type_t
*
rt
;
/* FIXME */
};
...
...
@@ -400,7 +400,6 @@ typedef struct {
HRESULT
compiled_statement_eval
(
script_ctx_t
*
,
statement_t
*
,
return_type_t
*
,
VARIANT
*
)
DECLSPEC_HIDDEN
;
HRESULT
var_statement_eval
(
script_ctx_t
*
,
statement_t
*
,
return_type_t
*
,
VARIANT
*
)
DECLSPEC_HIDDEN
;
HRESULT
empty_statement_eval
(
script_ctx_t
*
,
statement_t
*
,
return_type_t
*
,
VARIANT
*
)
DECLSPEC_HIDDEN
;
HRESULT
expression_statement_eval
(
script_ctx_t
*
,
statement_t
*
,
return_type_t
*
,
VARIANT
*
)
DECLSPEC_HIDDEN
;
HRESULT
if_statement_eval
(
script_ctx_t
*
,
statement_t
*
,
return_type_t
*
,
VARIANT
*
)
DECLSPEC_HIDDEN
;
HRESULT
while_statement_eval
(
script_ctx_t
*
,
statement_t
*
,
return_type_t
*
,
VARIANT
*
)
DECLSPEC_HIDDEN
;
HRESULT
for_statement_eval
(
script_ctx_t
*
,
statement_t
*
,
return_type_t
*
,
VARIANT
*
)
DECLSPEC_HIDDEN
;
...
...
dlls/jscript/parser.y
View file @
ccba279b
...
...
@@ -840,7 +840,7 @@ static const statement_eval_t stat_eval_table[] = {
break_statement_eval,
continue_statement_eval,
empty_statement_eval,
expression
_statement_eval,
compiled
_statement_eval,
for_statement_eval,
forin_statement_eval,
if_statement_eval,
...
...
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