A test case to demonstrate the issue can be found at:

https://code.google.com/p/v8/issues/detail?id=4527

On Thursday, October 29, 2015 at 3:46:21 PM UTC-7, Jane Chen wrote:
>
> Testing profiling against v8 4.6.88.
>
> I have functions that are exposed through accessor callbacks.  If a native 
> function is set for multiple accessor properties, the last property shows 
> up as the function name in the CpuProfileNode, regardless what name you set 
> to the function returned by the accessor function.  For example:
>
> global->SetAccessor(
>     v8::String::NewFromUtf8(isolate, "print", v8::NewStringType::kNormal)
>           .ToLocalChecked(),
>     getFunction);
> global->SetAccessor(
>     v8::String::NewFromUtf8(isolate, "read", v8::NewStringType::kNormal)
>           .ToLocalChecked(),
>     getFunction);
>
> Now "get read" is the function name in CpuProfileNode although print is 
> called.
>
> Test script: 
>  
> function isPrime(num) { 
>   for (var count = 2; count < num; count++) 
>     if (num % count == 0) return false; 
>   return true; 
> }; 
>  
> var total = 0; 
> for (var i = 2; i < 100000; i++) { 
>   if (isPrime(i)) { 
>     print(i); 
>     total++ 
>   } 
> }; 
> total; 
>  
> TotalHitCount:2233
>
> FunctionName:(root)
> LineNumber:0
> ColumnNumber:0
> HitCount:0
>     FunctionName:(program)
>     LineNumber:0
>     ColumnNumber:0
>     HitCount:7
>     FunctionName:
>     LineNumber:0
>     ColumnNumber:0
>     HitCount:13
>         FunctionName:isPrime
>         LineNumber:1
>         ColumnNumber:17
>         HitCount:8
>     FunctionName:
>     LineNumber:1
>     ColumnNumber:1
>     HitCount:2196
>         FunctionName:get read
>         LineNumber:0
>         ColumnNumber:0
>         HitCount:2
>     FunctionName:(garbage collector)
>     LineNumber:0
>     ColumnNumber:0
>     HitCount:7
>
>
> Given that an accessor callback takes a property name, it should allow one 
> native function to handle multiple properties.  Is this a bug, or am I 
> doing something wrong?  
>

-- 
-- 
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