[webkit-dev] Tracking global variables.

arijit chattopadhyay arijit_nitdgp06 at yahoo.co.in
Mon Sep 16 18:48:31 PDT 2013

SymbolTable iterator gives access to the global variables.

 From: Filip Pizlo <fpizlo at apple.com>
To: arijit chattopadhyay <arijit_nitdgp06 at yahoo.co.in> 
Cc: "webkit-dev at lists.webkit.org" <webkit-dev at lists.webkit.org> 
Sent: Monday, 16 September 2013 9:26 PM
Subject: Re: [webkit-dev] Tracking global variables.

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. 


On Sep 16, 2013, at 5:49 PM, arijit chattopadhyay <arijit_nitdgp06 at yahoo.co.in> wrote:

>   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()) {
>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?
>webkit-dev mailing list
>webkit-dev at lists.webkit.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-dev/attachments/20130917/2b8a6edf/attachment.html>

More information about the webkit-dev mailing list