[webkit-dev] Tracking global variables.

Filip Pizlo fpizlo at apple.com
Mon Sep 16 18:26:50 PDT 2013


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 <arijit_nitdgp06 at yahoo.co.in> 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
> webkit-dev at lists.webkit.org
> https://lists.webkit.org/mailman/listinfo/webkit-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-dev/attachments/20130916/a61aa4c7/attachment.html>


More information about the webkit-dev mailing list