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
d0803612
Commit
d0803612
authored
Mar 28, 2016
by
Jacek Caban
Committed by
Alexandre Julliard
Mar 29, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jscript: Don't assume that ret value is cleared when it's not set explicitly.
Signed-off-by:
Jacek Caban
<
jacek@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
f198b5a4
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
7 deletions
+19
-7
compile.c
dlls/jscript/compile.c
+4
-3
engine.c
dlls/jscript/engine.c
+15
-4
No files found.
dlls/jscript/compile.c
View file @
d0803612
...
...
@@ -1479,7 +1479,7 @@ static HRESULT compile_return_statement(compiler_ctx_t *ctx, expression_statemen
if
(
FAILED
(
hres
))
return
hres
;
return
push_instr
(
ctx
,
OP_ret
)
?
S_OK
:
E_OUTOFMEMORY
;
return
push_instr
_uint
(
ctx
,
OP_ret
,
!
stat
->
expr
)
;
}
/* ECMA-262 3rd Edition 12.10 */
...
...
@@ -1857,8 +1857,9 @@ static HRESULT compile_function(compiler_ctx_t *ctx, source_elements_t *source,
resolve_labels
(
ctx
,
off
);
if
(
!
push_instr
(
ctx
,
OP_ret
))
return
E_OUTOFMEMORY
;
hres
=
push_instr_uint
(
ctx
,
OP_ret
,
!
from_eval
);
if
(
FAILED
(
hres
))
return
hres
;
if
(
TRACE_ON
(
jscript_disas
))
dump_code
(
ctx
,
off
);
...
...
dlls/jscript/engine.c
View file @
d0803612
...
...
@@ -194,6 +194,13 @@ static inline IDispatch *stack_topn_objid(script_ctx_t *ctx, unsigned n, DISPID
return
get_object
(
stack_topn
(
ctx
,
n
+
1
));
}
static
inline
jsval_t
steal_ret
(
call_frame_t
*
frame
)
{
jsval_t
r
=
frame
->
ret
;
frame
->
ret
=
jsval_undefined
();
return
r
;
}
static
void
exprval_release
(
exprval_t
*
val
)
{
switch
(
val
->
type
)
{
...
...
@@ -2323,8 +2330,14 @@ static HRESULT interp_pop(script_ctx_t *ctx)
static
HRESULT
interp_ret
(
script_ctx_t
*
ctx
)
{
const
unsigned
clear_ret
=
get_op_uint
(
ctx
,
0
);
call_frame_t
*
frame
=
ctx
->
call_ctx
;
TRACE
(
"
\n
"
);
if
(
clear_ret
)
jsval_release
(
steal_ret
(
frame
));
jmp_abs
(
ctx
,
-
1
);
return
S_OK
;
}
...
...
@@ -2457,10 +2470,8 @@ static HRESULT enter_bytecode(script_ctx_t *ctx, function_code_t *func, jsval_t
assert
(
frame
->
scope
==
frame
->
base_scope
);
ctx
->
call_ctx
=
frame
->
prev_frame
;
if
(
SUCCEEDED
(
hres
))
{
*
ret
=
frame
->
ret
;
frame
->
ret
=
jsval_undefined
();
}
if
(
SUCCEEDED
(
hres
))
*
ret
=
steal_ret
(
frame
);
release_call_frame
(
frame
);
return
hres
;
...
...
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