Mercurial > spidermonkey-playground
comparison spidermonkey-playground.cpp @ 51:8750e9ecf3af
Added a getGCRoots() function.
author | Atul Varma <varmaa@toolness.com> |
---|---|
date | Wed, 24 Jun 2009 17:29:27 -0700 |
parents | 853f80bd3b4b |
children | 0b66a265df13 |
comparison
equal
deleted
inserted
replaced
50:853f80bd3b4b | 51:8750e9ecf3af |
---|---|
414 /* Create the TCB's global object. */ | 414 /* Create the TCB's global object. */ |
415 tcb_global = JS_NewObject(tcb_cx, &global_class, NULL, NULL); | 415 tcb_global = JS_NewObject(tcb_cx, &global_class, NULL, NULL); |
416 if (tcb_global == NULL) | 416 if (tcb_global == NULL) |
417 return 1; | 417 return 1; |
418 | 418 |
419 JS_AddNamedRoot(tcb_cx, tcb_global, "TCB Global"); | |
420 | |
419 /* Populate the tcb_global object with the standard globals, | 421 /* Populate the tcb_global object with the standard globals, |
420 like Object and Array. */ | 422 like Object and Array. */ |
421 if (!JS_InitStandardClasses(tcb_cx, tcb_global)) | 423 if (!JS_InitStandardClasses(tcb_cx, tcb_global)) |
422 return 1; | 424 return 1; |
423 | 425 |
457 } | 459 } |
458 return 1; | 460 return 1; |
459 } | 461 } |
460 | 462 |
461 /* Cleanup. */ | 463 /* Cleanup. */ |
464 JS_RemoveRoot(tcb_cx, tcb_global); | |
462 JS_DestroyContext(tcb_cx); | 465 JS_DestroyContext(tcb_cx); |
463 JS_DestroyRuntime(rt); | 466 JS_DestroyRuntime(rt); |
464 JS_ShutDown(); | 467 JS_ShutDown(); |
465 | 468 |
466 printf("Farewell.\n"); | 469 printf("Farewell.\n"); |