mirror of
https://github.com/bellard/quickjs.git
synced 2024-11-25 23:28:12 +08:00
Add JS_DumpObjects support
This commit is contained in:
parent
6e2e68fd08
commit
c46516996d
24
quickjs.c
24
quickjs.c
@ -2295,17 +2295,7 @@ void JS_FreeContext(JSContext *ctx)
|
|||||||
JS_DumpShapes(ctx->rt);
|
JS_DumpShapes(ctx->rt);
|
||||||
#endif
|
#endif
|
||||||
#ifdef DUMP_OBJECTS
|
#ifdef DUMP_OBJECTS
|
||||||
{
|
JS_DumpObjects(ctx-rt);
|
||||||
struct list_head *el;
|
|
||||||
JSGCObjectHeader *p;
|
|
||||||
printf("JSObjects: {\n");
|
|
||||||
JS_DumpObjectHeader(ctx->rt);
|
|
||||||
list_for_each(el, &rt->gc_obj_list) {
|
|
||||||
p = list_entry(el, JSGCObjectHeader, link);
|
|
||||||
JS_DumpGCObject(rt, p);
|
|
||||||
}
|
|
||||||
printf("}\n");
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
#ifdef DUMP_MEM
|
#ifdef DUMP_MEM
|
||||||
{
|
{
|
||||||
@ -6378,6 +6368,18 @@ void JS_DumpMemoryUsage(FILE *fp, const JSMemoryUsage *s, JSRuntime *rt)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void JS_DumpObjects(JSRuntime *rt){
|
||||||
|
struct list_head *el;
|
||||||
|
JSGCObjectHeader *p;
|
||||||
|
printf("JSObjects: {\n");
|
||||||
|
JS_DumpObjectHeader(rt);
|
||||||
|
list_for_each(el, &rt->gc_obj_list) {
|
||||||
|
p = list_entry(el, JSGCObjectHeader, link);
|
||||||
|
JS_DumpGCObject(rt, p);
|
||||||
|
}
|
||||||
|
printf("}\n");
|
||||||
|
}
|
||||||
|
|
||||||
JSValue JS_GetGlobalObject(JSContext *ctx)
|
JSValue JS_GetGlobalObject(JSContext *ctx)
|
||||||
{
|
{
|
||||||
return JS_DupValue(ctx, ctx->global_obj);
|
return JS_DupValue(ctx, ctx->global_obj);
|
||||||
|
@ -417,6 +417,7 @@ typedef struct JSMemoryUsage {
|
|||||||
|
|
||||||
void JS_ComputeMemoryUsage(JSRuntime *rt, JSMemoryUsage *s);
|
void JS_ComputeMemoryUsage(JSRuntime *rt, JSMemoryUsage *s);
|
||||||
void JS_DumpMemoryUsage(FILE *fp, const JSMemoryUsage *s, JSRuntime *rt);
|
void JS_DumpMemoryUsage(FILE *fp, const JSMemoryUsage *s, JSRuntime *rt);
|
||||||
|
void JS_DumpObjects(JSRuntime *rt);
|
||||||
|
|
||||||
/* atom support */
|
/* atom support */
|
||||||
#define JS_ATOM_NULL 0
|
#define JS_ATOM_NULL 0
|
||||||
|
Loading…
Reference in New Issue
Block a user