Re: [v8-users] How to instrument function creation and invocation in v8

2017-12-06 Thread tobias . urban
Hi,
I also want to trace javascript function calls inside of chromium (V8). I 
am using the --trace flag as suggested. However, it does not trace "native" 
function calls.

Example:
I have the following simple website:



 A simple test script


function foo(var0){
  return(bar(var0.concat(" World!")));
}
function bar(var1){
  return(bar2(var1));
}
function bar2(var1){ 
 return(var1);
}
var ret = foo("Hello");
console.log(ret);
alert(document.getElementById("thediv"));




When I open it in headless chromium I get the following tracing information:
   
1: ~+0(this=0x191cc7a940b9 ) { 
2:  ~foo+0(this=0x191cc7a940b9 , 0x3946ed57cd59 ) {   
3:  ~bar+0(this=0x191cc7a940b9 , 0x191cc7af20d9 ) {   
4:~bar2+0(this=0x191cc7a940b9 , 0x191cc7af20d9 ) {  
4:} -> 0x191cc7af20d9
3:   } -> 0x191cc7af20d9
2:  } -> 0x191cc7af20d9 



Functions like concat(),  getElementById(), or log() are not traced. I 
checked the source code of traceEnter and traceExit (Line 825 and below) 
but native functions are not traced by those. Can anyone give me some 
advice what I have to do to trace intrinsic functions
 or other function calls (e.g., functions defined in the ECMA specification 
or browser speficic APIs) within chromium.

Any help is appriciated!

Cheers,
Tobias

TraceEnter implementation

RUNTIME_FUNCTION(Runtime_TraceEnter) {
 SealHandleScope shs(isolate);
 DCHECK_EQ(0, args.length());
 PrintIndentation(isolate);
 JavaScriptFrame::PrintTop(isolate, stdout, true, false);
 PrintF(" {\n");
 return isolate->heap()->undefined_value();
}






Am Donnerstag, 3. Dezember 2015 17:49:13 UTC+1 schrieb WENZHI CUI:
>
> Hi Jacob,
>   I found kTraceEnter and kTraceExit. I think I can insert my code there. 
> Thank you!
>
> Thanks,
> Wenzhi Cui
>
> On Thu, Dec 3, 2015 at 10:22 AM, Jakob Kummerow  > wrote:
>
>> It's not an API, it's a flag. Just try it to see what it does, and look 
>> at the source (grep for FLAG_trace) to see how it's implemented.
>>
>> On Thu, Dec 3, 2015 at 5:15 PM, WENZHI CUI > > wrote:
>>
>>> Hi Jacob,
>>>   Thank you very much for your reply. 
>>>   I haven't got time to look at the trace API closely. However, I do 
>>> want to instrument some code before and after each function invocation
>>> , is that possible with trace API or I can simply add my own trace 
>>> functions?
>>>
>>>
>>> Thanks,
>>> Wenzhi Cui
>>>
>>
>

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
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 v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [v8-users] How to build a fixed version of V8 and its dependencies.

2017-12-06 Thread Edd Barrett


On Monday, November 27, 2017 at 7:06:47 PM UTC, Jakob Kummerow wrote:
>
> The depot_tools system makes this easy, actually:
>
> git checkout 
> gclient sync
> ninja -C out/ d8
>
> (If you go back far enough before ninja was supported, replace the last 
> command with the equivalent make/GYP based build.)
>

Thanks. I confirm that this works :)

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
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 v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.