Hi Tobias,

Most probably you would have to manually annotate all CodeStubAssembler 
builtins with a print statement to get the proper output.
There are several macros where you might be able to inject a runtime call 
or a direct C++ call (see TF_BUILTIN and friends).
The same counts for all C++ runtime functions and builtins (see 
RUNTIME_FUNCTION and BUILTIN macros),

Cheers,
Camillo

On Wednesday, December 6, 2017 at 11:45:44 AM UTC+1, tobias...@w-hs.de 
wrote:
>
> 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:
> <html>
> <head></head>
> <body>
> <h1> A simple test script</h1>
> <div id="thediv"></div>
> <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"));
> </script></body></html>
>
>
>
> When I open it in headless chromium I get the following tracing 
> information:
>    
> 1: ~+0(this=0x191cc7a940b9 <JSGlobal Object>) { 
> 2:  ~foo+0(this=0x191cc7a940b9 <JSGlobal Object>, 0x3946ed57cd59 <String[5
> ]: Hello>) {   
> 3:  ~bar+0(this=0x191cc7a940b9 <JSGlobal Object>, 0x191cc7af20d9 <String[
> 12]: Hello World!>) {   
> 4:    ~bar2+0(this=0x191cc7a940b9 <JSGlobal Object>, 0x191cc7af20d9 <
> String[12]: Hello World!>) {  
> 4:    } -> 0x191cc7af20d9 <String[12]: Hello World!>   
> 3:   } -> 0x191cc7af20d9 <String[12]: Hello World!>   
> 2:  } -> 0x191cc7af20d9 <String[12]: Hello World!>
>
>
>
> 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 <jkum...@chromium.org> 
>> 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 <cwz9...@gmail.com> 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.

Reply via email to