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
02d63cb3
Commit
02d63cb3
authored
Feb 15, 2013
by
Piotr Caban
Committed by
Alexandre Julliard
Feb 15, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jscript: Rename jsheap_t to heap_pool_t.
parent
2b5babc3
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
47 additions
and
47 deletions
+47
-47
compile.c
dlls/jscript/compile.c
+3
-3
engine.h
dlls/jscript/engine.h
+4
-4
jscript.c
dlls/jscript/jscript.c
+2
-2
jscript.h
dlls/jscript/jscript.h
+8
-8
jsutils.c
dlls/jscript/jsutils.c
+9
-9
parser.y
dlls/jscript/parser.y
+5
-5
regexp.c
dlls/jscript/regexp.c
+16
-16
No files found.
dlls/jscript/compile.c
View file @
02d63cb3
...
...
@@ -118,7 +118,7 @@ static HRESULT compile_statement(compiler_ctx_t*,statement_ctx_t*,statement_t*);
static
inline
void
*
compiler_alloc
(
bytecode_t
*
code
,
size_t
size
)
{
return
jsheap
_alloc
(
&
code
->
heap
,
size
);
return
heap_pool
_alloc
(
&
code
->
heap
,
size
);
}
static
jsstr_t
*
compiler_alloc_string_len
(
compiler_ctx_t
*
ctx
,
const
WCHAR
*
str
,
unsigned
len
)
...
...
@@ -1806,7 +1806,7 @@ void release_bytecode(bytecode_t *code)
jsstr_release
(
code
->
str_pool
[
i
]);
heap_free
(
code
->
source
);
jsheap
_free
(
&
code
->
heap
);
heap_pool
_free
(
&
code
->
heap
);
heap_free
(
code
->
bstr_pool
);
heap_free
(
code
->
str_pool
);
heap_free
(
code
->
instrs
);
...
...
@@ -1820,7 +1820,7 @@ static HRESULT init_code(compiler_ctx_t *compiler, const WCHAR *source)
return
E_OUTOFMEMORY
;
compiler
->
code
->
ref
=
1
;
jsheap
_init
(
&
compiler
->
code
->
heap
);
heap_pool
_init
(
&
compiler
->
code
->
heap
);
compiler
->
code
->
source
=
heap_strdupW
(
source
);
if
(
!
compiler
->
code
->
source
)
{
...
...
dlls/jscript/engine.h
View file @
02d63cb3
...
...
@@ -33,7 +33,7 @@ typedef struct {
BOOL
lexer_error
;
HRESULT
hres
;
jsheap
_t
heap
;
heap_pool
_t
heap
;
}
parser_ctx_t
;
#define OP_LIST \
...
...
@@ -166,7 +166,7 @@ typedef struct _bytecode_t {
LONG
ref
;
instr_t
*
instrs
;
jsheap
_t
heap
;
heap_pool
_t
heap
;
function_code_t
global_code
;
...
...
@@ -198,12 +198,12 @@ int parser_lex(void*,parser_ctx_t*) DECLSPEC_HIDDEN;
static
inline
void
*
parser_alloc
(
parser_ctx_t
*
ctx
,
DWORD
size
)
{
return
jsheap
_alloc
(
&
ctx
->
heap
,
size
);
return
heap_pool
_alloc
(
&
ctx
->
heap
,
size
);
}
static
inline
void
*
parser_alloc_tmp
(
parser_ctx_t
*
ctx
,
DWORD
size
)
{
return
jsheap
_alloc
(
&
ctx
->
script
->
tmp_heap
,
size
);
return
heap_pool
_alloc
(
&
ctx
->
script
->
tmp_heap
,
size
);
}
typedef
struct
_scope_chain_t
{
...
...
dlls/jscript/jscript.c
View file @
02d63cb3
...
...
@@ -71,7 +71,7 @@ void script_release(script_ctx_t *ctx)
clear_ei
(
ctx
);
if
(
ctx
->
cc
)
release_cc
(
ctx
->
cc
);
jsheap
_free
(
&
ctx
->
tmp_heap
);
heap_pool
_free
(
&
ctx
->
tmp_heap
);
if
(
ctx
->
last_match
)
jsstr_release
(
ctx
->
last_match
);
...
...
@@ -717,7 +717,7 @@ static HRESULT WINAPI JScriptParse_InitNew(IActiveScriptParse *iface)
ctx
->
safeopt
=
This
->
safeopt
;
ctx
->
version
=
This
->
version
;
ctx
->
ei
.
val
=
jsval_undefined
();
jsheap
_init
(
&
ctx
->
tmp_heap
);
heap_pool
_init
(
&
ctx
->
tmp_heap
);
hres
=
create_jscaller
(
ctx
);
if
(
FAILED
(
hres
))
{
...
...
dlls/jscript/jscript.h
View file @
02d63cb3
...
...
@@ -46,14 +46,14 @@ typedef struct {
DWORD
offset
;
BOOL
mark
;
struct
list
custom_blocks
;
}
jsheap
_t
;
}
heap_pool
_t
;
void
jsheap_init
(
jsheap
_t
*
)
DECLSPEC_HIDDEN
;
void
*
jsheap_alloc
(
jsheap
_t
*
,
DWORD
)
__WINE_ALLOC_SIZE
(
2
)
DECLSPEC_HIDDEN
;
void
*
jsheap_grow
(
jsheap
_t
*
,
void
*
,
DWORD
,
DWORD
)
DECLSPEC_HIDDEN
;
void
jsheap_clear
(
jsheap
_t
*
)
DECLSPEC_HIDDEN
;
void
jsheap_free
(
jsheap
_t
*
)
DECLSPEC_HIDDEN
;
jsheap_t
*
jsheap_mark
(
jsheap
_t
*
)
DECLSPEC_HIDDEN
;
void
heap_pool_init
(
heap_pool
_t
*
)
DECLSPEC_HIDDEN
;
void
*
heap_pool_alloc
(
heap_pool
_t
*
,
DWORD
)
__WINE_ALLOC_SIZE
(
2
)
DECLSPEC_HIDDEN
;
void
*
heap_pool_grow
(
heap_pool
_t
*
,
void
*
,
DWORD
,
DWORD
)
DECLSPEC_HIDDEN
;
void
heap_pool_clear
(
heap_pool
_t
*
)
DECLSPEC_HIDDEN
;
void
heap_pool_free
(
heap_pool
_t
*
)
DECLSPEC_HIDDEN
;
heap_pool_t
*
heap_pool_mark
(
heap_pool
_t
*
)
DECLSPEC_HIDDEN
;
static
inline
void
*
heap_alloc
(
size_t
len
)
{
...
...
@@ -383,7 +383,7 @@ struct _script_ctx_t {
JSCaller
*
jscaller
;
jsexcept_t
ei
;
jsheap
_t
tmp_heap
;
heap_pool
_t
tmp_heap
;
IDispatch
*
host_global
;
...
...
dlls/jscript/jsutils.c
View file @
02d63cb3
...
...
@@ -90,13 +90,13 @@ static inline DWORD block_size(DWORD block)
return
MIN_BLOCK_SIZE
<<
block
;
}
void
jsheap_init
(
jsheap
_t
*
heap
)
void
heap_pool_init
(
heap_pool
_t
*
heap
)
{
memset
(
heap
,
0
,
sizeof
(
*
heap
));
list_init
(
&
heap
->
custom_blocks
);
}
void
*
jsheap_alloc
(
jsheap
_t
*
heap
,
DWORD
size
)
void
*
heap_pool_alloc
(
heap_pool
_t
*
heap
,
DWORD
size
)
{
struct
list
*
list
;
void
*
tmp
;
...
...
@@ -149,7 +149,7 @@ void *jsheap_alloc(jsheap_t *heap, DWORD size)
return
list
+
1
;
}
void
*
jsheap_grow
(
jsheap
_t
*
heap
,
void
*
mem
,
DWORD
size
,
DWORD
inc
)
void
*
heap_pool_grow
(
heap_pool
_t
*
heap
,
void
*
mem
,
DWORD
size
,
DWORD
inc
)
{
void
*
ret
;
...
...
@@ -159,13 +159,13 @@ void *jsheap_grow(jsheap_t *heap, void *mem, DWORD size, DWORD inc)
return
mem
;
}
ret
=
jsheap
_alloc
(
heap
,
size
+
inc
);
ret
=
heap_pool
_alloc
(
heap
,
size
+
inc
);
if
(
ret
)
/* FIXME: avoid copying for custom blocks */
memcpy
(
ret
,
mem
,
size
);
return
ret
;
}
void
jsheap_clear
(
jsheap
_t
*
heap
)
void
heap_pool_clear
(
heap_pool
_t
*
heap
)
{
struct
list
*
tmp
;
...
...
@@ -188,20 +188,20 @@ void jsheap_clear(jsheap_t *heap)
heap
->
mark
=
FALSE
;
}
void
jsheap_free
(
jsheap
_t
*
heap
)
void
heap_pool_free
(
heap_pool
_t
*
heap
)
{
DWORD
i
;
jsheap
_clear
(
heap
);
heap_pool
_clear
(
heap
);
for
(
i
=
0
;
i
<
heap
->
block_cnt
;
i
++
)
heap_free
(
heap
->
blocks
[
i
]);
heap_free
(
heap
->
blocks
);
jsheap
_init
(
heap
);
heap_pool
_init
(
heap
);
}
jsheap_t
*
jsheap_mark
(
jsheap
_t
*
heap
)
heap_pool_t
*
heap_pool_mark
(
heap_pool
_t
*
heap
)
{
if
(
heap
->
mark
)
return
NULL
;
...
...
dlls/jscript/parser.y
View file @
02d63cb3
...
...
@@ -1487,7 +1487,7 @@ static void program_parsed(parser_ctx_t *ctx, source_elements_t *source)
void parser_release(parser_ctx_t *ctx)
{
script_release(ctx->script);
jsheap
_free(&ctx->heap);
heap_pool
_free(&ctx->heap);
heap_free(ctx);
}
...
...
@@ -1495,7 +1495,7 @@ HRESULT script_parse(script_ctx_t *ctx, const WCHAR *code, const WCHAR *delimite
parser_ctx_t **ret)
{
parser_ctx_t *parser_ctx;
jsheap
_t *mark;
heap_pool
_t *mark;
HRESULT hres;
const WCHAR html_tagW[] = {'<','/','s','c','r','i','p','t','>',0};
...
...
@@ -1513,11 +1513,11 @@ HRESULT script_parse(script_ctx_t *ctx, const WCHAR *code, const WCHAR *delimite
script_addref(ctx);
parser_ctx->script = ctx;
mark =
jsheap
_mark(&ctx->tmp_heap);
jsheap
_init(&parser_ctx->heap);
mark =
heap_pool
_mark(&ctx->tmp_heap);
heap_pool
_init(&parser_ctx->heap);
parser_parse(parser_ctx);
jsheap
_clear(mark);
heap_pool
_clear(mark);
hres = parser_ctx->hres;
if(FAILED(hres)) {
WARN("parser failed around %s\n",
...
...
dlls/jscript/regexp.c
View file @
02d63cb3
...
...
@@ -312,7 +312,7 @@ typedef struct REGlobalData {
size_t
backTrackCount
;
/* how many times we've backtracked */
size_t
backTrackLimit
;
/* upper limit on backtrack states */
jsheap_t
*
pool
;
/* It's faster to use one malloc'd pool
heap_pool_t
*
pool
;
/* It's faster to use one malloc'd pool
than to malloc/free the three items
that are allocated from this pool */
}
REGlobalData
;
...
...
@@ -468,7 +468,7 @@ NewRENode(CompilerState *state, REOp op)
{
RENode
*
ren
;
ren
=
jsheap
_alloc
(
&
state
->
context
->
tmp_heap
,
sizeof
(
*
ren
));
ren
=
heap_pool
_alloc
(
&
state
->
context
->
tmp_heap
,
sizeof
(
*
ren
));
if
(
!
ren
)
{
/* js_ReportOutOfScriptQuota(cx); */
return
NULL
;
...
...
@@ -2001,7 +2001,7 @@ PushBackTrackState(REGlobalData *gData, REOp op,
JS_COUNT_OPERATION
(
gData
->
cx
,
JSOW_ALLOCATION
);
btincr
=
((
btincr
+
btsize
-
1
)
/
btsize
)
*
btsize
;
gData
->
backTrackStack
=
jsheap
_grow
(
gData
->
pool
,
gData
->
backTrackStack
,
btsize
,
btincr
);
gData
->
backTrackStack
=
heap_pool
_grow
(
gData
->
pool
,
gData
->
backTrackStack
,
btsize
,
btincr
);
if
(
!
gData
->
backTrackStack
)
{
js_ReportOutOfScriptQuota
(
gData
->
cx
);
gData
->
ok
=
FALSE
;
...
...
@@ -2358,7 +2358,7 @@ ReallocStateStack(REGlobalData *gData)
size_t
limit
=
gData
->
stateStackLimit
;
size_t
sz
=
sizeof
(
REProgState
)
*
limit
;
gData
->
stateStack
=
jsheap
_grow
(
gData
->
pool
,
gData
->
stateStack
,
sz
,
sz
);
gData
->
stateStack
=
heap_pool
_grow
(
gData
->
pool
,
gData
->
stateStack
,
sz
,
sz
);
if
(
!
gData
->
stateStack
)
{
js_ReportOutOfScriptQuota
(
gData
->
cx
);
gData
->
ok
=
FALSE
;
...
...
@@ -3164,7 +3164,7 @@ static REMatchState *InitMatch(script_ctx_t *cx, REGlobalData *gData, JSRegExp *
UINT
i
;
gData
->
backTrackStackSize
=
INITIAL_BACKTRACK
;
gData
->
backTrackStack
=
jsheap
_alloc
(
gData
->
pool
,
INITIAL_BACKTRACK
);
gData
->
backTrackStack
=
heap_pool
_alloc
(
gData
->
pool
,
INITIAL_BACKTRACK
);
if
(
!
gData
->
backTrackStack
)
goto
bad
;
...
...
@@ -3174,7 +3174,7 @@ static REMatchState *InitMatch(script_ctx_t *cx, REGlobalData *gData, JSRegExp *
gData
->
backTrackLimit
=
0
;
gData
->
stateStackLimit
=
INITIAL_STATESTACK
;
gData
->
stateStack
=
jsheap
_alloc
(
gData
->
pool
,
sizeof
(
REProgState
)
*
INITIAL_STATESTACK
);
gData
->
stateStack
=
heap_pool
_alloc
(
gData
->
pool
,
sizeof
(
REProgState
)
*
INITIAL_STATESTACK
);
if
(
!
gData
->
stateStack
)
goto
bad
;
...
...
@@ -3183,7 +3183,7 @@ static REMatchState *InitMatch(script_ctx_t *cx, REGlobalData *gData, JSRegExp *
gData
->
regexp
=
re
;
gData
->
ok
=
TRUE
;
result
=
jsheap
_alloc
(
gData
->
pool
,
offsetof
(
REMatchState
,
parens
)
+
re
->
parenCount
*
sizeof
(
RECapture
));
result
=
heap_pool
_alloc
(
gData
->
pool
,
offsetof
(
REMatchState
,
parens
)
+
re
->
parenCount
*
sizeof
(
RECapture
));
if
(
!
result
)
goto
bad
;
...
...
@@ -3221,7 +3221,7 @@ static JSRegExp *
js_NewRegExp
(
script_ctx_t
*
cx
,
jsstr_t
*
str
,
UINT
flags
,
BOOL
flat
)
{
JSRegExp
*
re
;
jsheap
_t
*
mark
;
heap_pool
_t
*
mark
;
CompilerState
state
;
size_t
resize
;
jsbytecode
*
endPC
;
...
...
@@ -3229,7 +3229,7 @@ js_NewRegExp(script_ctx_t *cx, jsstr_t *str, UINT flags, BOOL flat)
size_t
len
;
re
=
NULL
;
mark
=
jsheap
_mark
(
&
cx
->
tmp_heap
);
mark
=
heap_pool
_mark
(
&
cx
->
tmp_heap
);
len
=
jsstr_length
(
str
);
state
.
context
=
cx
;
...
...
@@ -3306,7 +3306,7 @@ js_NewRegExp(script_ctx_t *cx, jsstr_t *str, UINT flags, BOOL flat)
re
->
source
=
str
;
out:
jsheap
_clear
(
mark
);
heap_pool
_clear
(
mark
);
return
re
;
}
...
...
@@ -3428,17 +3428,17 @@ HRESULT regexp_match_next(script_ctx_t *ctx, jsdisp_t *dispex, DWORD rem_flags,
match_result_t
*
ret
)
{
RegExpInstance
*
regexp
=
(
RegExpInstance
*
)
dispex
;
jsheap
_t
*
mark
;
heap_pool
_t
*
mark
;
HRESULT
hres
;
if
((
rem_flags
&
REM_CHECK_GLOBAL
)
&&
!
(
regexp
->
jsregexp
->
flags
&
JSREG_GLOB
))
return
S_FALSE
;
mark
=
jsheap
_mark
(
&
ctx
->
tmp_heap
);
mark
=
heap_pool
_mark
(
&
ctx
->
tmp_heap
);
hres
=
do_regexp_match_next
(
ctx
,
regexp
,
rem_flags
,
str
,
cp
,
parens
,
parens_size
,
parens_cnt
,
ret
);
jsheap
_clear
(
mark
);
heap_pool
_clear
(
mark
);
return
hres
;
}
...
...
@@ -3449,10 +3449,10 @@ static HRESULT regexp_match(script_ctx_t *ctx, jsdisp_t *dispex, jsstr_t *str, B
match_result_t
*
ret
=
NULL
,
cres
;
const
WCHAR
*
cp
=
str
->
str
;
DWORD
i
=
0
,
ret_size
=
0
;
jsheap
_t
*
mark
;
heap_pool
_t
*
mark
;
HRESULT
hres
;
mark
=
jsheap
_mark
(
&
ctx
->
tmp_heap
);
mark
=
heap_pool
_mark
(
&
ctx
->
tmp_heap
);
while
(
1
)
{
hres
=
do_regexp_match_next
(
ctx
,
This
,
0
,
str
,
&
cp
,
NULL
,
NULL
,
NULL
,
&
cres
);
...
...
@@ -3488,7 +3488,7 @@ static HRESULT regexp_match(script_ctx_t *ctx, jsdisp_t *dispex, jsstr_t *str, B
}
}
jsheap
_clear
(
mark
);
heap_pool
_clear
(
mark
);
if
(
FAILED
(
hres
))
{
heap_free
(
ret
);
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