Replace WTF::move with WTFMove
[WebKit-https.git] / Source / JavaScriptCore / bytecode / StructureStubClearingWatchpoint.h
1 /*
2  * Copyright (C) 2012, 2015 Apple Inc. All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
7  * 1. Redistributions of source code must retain the above copyright
8  *    notice, this list of conditions and the following disclaimer.
9  * 2. Redistributions in binary form must reproduce the above copyright
10  *    notice, this list of conditions and the following disclaimer in the
11  *    documentation and/or other materials provided with the distribution.
12  *
13  * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
14  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
17  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
24  */
25
26 #ifndef StructureStubClearingWatchpoint_h
27 #define StructureStubClearingWatchpoint_h
28
29 #include "ObjectPropertyCondition.h"
30 #include "Watchpoint.h"
31
32 #if ENABLE(JIT)
33
34 #include <wtf/FastMalloc.h>
35 #include <wtf/Noncopyable.h>
36
37 namespace JSC {
38
39 class CodeBlock;
40 class StructureStubInfo;
41 class WatchpointsOnStructureStubInfo;
42
43 class StructureStubClearingWatchpoint : public Watchpoint {
44     WTF_MAKE_NONCOPYABLE(StructureStubClearingWatchpoint);
45     WTF_MAKE_FAST_ALLOCATED;
46 public:
47     StructureStubClearingWatchpoint(
48         const ObjectPropertyCondition& key,
49         WatchpointsOnStructureStubInfo& holder,
50         std::unique_ptr<StructureStubClearingWatchpoint> next)
51         : m_key(key)
52         , m_holder(holder)
53         , m_next(WTFMove(next))
54     {
55     }
56     
57     virtual ~StructureStubClearingWatchpoint();
58     
59     static StructureStubClearingWatchpoint* push(
60         const ObjectPropertyCondition& key,
61         WatchpointsOnStructureStubInfo& holder,
62         std::unique_ptr<StructureStubClearingWatchpoint>& head);
63
64 protected:
65     virtual void fireInternal(const FireDetail&) override;
66
67 private:
68     ObjectPropertyCondition m_key;
69     WatchpointsOnStructureStubInfo& m_holder;
70     std::unique_ptr<StructureStubClearingWatchpoint> m_next;
71 };
72
73 class WatchpointsOnStructureStubInfo {
74     WTF_MAKE_NONCOPYABLE(WatchpointsOnStructureStubInfo);
75     WTF_MAKE_FAST_ALLOCATED;
76 public:
77     WatchpointsOnStructureStubInfo(CodeBlock* codeBlock, StructureStubInfo* stubInfo)
78         : m_codeBlock(codeBlock)
79         , m_stubInfo(stubInfo)
80     {
81     }
82     
83     ~WatchpointsOnStructureStubInfo();
84     
85     StructureStubClearingWatchpoint* addWatchpoint(const ObjectPropertyCondition& key);
86     
87     static StructureStubClearingWatchpoint* ensureReferenceAndAddWatchpoint(
88         std::unique_ptr<WatchpointsOnStructureStubInfo>& holderRef,
89         CodeBlock*, StructureStubInfo*, const ObjectPropertyCondition& key);
90     
91     CodeBlock* codeBlock() const { return m_codeBlock; }
92     StructureStubInfo* stubInfo() const { return m_stubInfo; }
93     
94 private:
95     CodeBlock* m_codeBlock;
96     StructureStubInfo* m_stubInfo;
97     std::unique_ptr<StructureStubClearingWatchpoint> m_head;
98 };
99
100 } // namespace JSC
101
102 #endif // ENABLE(JIT)
103
104 #endif // StructureStubClearingWatchpoint_h
105