Maps don't keep lists of the objects that use them. To find all objects
that use a given map, you'd have to walk the entire heap to find all
objects, and filter them by map.

Considering your previous question, I'm not sure finding all objects that
use a given map will actually be helpful. A possible way to intercept
creation of properties with a given name (e.g. "mainkey") would be to run
with `--nouse-ic` and put a breakpoint on StoreIC::Store(). This is
(obviously?) not an officially supported feature, and I haven't tried it,
so you may encounter obstacles or limitations of the approach, but it might
at least get you a little further.

I guess you'd need this in Chrome, not just d8, so the full workflow is:
- build a Debug build of Chrome. Be sure to set v8_optimized_debug = false
in args.gn beforehand.
- run with each renderer in a debugger: out/debug/chrome --no-sandbox
--disable-hang-monitor --disable-extensions --js-flags="--nouse-ic"
--renderer-cmd-prefix="xterm -e gdb -args"
- bring a large amount of patience to both of these steps, and have enough
RAM in your machine (64GB is good, dunno if 32GB is enough)

Good luck!


On Wed, Nov 9, 2022 at 3:19 PM Filip Petronijevic <
fpetronijevic661...@raf.rs> wrote:

> Ok, I'll explain what problem I have and if there is any way of solving it.
>
> Imagine I have following Javascript code:
>
> var obj1=  {}
> obj1["mainkey"] = {canvasComputed: "oewrewqioewrerqewjoijiqerw", todata:
> "somerandomdata"}
>
> var obj2=  {}
> obj2["mainkey"] = "some big string"
>
> var obj3 = {}
> obj3['mainkey'] = {test: {test1:"somestring"}, test2: 3432}
>
>
> I have 3 objects, they all share same Map. My question is if I know what
> memory space this Map has, If I can use that to recursively find all
> property values of all objects that share that same Map? In this case to
> list obj1's property values (canvasComputed, toData), obj2 property values
> (1 string) and obj3  property   values(test object along with string test2)
> ?
>
> Or the only way I can list own properties of these objects is if I know
> exact memory location of each of them? Is there any way I could traverse
> from their Map or something they share in common (only mainkey key) and use
> this fact to find all property values that hold mainkey as a key?
>
>
> When I do %DebugPrint(obj1) I can see its property values and that this
> object shares same map as other objects, but I'm trying to find a way to
> generalize this by starting from some common memory slot they all share and
> traverse up recursively or whatever to get all property values?
>
> Best regards
>
>

-- 
-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/v8-users/CAKSzg3SgSNL7i2%3DSu-Qu3xDu8wtxXKa-bw6oB-qTdWPFV6hx8w%40mail.gmail.com.

Reply via email to