[Webkit-unassigned] [Bug 158083] LLInt should support other types of prototype GetById caching.

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Sat Jun 11 14:40:25 PDT 2016


https://bugs.webkit.org/show_bug.cgi?id=158083

--- Comment #47 from Saam Barati <sbarati at apple.com> ---
(In reply to comment #45)
> (In reply to comment #44)
> > A PropertyName is identical to a UniquedStringImpl* so you can just pass
> > that.
> > A PropertyName is a struct with a single UniquedStringImpl* field.
> > 
> > I believe get_by_id has an index in it's instruction corresponding to its
> > UniquedStringImpl*. You may need to write some code that loads this off
> > the CodeBlock based on some index. I'm not sure if we have code like that
> > already
> > in the LLInt but it should be easy to write. 
> 
> Actually, I don't think so. Checking the CodeBlock code I found the method
> used to get the identifier based in the identifier index.
> 
> const Identifier& CodeBlock::identifier(int index) const
> {
>     size_t unlinkedIdentifiers = m_unlinkedCode->numberOfIdentifiers();
>     if (static_cast<unsigned>(index) < unlinkedIdentifiers)
>         return m_unlinkedCode->identifier(index);
>     
> }
> 
> The m_unlikedCode stores the identifiers into a Vector<Identifier>
> m_identifiers. The problem is to revive the identifier contained in the
> Vector buffer. My current implementation is like this
> 
> macro loadIdentifier(index, dest)
>     loadp CodeBlock[cfr], t2
>     loadp CodeBlock::m_unlinkedCode[t2], t1 #t1 is pointing to
> UnlinkedCodeBlock
>     addp UnlinkedCodeBlock::m_identifiers, t1 #Offset to point to
> m_identifiers
>     loadis index, t2
>     mulp sizeof Identifier, t2 
>     addp t2, t1 # Offset to point to m_identifiers[index]
>     addp Identifier::m_string, t1 # m_identifiers[index].m_string
>     loadp t1, dest
> end 
> 
> Any tip?
This is how we solve such problems in the LLInt and JITs in general. We often
end up inlining particular functions. For the JIT, this is usually easier because it
can compile constants more easily. So, your proposed solution would definitely work,
but it's obviously not ideal. 

But I should have suggested something simpler yesterday.
When you convert your get_by_id into your specialized version, you
can stash the UniquedStringImpl* into the instruction stream itself if
you have an unused instruction offset. Do you have such a free location?

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.webkit.org/pipermail/webkit-unassigned/attachments/20160611/0b34a81a/attachment.html>


More information about the webkit-unassigned mailing list