Bug 137596

Summary: Have the ProfileType node in the DFG convert to a structure check where it can
Product: WebKit Reporter: Saam Barati <saam>
Component: JavaScriptCoreAssignee: Saam Barati <saam>
Status: RESOLVED FIXED    
Severity: Normal CC: commit-queue, ddkilzer
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
patch
fpizlo: review+
patch none

Description Saam Barati 2014-10-09 23:14:34 PDT
Implementing this would require each TypeSet keeping track of which StructureIDs it has seen that have been garbage collected.
Currently, when a GC happens, each TypeSet will clear its StructureID cache, this change would require a more sophisticated purging
of the StructureIDs a TypeSet has seen to only remove the StructureIDs that are being GCed.
Comment 1 Saam Barati 2014-10-15 00:38:49 PDT
Created attachment 239854 [details]
patch
Comment 2 Filip Pizlo 2014-10-16 11:29:56 PDT
Comment on attachment 239854 [details]
patch

View in context: https://bugs.webkit.org/attachment.cgi?id=239854&action=review

> Source/JavaScriptCore/runtime/TypeProfiler.h:117
> +    std::unique_ptr<Bag<TypeLocation>> m_typeLocationInfo;

Maybe you could just do Bag<TypeLocation>.  A Bag is just a pointer-sized word if it's empty;

> Source/JavaScriptCore/runtime/TypeSet.cpp:115
> +    Vector<Structure*> willBeSwept;
> +    for (Structure* structure : m_structureSet) {
> +        if (!Heap::isMarked(structure))
> +            willBeSwept.append(structure);
> +    }
> +    for (Structure* structure : willBeSwept)
> +        m_structureSet.remove(structure);

Now that we have all of the C++, this could be written as:

m_structureSet.genericFilter([] (Structure* structure) -> bool { return Heap::isMarked(sturcture); });
Comment 3 Saam Barati 2014-10-16 12:13:28 PDT
Created attachment 239956 [details]
patch

with suggested changes.
Comment 4 David Kilzer (:ddkilzer) 2014-10-16 14:28:07 PDT
Comment on attachment 239956 [details]
patch

Committed r174789: http://trac.webkit.org/changeset/174789