jscript: Rename jsheap_t to heap_pool_t.

oldstable
Piotr Caban 2013-02-15 14:04:14 +01:00 committed by Alexandre Julliard
parent 2b5babc399
commit 02d63cb312
7 changed files with 47 additions and 47 deletions

View File

@ -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) {

View File

@ -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 {

View File

@ -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)) {

View File

@ -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;

View File

@ -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;

View File

@ -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",

View File

@ -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;