Bug 137596 - Have the ProfileType node in the DFG convert to a structure check where it can
Summary: Have the ProfileType node in the DFG convert to a structure check where it can
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Saam Barati
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-10-09 23:14 PDT by Saam Barati
Modified: 2014-10-16 14:28 PDT (History)
2 users (show)

See Also:


Attachments
patch (20.96 KB, patch)
2014-10-15 00:38 PDT, Saam Barati
fpizlo: review+
Details | Formatted Diff | Diff
patch (20.79 KB, text/plain)
2014-10-16 12:13 PDT, Saam Barati
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
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