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
9d4b0bd5
Commit
9d4b0bd5
authored
Mar 12, 2012
by
Jacek Caban
Committed by
Alexandre Julliard
Mar 13, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jscript: Don't store compiler_ctx_t in parser_ctx_t.
parent
be29a738
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
40 deletions
+16
-40
compile.c
dlls/jscript/compile.c
+16
-33
engine.h
dlls/jscript/engine.h
+0
-5
parser.y
dlls/jscript/parser.y
+0
-2
No files found.
dlls/jscript/compile.c
View file @
9d4b0bd5
...
...
@@ -40,7 +40,7 @@ typedef struct _statement_ctx_t {
struct
_statement_ctx_t
*
next
;
}
statement_ctx_t
;
struct
_compiler_ctx_
t
{
typedef
struc
t
{
parser_ctx_t
*
parser
;
bytecode_t
*
code
;
...
...
@@ -52,7 +52,7 @@ struct _compiler_ctx_t {
unsigned
labels_cnt
;
statement_ctx_t
*
stat_ctx
;
};
}
compiler_ctx_t
;
static
const
struct
{
const
char
*
op_str
;
...
...
@@ -1703,44 +1703,22 @@ void release_bytecode(bytecode_t *code)
heap_free
(
code
);
}
void
release_compiler
(
compiler_ctx_t
*
ctx
)
static
HRESULT
init_code
(
compiler_ctx_t
*
compiler
)
{
heap_free
(
ctx
);
}
static
HRESULT
init_compiler
(
parser_ctx_t
*
parser
)
{
compiler_ctx_t
*
compiler
;
if
(
parser
->
compiler
)
return
S_OK
;
compiler
=
heap_alloc_zero
(
sizeof
(
*
compiler
));
if
(
!
compiler
)
return
E_OUTOFMEMORY
;
compiler
->
code
=
heap_alloc_zero
(
sizeof
(
bytecode_t
));
if
(
!
compiler
->
code
)
{
release_compiler
(
compiler
);
if
(
!
compiler
->
code
)
return
E_OUTOFMEMORY
;
}
jsheap_init
(
&
compiler
->
code
->
heap
);
compiler
->
code
->
instrs
=
heap_alloc
(
64
*
sizeof
(
instr_t
));
if
(
!
compiler
->
code
->
instrs
)
{
release_bytecode
(
compiler
->
code
);
release_compiler
(
compiler
);
return
E_OUTOFMEMORY
;
}
compiler
->
code_size
=
64
;
compiler
->
code_off
=
1
;
compiler
->
parser
=
parser
;
parser
->
code
=
compiler
->
code
;
parser
->
compiler
=
compiler
;
return
S_OK
;
}
...
...
@@ -1781,21 +1759,26 @@ static HRESULT compile_function(compiler_ctx_t *ctx, source_elements_t *source,
HRESULT
compile_script
(
script_ctx_t
*
ctx
,
const
WCHAR
*
code
,
const
WCHAR
*
delimiter
,
BOOL
from_eval
,
parser_ctx_t
**
ret
)
{
parser_ctx_t
*
parser
;
compiler_ctx_t
compiler
=
{
0
}
;
HRESULT
hres
;
hres
=
script_parse
(
ctx
,
code
,
delimiter
,
from_eval
,
&
parser
);
hres
=
script_parse
(
ctx
,
code
,
delimiter
,
from_eval
,
&
compiler
.
parser
);
if
(
FAILED
(
hres
))
return
hres
;
hres
=
init_compiler
(
parser
);
if
(
SUCCEEDED
(
hres
))
hres
=
compile_function
(
parser
->
compiler
,
parser
->
source
,
from_eval
);
hres
=
init_code
(
&
compiler
);
if
(
SUCCEEDED
(
hres
))
{
hres
=
compile_function
(
&
compiler
,
compiler
.
parser
->
source
,
from_eval
);
if
(
FAILED
(
hres
))
release_bytecode
(
compiler
.
code
);
}
if
(
FAILED
(
hres
))
{
parser_release
(
parser
);
parser_release
(
compiler
.
parser
);
return
hres
;
}
*
ret
=
parser
;
compiler
.
parser
->
code
=
compiler
.
code
;
*
ret
=
compiler
.
parser
;
return
S_OK
;
}
dlls/jscript/engine.h
View file @
9d4b0bd5
...
...
@@ -160,10 +160,6 @@ typedef struct {
void
release_bytecode
(
bytecode_t
*
);
typedef
struct
_compiler_ctx_t
compiler_ctx_t
;
void
release_compiler
(
compiler_ctx_t
*
);
typedef
struct
_parser_ctx_t
{
LONG
ref
;
...
...
@@ -183,7 +179,6 @@ typedef struct _parser_ctx_t {
func_stack_t
*
func_stack
;
bytecode_t
*
code
;
compiler_ctx_t
*
compiler
;
struct
_parser_ctx_t
*
next
;
}
parser_ctx_t
;
...
...
dlls/jscript/parser.y
View file @
9d4b0bd5
...
...
@@ -1537,8 +1537,6 @@ void parser_release(parser_ctx_t *ctx)
if(ctx->code)
release_bytecode(ctx->code);
if(ctx->compiler)
release_compiler(ctx->compiler);
script_release(ctx->script);
heap_free(ctx->begin);
jsheap_free(&ctx->heap);
...
...
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