Bug 146874 - Watchpoints should be allocated with FastMalloc
Summary: Watchpoints should be allocated with FastMalloc
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Filip Pizlo
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-07-10 22:46 PDT by Filip Pizlo
Modified: 2015-07-11 15:30 PDT (History)
12 users (show)

See Also:


Attachments
the patch (4.32 KB, patch)
2015-07-10 22:49 PDT, Filip Pizlo
mitz: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Filip Pizlo 2015-07-10 22:46:39 PDT
Previously we had some cruft about allocating some kinds of Watchpoints in SegmentedVectors.  That's pretty sad.  Also, it appears that some of the watchpoints are allocated with normal malloc.  Also sad.
Comment 1 Filip Pizlo 2015-07-10 22:49:21 PDT
Created attachment 256645 [details]
the patch
Comment 2 Filip Pizlo 2015-07-10 22:51:09 PDT
Comment on attachment 256645 [details]
the patch

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

> Source/JavaScriptCore/bytecode/CodeBlockJettisoningWatchpoint.h:2
> - * Copyright (C) 2013 Apple Inc. All rights reserved.
> + * Copyright (C) 2013, 2015 Apple Inc. All rights reserved.

Oops, I'll revert.  I just deleted code.
Comment 3 Filip Pizlo 2015-07-10 22:54:24 PDT
Landed in http://trac.webkit.org/changeset/186705
Comment 4 Darin Adler 2015-07-11 15:30:19 PDT
Comment on attachment 256645 [details]
the patch

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

> Source/JavaScriptCore/dfg/DFGDesiredWatchpoints.h:95
>          typename HashSet<WatchpointSetType*>::iterator iter = m_sets.begin();
>          typename HashSet<WatchpointSetType*>::iterator end = m_sets.end();
> -        for (; iter != end; ++iter) {
> -            common.watchpoints.append(CodeBlockJettisoningWatchpoint(codeBlock));
> -            Adaptor::add(codeBlock, *iter, &common.watchpoints.last());
> -        }
> +        for (; iter != end; ++iter)
> +            Adaptor::add(codeBlock, *iter, common.watchpoints.add(codeBlock));

Here’s another way to write this:

    for (auto* set : m_sets)
        Adaptor::add(codeBlock, set, common.watchpoints.add(codeBlock));

I think the modern for loop makes this code look clearer.
Comment 5 Darin Adler 2015-07-11 15:30:57 PDT
Comment on attachment 256645 [details]
the patch

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

>> Source/JavaScriptCore/dfg/DFGDesiredWatchpoints.h:95
>> +            Adaptor::add(codeBlock, *iter, common.watchpoints.add(codeBlock));
> 
> Here’s another way to write this:
> 
>     for (auto* set : m_sets)
>         Adaptor::add(codeBlock, set, common.watchpoints.add(codeBlock));
> 
> I think the modern for loop makes this code look clearer.

Just noticed you did a variation on that in your very next patch. Never mind!