Re: Add a faster API for creating v8::Integer objects (issue 11212004)

16 views
Skip to first unread message

da...@chromium.org

unread,
Oct 19, 2012, 3:31:18 AM10/19/12
to aba...@chromium.org, sven...@chromium.org, v8-...@googlegroups.com, har...@chromium.org, ese...@google.com
If you are going to go through all this trouble to optimize for the
isolate, you
probably should make these inlined for the fast case of looking up a 31-bit
signed integer. If you inline that case and then fall back to api.cc only
when
you need to allocate a heap number. If you do that, I suspect that it will
as
fast as the integer cache, unless webkit often caches integers where the
than
don't fit in the 31-bit signed range.





https://codereview.chromium.org/11212004/

aba...@chromium.org

unread,
Oct 19, 2012, 4:32:28 AM10/19/12
to da...@chromium.org, sven...@chromium.org, v8-...@googlegroups.com, har...@chromium.org, ese...@google.com
I wanted to do that, but I wasn't sure how. I couldn't figure out how to
call
i::Smi::IsValid and i::Smi::FromInt from the header. Should I just do the
bit
mashing manually or is there a more structured approach I should use in the
header?

Thanks for the review!

https://codereview.chromium.org/11212004/

da...@chromium.org

unread,
Oct 19, 2012, 7:00:35 AM10/19/12
to aba...@chromium.org, sven...@chromium.org, v8-...@googlegroups.com, har...@chromium.org, ese...@google.com
Actually, I don't know if you will ever be able to replace the int cache
with
this code, since it allocates handles. Even if it's inlined, the handle
allocation will probably make it more than trivially expensive.

I'll land this in its current form which LGTM. At some point, mstarzinger or
svenpanne might want to make it inlinable, but that won't change the API.

https://codereview.chromium.org/11212004/
Reply all
Reply to author
Forward
0 new messages