Global variables are stored in the JSSegmentedVariableObject portion of JSGlobalObject. You can iterate it using the SymbolTable API probably.
I don't think that going through the IdentifierTable is going to give you much joy. -Fil > On Sep 16, 2013, at 5:49 PM, arijit chattopadhyay > <[email protected]> wrote: > > Hi, > I would like to create a map of the all the globally declared variables > and their values. I tried to iterate over IdentifierTable using this code. > IdentifierTable *iTable = identifierTable; > LiteralIdentifierTable& literalTable = iTable->literalTable(); > //if(literalTable) { > cout<<"Hashmap capacity : "<<literalTable.size()<<endl; > //} > LiteralIdentifierTable::iterator itr = literalTable.begin(); > while(itr != literalTable.end()) { > ++itr; > const char *data = itr->first; > if(data && strcmp(data,"var") == 0) { > > cout<<"The literal is : "<<data<<endl; > //cout<<"And the value is : "<<*itr->second<<endl; > } > // cout<<(*itr)->first()<<endl; > //const char* key = itr->begin(); > //cout<<"The Key is : "<<key<<endl; > } > > However I am not able to get the values corresponding to the variable. Is > that IdentifierTable does not store global variables? > I am chaing the source code for the Javascript engine, so I don't have have > to use the api. I would like to know the datastructure(s) that stores global > variables and how get the value of a variable? > Thanks, > wc > _______________________________________________ > webkit-dev mailing list > [email protected] > https://lists.webkit.org/mailman/listinfo/webkit-dev
_______________________________________________ webkit-dev mailing list [email protected] https://lists.webkit.org/mailman/listinfo/webkit-dev

