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_grow(jsheap_t *heap, void *mem, DWORD size, DWORD inc) { void *ret; if(mem == (BYTE*)heap->blocks[heap->last_block] + heap->offset-size && heap->offset+inc < block_size(heap->last_block)) { heap->offset += inc; return mem; } ret = jsheap_alloc(heap, size+inc); if(ret) /* FIXME: avoid copying for custom blocks */ memcpy(ret, mem, size); return ret; }
static inline void *compiler_alloc(bytecode_t *code, size_t size) { return jsheap_alloc(&code->heap, size); }