Disabling inline caching

224 views
Skip to first unread message

Martin Junker

unread,
Mar 1, 2016, 7:53:46 AM3/1/16
to v8-users
Hello,

I am using v8 4.5.103.30 and trying to disable inline-caching. I changed the use_ic in src/flag-definitions.h to false and compiled v8.
Then I started d8 with the --trace-ic flag and kind of expected to not have any IC's there (as the use of IC is disabled).
Am I right with that assumption? If not, how can I disable IC?

Many thanks!

Martin

Jakob Kummerow

unread,
Mar 1, 2016, 8:34:35 AM3/1/16
to v8-users
--nouse-ic (which is equivalent to changing the flag's default and recompiling) turns off those parts of the IC system that can reasonably be turned off (in particular, compilation of specialized handlers). You'll observe that --trace-ic's output changes quite a bit when you do that.

Turning off any and all uses of inline caches is not possible. The fact that we have FLAG_use_ic at all is mostly a historical artifact.


--
--
v8-users mailing list
v8-u...@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+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Martin Junker

unread,
Mar 1, 2016, 9:10:47 AM3/1/16
to v8-users
Umh, okay, thanks a lot!

Maybe I should elaborate my problem, hopefully I get some further help:

I (more or less with the help of a colleague) patched parts of the v8 code (mostly the String) and added a few functions to the String prototype. Let's call one of the function isPatched(), which checks whether a string is patched or not (by setting the heap of the string to a different, self-defined map).

Assume the following code:

var s = "patchedString"
for (var i = 0; i < s.length; i++) {
    s[i].isPatched()
}


This is true for two times, and then turns false from the third iteration on. I fixed this behaviour by calling GenerateMiss(masm) as the first command in KeyedLoadIC::GenerateMegamorphic (ic-x64:286), but this is probably a very bad hack and I want to avoid that. Moreover, it did not fix the same problem with other "added" functions, where the IC also somehow interferes (return two times the right answer, from the third time on the wrong answer)

My guess is, that the two first lookups for the characters are cache misses (as shown in the ic-trace) and the "right" patched string is accessed. From the third character lookup on, it is somehow a cache hit and a non-patched string in the cache is accessed.

Is there any way to avoid this behaviour or to find a better way of having a "cache hit on the wrong string"?

Thanks a lot in advance!
Reply all
Reply to author
Forward
0 new messages