Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
4ac24dc2
Commit
4ac24dc2
authored
Sep 15, 2008
by
Jacek Caban
Committed by
Alexandre Julliard
Sep 16, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jscript: Reuse temporary heap.
parent
cf1863ed
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
49 additions
and
17 deletions
+49
-17
engine.h
dlls/jscript/engine.h
+1
-2
jscript.c
dlls/jscript/jscript.c
+2
-0
jscript.h
dlls/jscript/jscript.h
+18
-13
jsutils.c
dlls/jscript/jsutils.c
+25
-0
parser.y
dlls/jscript/parser.y
+3
-2
No files found.
dlls/jscript/engine.h
View file @
4ac24dc2
...
...
@@ -35,7 +35,6 @@ typedef struct _parser_ctx_t {
BOOL
nl
;
HRESULT
hres
;
jsheap_t
tmp_heap
;
jsheap_t
heap
;
obj_literal_t
*
obj_literals
;
...
...
@@ -60,7 +59,7 @@ static inline void *parser_alloc(parser_ctx_t *ctx, DWORD size)
static
inline
void
*
parser_alloc_tmp
(
parser_ctx_t
*
ctx
,
DWORD
size
)
{
return
jsheap_alloc
(
&
ctx
->
tmp_heap
,
size
);
return
jsheap_alloc
(
&
ctx
->
script
->
tmp_heap
,
size
);
}
typedef
struct
_scope_chain_t
{
...
...
dlls/jscript/jscript.c
View file @
4ac24dc2
...
...
@@ -54,6 +54,7 @@ void script_release(script_ctx_t *ctx)
if
(
--
ctx
->
ref
)
return
;
jsheap_free
(
&
ctx
->
tmp_heap
);
heap_free
(
ctx
);
}
...
...
@@ -507,6 +508,7 @@ static HRESULT WINAPI JScriptParse_InitNew(IActiveScriptParse *iface)
ctx
->
ref
=
1
;
ctx
->
state
=
SCRIPTSTATE_UNINITIALIZED
;
jsheap_init
(
&
ctx
->
tmp_heap
);
ctx
=
InterlockedCompareExchangePointer
((
void
**
)
&
This
->
ctx
,
ctx
,
NULL
);
if
(
ctx
)
{
...
...
dlls/jscript/jscript.h
View file @
4ac24dc2
...
...
@@ -40,6 +40,22 @@ typedef struct {
VARIANT
var
;
}
jsexcept_t
;
typedef
struct
{
void
**
blocks
;
DWORD
block_cnt
;
DWORD
last_block
;
DWORD
offset
;
BOOL
mark
;
struct
list
custom_blocks
;
}
jsheap_t
;
void
jsheap_init
(
jsheap_t
*
);
void
*
jsheap_alloc
(
jsheap_t
*
,
DWORD
);
void
*
jsheap_grow
(
jsheap_t
*
,
void
*
,
DWORD
,
DWORD
);
void
jsheap_clear
(
jsheap_t
*
);
void
jsheap_free
(
jsheap_t
*
);
jsheap_t
*
jsheap_mark
(
jsheap_t
*
);
typedef
struct
DispatchEx
DispatchEx
;
#define PROPF_ARGMASK 0x00ff
...
...
@@ -139,6 +155,8 @@ struct _script_ctx_t {
named_item_t
*
named_items
;
LCID
lcid
;
jsheap_t
tmp_heap
;
DispatchEx
*
script_disp
;
DispatchEx
*
global
;
DispatchEx
*
array_constr
;
...
...
@@ -179,19 +197,6 @@ const char *debugstr_variant(const VARIANT*);
HRESULT
WINAPI
JScriptFactory_CreateInstance
(
IClassFactory
*
,
IUnknown
*
,
REFIID
,
void
**
);
typedef
struct
{
void
**
blocks
;
DWORD
block_cnt
;
DWORD
last_block
;
DWORD
offset
;
struct
list
custom_blocks
;
}
jsheap_t
;
void
jsheap_init
(
jsheap_t
*
);
void
*
jsheap_alloc
(
jsheap_t
*
,
DWORD
);
void
jsheap_clear
(
jsheap_t
*
);
void
jsheap_free
(
jsheap_t
*
);
extern
LONG
module_ref
;
static
inline
void
lock_module
(
void
)
...
...
dlls/jscript/jsutils.c
View file @
4ac24dc2
...
...
@@ -110,14 +110,30 @@ void *jsheap_alloc(jsheap_t *heap, DWORD size)
return
list
+
1
;
}
void
*
jsheap_grow
(
jsheap_t
*
heap
,
void
*
mem
,
DWORD
size
,
DWORD
inc
)
{
if
(
mem
==
(
BYTE
*
)
heap
->
blocks
[
heap
->
last_block
]
+
heap
->
offset
-
size
&&
heap
->
offset
+
inc
<
block_size
(
heap
->
last_block
))
{
heap
->
offset
+=
inc
;
return
mem
;
}
return
jsheap_alloc
(
heap
,
size
+
inc
);
}
void
jsheap_clear
(
jsheap_t
*
heap
)
{
struct
list
*
tmp
;
if
(
!
heap
)
return
;
while
((
tmp
=
list_next
(
&
heap
->
custom_blocks
,
&
heap
->
custom_blocks
)))
{
list_remove
(
tmp
);
heap_free
(
tmp
);
}
heap
->
last_block
=
heap
->
offset
=
0
;
}
void
jsheap_free
(
jsheap_t
*
heap
)
...
...
@@ -133,6 +149,15 @@ void jsheap_free(jsheap_t *heap)
jsheap_init
(
heap
);
}
jsheap_t
*
jsheap_mark
(
jsheap_t
*
heap
)
{
if
(
heap
->
mark
)
return
NULL
;
heap
->
mark
=
TRUE
;
return
heap
;
}
/* ECMA-262 3rd Edition 9.1 */
HRESULT
to_primitive
(
script_ctx_t
*
ctx
,
VARIANT
*
v
,
jsexcept_t
*
ei
,
VARIANT
*
ret
)
{
...
...
dlls/jscript/parser.y
View file @
4ac24dc2
...
...
@@ -1525,6 +1525,7 @@ void parser_release(parser_ctx_t *ctx)
HRESULT script_parse(script_ctx_t *ctx, const WCHAR *code, parser_ctx_t **ret)
{
parser_ctx_t *parser_ctx;
jsheap_t *mark;
HRESULT hres;
parser_ctx = heap_alloc_zero(sizeof(parser_ctx_t));
...
...
@@ -1540,11 +1541,11 @@ HRESULT script_parse(script_ctx_t *ctx, const WCHAR *code, parser_ctx_t **ret)
script_addref(ctx);
parser_ctx->script = ctx;
jsheap_init(&parser_
ctx->tmp_heap);
mark = jsheap_mark(&
ctx->tmp_heap);
jsheap_init(&parser_ctx->heap);
parser_parse(parser_ctx);
jsheap_
free(&parser_ctx->tmp_heap
);
jsheap_
clear(mark
);
if(FAILED(parser_ctx->hres)) {
hres = parser_ctx->hres;
parser_release(parser_ctx);
...
...
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