Re: [v8-users] v8::Local equality check "=="

2017-03-23 Thread Ben Noordhuis
On Wed, Mar 22, 2017 at 7:34 PM, Hanyun Tao wrote: > I'm confused about your example, why would the first comparison 'f1==f2' > return false if they refer to the same function? Because they refer to different function objects. Setting `f1.x = 42` won't magically make .x appear on f2. -- -- v8

Re: [v8-users] v8::Local equality check "=="

2017-03-22 Thread Hanyun Tao
Thanks for your answer! I'm confused about your example, why would the first comparison 'f1==f2' return false if they refer to the same function? I checked the v8 document and found two member functions from v8 Function class, which are* int ScriptID() *and *int GetIdentityHash().* Could I use

Re: [v8-users] v8::Local equality check "=="

2017-03-22 Thread Jakob Kummerow
The == operator on v8::Local compares if two Locals are referring to the same JavaScript object (which can, of course, be a function) by object identity (aka reference). (Structural equality is the opposite!) Note that two functions can contain the same code, but have different object identity: f

[v8-users] v8::Local equality check "=="

2017-03-21 Thread Hanyun Tao
Hi all, I'm new to v8 and I want to know more about the equality check (==) between two v8::Local. Currently I'm using instrumenting chromium browser. In chromium, registered event listeners are stored inside a map like data structure, and I can use the getListenerObject() method to get the v8