[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 10:54:54 PST 2011


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


Geoffrey Garen <ggaren at apple.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
 Attachment #115124|review?                     |review+
               Flag|                            |




--- Comment #3 from Geoffrey Garen <ggaren at apple.com>  2011-11-15 10:54:54 PST ---
(From update of attachment 115124)
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.

-- 
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