[webkit-reviews] review granted: [Bug 72367] DFG should distinguish between constants in the constant pool and weak constants added as artifacts of code generation : [Attachment 115124] the patch

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Nov 15 10:54:53 PST 2011


Geoffrey Garen <ggaren at apple.com> has granted Filip Pizlo <fpizlo at apple.com>'s
request for review:
Bug 72367: DFG should distinguish between constants in the constant pool and
weak constants added as artifacts of code generation
https://bugs.webkit.org/show_bug.cgi?id=72367

Attachment 115124: the patch
https://bugs.webkit.org/attachment.cgi?id=115124&action=review

------- Additional Comments from Geoffrey Garen <ggaren at apple.com>
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.


More information about the webkit-reviews mailing list