Hello all,

I am working on project on V8 for which I need to get all the constants in 
a JS program. I need to know where the ASTNodes for the constants is 
created.
Although, I have got the subclasses of ASTNode like  Statement, Expression 
etc. I also found the function which creates Literal ASTNode for a number, 
"NewNumberLiteral" in AstFactory in ast.h. I entered a simple printf 
statement to print the value of the number for which it is making Number 
Literal i.e. my code now is

Literal* NewNumberLiteral(double number, int pos, bool with_dot = false) {
    ::printf("NewNumberLiteral %f %d\n", number, pos);
    return new (zone_)
        Literal(zone_, ast_value_factory_->NewNumber(number, with_dot), pos
);
   

Following is the JS file I am executing:

function test( obj ) {
  return obj.prop + obj.prop;
}

var a = { prop: 'a' }, i = 10;
i = 12+23;
while ( i < 10000 ) {
  test( a );
  i = i + 123;
}

Although, the printf statement is printing 12 and 23 and their sum 35 also 
(because of the optimization done by v8 which computes the sum).
But I am not getting 10000, 123 and 10 as the output.

Can anyone please tell me where is the another function creating the number 
literal. It will be very helpful.

Thank You,

-- 
-- 
v8-users mailing list
[email protected]
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to