[Pkg-mozext-commits] [adblock-plus] 17/464: Minor changes, in the hopes of fixing GC issues.
David Prévot
taffit at moszumanska.debian.org
Tue Jul 22 20:43:58 UTC 2014
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository adblock-plus.
commit 963c2b9fe4801a8b69ed258b40885a27bb26bdc7
Author: Joshua Cranmer <Pidgeot18 at gmail.com>
Date: Fri Feb 27 16:47:38 2009 -0500
Minor changes, in the hopes of fixing GC issues.
---
jshydra.cpp | 9 ++++++---
scripts/cleanast.js | 10 ++++++++++
tests/ast.js | 1 +
3 files changed, 17 insertions(+), 3 deletions(-)
diff --git a/jshydra.cpp b/jshydra.cpp
index b242d92..ff59c3f 100644
--- a/jshydra.cpp
+++ b/jshydra.cpp
@@ -139,8 +139,9 @@ JSObject *makeNode(JSParseNode *node) {
case LIST: {
JSObject *array = JS_NewArrayObject(cx, 0, NULL);
int i = 0;
- for (node = node->pn_head; node; node = node->pn_next) {
- setArrayElement(array, i++, makeNode(node));
+ JSParseNode *element = node->pn_head;
+ for (; element; element = element->pn_next) {
+ setArrayElement(array, i++, makeNode(element));
}
setObjectProperty(object, "kids", array);
break;
@@ -187,7 +188,7 @@ JSObject *makeNode(JSParseNode *node) {
fprintf(stderr, "Unexpected type: %d (arity %d)\n", node->pn_type, node->pn_arity);
break;
}
- JS_LeaveLocalRootScope(cx);
+ JS_LeaveLocalRootScopeWithResult(cx, OBJECT_TO_JSVAL(object));
return object;
}
@@ -197,6 +198,8 @@ void parseFile(FILE *file, char *filename) {
return;
JSParseNode *root = js_ParseScript(cx, globalObj, &pc);
JSObject *ast = makeNode(root);
+ jshydra_rootObject(cx, ast);
+ JS_GC(cx);
jsval func = jshydra_getToplevelFunction(cx, "process_js");
if (JS_TypeOfValue(cx, func) != JSTYPE_FUNCTION) {
fprintf(stderr, "No function process_js!\n");
diff --git a/scripts/cleanast.js b/scripts/cleanast.js
index 44996d9..ad09b01 100644
--- a/scripts/cleanast.js
+++ b/scripts/cleanast.js
@@ -1,4 +1,14 @@
/**
+ * A brief description of some nodes.
+ *
+ * Scope block information:
+ * variables (Variable[]): a list of variables declared in the block
+ * functions (Function[]): a list of functions declared in the block
+ * constants (Variable[]): a list of constants declared in the block
+ * code (Statement[]): a list of statements in the block
+ */
+
+/**
* Takes the node rooted at the AST and decomposes it into readable sections.
*/
function clean_ast(ast) {
diff --git a/tests/ast.js b/tests/ast.js
index cc7ee73..a531434 100644
--- a/tests/ast.js
+++ b/tests/ast.js
@@ -14,6 +14,7 @@ function process_js(ast) {
_print("Global constants:");
for each (let v in toplevel.constants) {
_print("\t" + v.name + " at " + v.loc.line + ":" + v.loc.column);
+ _print(uneval(v));
}
_print("Global functions:");
for each (let v in toplevel.functions) {
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/adblock-plus.git
More information about the Pkg-mozext-commits
mailing list