Is ArrayTimSortDescriptor constructor used?

17 views
Skip to first unread message

Andrew Grieve

unread,
Jun 3, 2021, 10:19:55 AM6/3/21
to v8-...@googlegroups.com
I'm investigating why ArrayTimSortDescriptor does not have a vtable without -fwhole-program-vtables, but does have one with the flag. 

Given that it does have virtual methods, I'd like to first figure out why it does not have a vtable without the flag. One theory is just that its constructor is never called. I can't find in codesearch where its constructor is called... but V8 is often doing clever things, so I thought I'd ask :). 

The supersize breakdown shows this (from crrev/2713049/1). You can also filter by "interface-descriptors" to see that the same is true for other similar classes. I just thought I'd pick on ArrayTimSortDescriptor :P.

Any pointers or theories?


Ross McIlroy

unread,
Jun 3, 2021, 11:59:30 AM6/3/21
to v8-dev
Hi Andrew,

I can't answer your questions about vtables, but I can try to untangle the "clever things" in V8's codebase that make it difficult to find the caller to the constructor.
 - The ArrayTimSort builtin is defined in V8's Torque DSL here, and called here.
 - The torque compiler generates a bunch of C++ code to implement the buitlins and their interface descriptors. One of the things it creates is a list of the Torque defined builtins in a macro, with the ArrayTimSort one listed here.
 - This macro is used to define a Builtin_ArrayTimSort_InterfaceDescriptor = ArrayTimSortDescriptor here using V8's favorite macro magic trick.
 - This descriptor is then created by the call to Builtins::CallableFor(..., Builtins::kArrayTimSort) here in the auto-generated C++ code created by the Torque code listed in step 1, via the macro-magic switch statement here.

Who said V8 was complicated?...

Cheers,
Ross


--
--
v8-dev mailing list
v8-...@googlegroups.com
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to v8-dev+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/v8-dev/CABiQX1UdaDkp5VVKSpU77HueKjCr%3DsEF3WXR8t0aV8-%2B1VwgSw%40mail.gmail.com.

Leszek Swirski

unread,
Jun 7, 2021, 7:52:05 AM6/7/21
to v8-dev
Additionally to what Ross said, interface descriptors recently went through a big refactoring (https://chromium-review.googlesource.com/c/v8/v8/+/2831872) that devirtualized the CallInterfaceDescriptor base class; and, among other things, removed the v8::internal::TorqueInterfaceDescriptor class, which I see in the supersize report, so I think you're looking at an out-of-date version of V8 anyway.

Reply all
Reply to author
Forward
0 new messages