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
97b44da7
Commit
97b44da7
authored
Apr 25, 2012
by
Jacek Caban
Committed by
Alexandre Julliard
Apr 25, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jscript: Store function parameters in function_code_t.
parent
d1a40539
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
30 additions
and
40 deletions
+30
-40
compile.c
dlls/jscript/compile.c
+15
-2
engine.c
dlls/jscript/engine.c
+2
-8
engine.h
dlls/jscript/engine.h
+6
-10
function.c
dlls/jscript/function.c
+6
-19
jscript.c
dlls/jscript/jscript.c
+1
-1
No files found.
dlls/jscript/compile.c
View file @
97b44da7
...
...
@@ -1806,11 +1806,24 @@ static HRESULT compile_function(compiler_ctx_t *ctx, source_elements_t *source,
}
if
(
func_expr
)
{
parameter_t
*
param_iter
;
func
->
source
=
func_expr
->
src_str
;
func
->
source_len
=
func_expr
->
src_len
;
}
func
->
expr
=
func_expr
;
for
(
param_iter
=
func_expr
->
parameter_list
;
param_iter
;
param_iter
=
param_iter
->
next
)
func
->
param_cnt
++
;
func
->
params
=
compiler_alloc
(
ctx
->
code
,
func
->
param_cnt
*
sizeof
(
*
func
->
params
));
if
(
!
func
->
params
)
return
E_OUTOFMEMORY
;
for
(
param_iter
=
func_expr
->
parameter_list
,
i
=
0
;
param_iter
;
param_iter
=
param_iter
->
next
,
i
++
)
{
func
->
params
[
i
]
=
compiler_alloc_bstr
(
ctx
,
param_iter
->
identifier
);
if
(
!
func
->
params
[
i
])
return
E_OUTOFMEMORY
;
}
}
func
->
funcs
=
compiler_alloc
(
ctx
->
code
,
func
->
func_cnt
*
sizeof
(
*
func
->
funcs
));
if
(
!
func
->
funcs
)
...
...
dlls/jscript/engine.c
View file @
97b44da7
...
...
@@ -804,16 +804,13 @@ static HRESULT interp_end_finally(exec_ctx_t *ctx)
static
HRESULT
interp_func
(
exec_ctx_t
*
ctx
)
{
unsigned
func_idx
=
ctx
->
code
->
instrs
[
ctx
->
ip
].
arg1
.
uint
;
function_expression_t
*
expr
;
jsdisp_t
*
dispex
;
VARIANT
v
;
HRESULT
hres
;
TRACE
(
"%d
\n
"
,
func_idx
);
expr
=
ctx
->
func_code
->
funcs
[
func_idx
].
expr
;
hres
=
create_source_function
(
ctx
->
script
,
ctx
->
code
,
expr
->
parameter_list
,
ctx
->
func_code
->
funcs
+
func_idx
,
hres
=
create_source_function
(
ctx
->
script
,
ctx
->
code
,
ctx
->
func_code
->
funcs
+
func_idx
,
ctx
->
scope_chain
,
&
dispex
);
if
(
FAILED
(
hres
))
return
hres
;
...
...
@@ -2619,16 +2616,13 @@ HRESULT exec_source(exec_ctx_t *ctx, bytecode_t *code, function_code_t *func, BO
HRESULT
hres
=
S_OK
;
for
(
i
=
0
;
i
<
func
->
func_cnt
;
i
++
)
{
function_expression_t
*
expr
;
jsdisp_t
*
func_obj
;
VARIANT
var
;
if
(
!
func
->
funcs
[
i
].
name
)
continue
;
expr
=
func
->
funcs
[
i
].
expr
;
hres
=
create_source_function
(
ctx
->
script
,
code
,
expr
->
parameter_list
,
func
->
funcs
+
i
,
ctx
->
scope_chain
,
&
func_obj
);
hres
=
create_source_function
(
ctx
->
script
,
code
,
func
->
funcs
+
i
,
ctx
->
scope_chain
,
&
func_obj
);
if
(
FAILED
(
hres
))
return
hres
;
...
...
dlls/jscript/engine.h
View file @
97b44da7
...
...
@@ -170,8 +170,6 @@ typedef struct _function_code_t {
BSTR
name
;
unsigned
instr_off
;
function_expression_t
*
expr
;
/* FIXME */
const
WCHAR
*
source
;
unsigned
source_len
;
...
...
@@ -180,6 +178,9 @@ typedef struct _function_code_t {
unsigned
var_cnt
;
BSTR
*
variables
;
unsigned
param_cnt
;
BSTR
*
params
;
}
function_code_t
;
typedef
struct
_bytecode_t
{
...
...
@@ -269,11 +270,7 @@ static inline void exec_addref(exec_ctx_t *ctx)
void
exec_release
(
exec_ctx_t
*
)
DECLSPEC_HIDDEN
;
HRESULT
create_exec_ctx
(
script_ctx_t
*
,
IDispatch
*
,
jsdisp_t
*
,
scope_chain_t
*
,
BOOL
,
exec_ctx_t
**
)
DECLSPEC_HIDDEN
;
HRESULT
exec_source
(
exec_ctx_t
*
,
bytecode_t
*
,
function_code_t
*
,
BOOL
,
jsexcept_t
*
,
VARIANT
*
)
DECLSPEC_HIDDEN
;
typedef
struct
_parameter_t
parameter_t
;
HRESULT
create_source_function
(
script_ctx_t
*
,
bytecode_t
*
,
parameter_t
*
,
function_code_t
*
,
scope_chain_t
*
,
jsdisp_t
**
)
DECLSPEC_HIDDEN
;
HRESULT
create_source_function
(
script_ctx_t
*
,
bytecode_t
*
,
function_code_t
*
,
scope_chain_t
*
,
jsdisp_t
**
)
DECLSPEC_HIDDEN
;
typedef
enum
{
LT_INT
,
...
...
@@ -501,11 +498,10 @@ struct _expression_t {
expression_type_t
type
;
};
struct
_parameter_t
{
typedef
struct
_parameter_t
{
const
WCHAR
*
identifier
;
struct
_parameter_t
*
next
;
};
}
parameter_t
;
struct
_source_elements_t
{
statement_t
*
statement
;
...
...
dlls/jscript/function.c
View file @
97b44da7
...
...
@@ -28,7 +28,6 @@ typedef struct {
builtin_invoke_t
value_proc
;
const
WCHAR
*
name
;
DWORD
flags
;
parameter_t
*
parameters
;
scope_chain_t
*
scope_chain
;
bytecode_t
*
code
;
function_code_t
*
func_code
;
...
...
@@ -75,7 +74,6 @@ static IDispatch *get_this(DISPPARAMS *dp)
static
HRESULT
init_parameters
(
jsdisp_t
*
var_disp
,
FunctionInstance
*
function
,
DISPPARAMS
*
dp
,
jsexcept_t
*
ei
)
{
parameter_t
*
param
;
VARIANT
var_empty
;
DWORD
cargs
,
i
=
0
;
HRESULT
hres
;
...
...
@@ -83,13 +81,11 @@ static HRESULT init_parameters(jsdisp_t *var_disp, FunctionInstance *function, D
V_VT
(
&
var_empty
)
=
VT_EMPTY
;
cargs
=
arg_cnt
(
dp
);
for
(
param
=
function
->
parameters
;
param
;
param
=
param
->
next
)
{
hres
=
jsdisp_propput_name
(
var_disp
,
param
->
identifier
,
for
(
i
=
0
;
i
<
function
->
func_code
->
param_cnt
;
i
++
)
{
hres
=
jsdisp_propput_name
(
var_disp
,
function
->
func_code
->
params
[
i
]
,
i
<
cargs
?
get_arg
(
dp
,
i
)
:
&
var_empty
,
ei
);
if
(
FAILED
(
hres
))
return
hres
;
i
++
;
}
return
S_OK
;
...
...
@@ -658,13 +654,11 @@ HRESULT create_builtin_function(script_ctx_t *ctx, builtin_invoke_t value_proc,
return
S_OK
;
}
HRESULT
create_source_function
(
script_ctx_t
*
ctx
,
bytecode_t
*
code
,
parameter_t
*
parameters
,
function_code_t
*
func_code
,
HRESULT
create_source_function
(
script_ctx_t
*
ctx
,
bytecode_t
*
code
,
function_code_t
*
func_code
,
scope_chain_t
*
scope_chain
,
jsdisp_t
**
ret
)
{
FunctionInstance
*
function
;
jsdisp_t
*
prototype
;
parameter_t
*
iter
;
DWORD
length
=
0
;
HRESULT
hres
;
hres
=
create_object
(
ctx
,
NULL
,
&
prototype
);
...
...
@@ -681,9 +675,6 @@ HRESULT create_source_function(script_ctx_t *ctx, bytecode_t *code, parameter_t
if
(
FAILED
(
hres
))
return
hres
;
function
->
func_code
=
func_code
;
function
->
parameters
=
parameters
;
if
(
scope_chain
)
{
scope_addref
(
scope_chain
);
function
->
scope_chain
=
scope_chain
;
...
...
@@ -691,10 +682,8 @@ HRESULT create_source_function(script_ctx_t *ctx, bytecode_t *code, parameter_t
bytecode_addref
(
code
);
function
->
code
=
code
;
for
(
iter
=
parameters
;
iter
;
iter
=
iter
->
next
)
length
++
;
function
->
length
=
length
;
function
->
func_code
=
func_code
;
function
->
length
=
function
->
func_code
->
param_cnt
;
*
ret
=
&
function
->
dispex
;
return
S_OK
;
...
...
@@ -702,7 +691,6 @@ HRESULT create_source_function(script_ctx_t *ctx, bytecode_t *code, parameter_t
static
HRESULT
construct_function
(
script_ctx_t
*
ctx
,
DISPPARAMS
*
dp
,
jsexcept_t
*
ei
,
IDispatch
**
ret
)
{
function_expression_t
*
expr
;
WCHAR
*
str
=
NULL
,
*
ptr
;
DWORD
argc
,
len
=
0
,
l
;
bytecode_t
*
code
;
...
...
@@ -779,9 +767,8 @@ static HRESULT construct_function(script_ctx_t *ctx, DISPPARAMS *dp, jsexcept_t
release_bytecode
(
code
);
return
E_UNEXPECTED
;
}
expr
=
code
->
global_code
.
funcs
[
0
].
expr
;
hres
=
create_source_function
(
ctx
,
code
,
expr
->
parameter_list
,
code
->
global_code
.
funcs
,
NULL
,
&
function
);
hres
=
create_source_function
(
ctx
,
code
,
code
->
global_code
.
funcs
,
NULL
,
&
function
);
release_bytecode
(
code
);
if
(
FAILED
(
hres
))
return
hres
;
...
...
dlls/jscript/jscript.c
View file @
97b44da7
...
...
@@ -836,7 +836,7 @@ static HRESULT WINAPI JScriptParseProcedure_ParseProcedureText(IActiveScriptPars
return
hres
;
}
hres
=
create_source_function
(
This
->
ctx
,
code
,
NULL
,
&
code
->
global_code
,
NULL
,
&
dispex
);
hres
=
create_source_function
(
This
->
ctx
,
code
,
&
code
->
global_code
,
NULL
,
&
dispex
);
release_bytecode
(
code
);
if
(
FAILED
(
hres
))
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