[Webkit-unassigned] [Bug 72367] DFG should distinguish between constants in the constant pool and weak constants added as artifacts of code generation

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Nov 15 12:38:10 PST 2011


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





--- Comment #4 from Filip Pizlo <fpizlo at apple.com>  2011-11-15 12:38:11 PST ---
(In reply to comment #3)
> (From update of attachment 115124 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=115124&action=review
> 
> r=me
> 
> > Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp:540
> > +        HashMap<JSCell*, NodeIndex>::iterator iter = m_cellConstantNodes.find(cell);
> > +        if (iter != m_cellConstantNodes.end())
> > +            return iter->second;
> > +        
> > +        NodeIndex result = addToGraph(WeakJSConstant, OpInfo(cell));
> > +        m_cellConstantNodes.add(cell, result);
> > +        return result;
> 
> The idiom for "add if not existing" is:
> 
> pair<iterator, bool> result = table.add(DummyValue);
> if (result.second)
>     result.first->second = RealValue;
> 
> This saves a redundant hash lookup when first adding something to the table.

Ah, good point.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list