summaryrefslogtreecommitdiff
path: root/Source/JavaScriptCore/bytecompiler/LabelScope.h
diff options
context:
space:
mode:
Diffstat (limited to 'Source/JavaScriptCore/bytecompiler/LabelScope.h')
-rw-r--r--Source/JavaScriptCore/bytecompiler/LabelScope.h26
1 files changed, 13 insertions, 13 deletions
diff --git a/Source/JavaScriptCore/bytecompiler/LabelScope.h b/Source/JavaScriptCore/bytecompiler/LabelScope.h
index 2df6f1b9b..4d76133f1 100644
--- a/Source/JavaScriptCore/bytecompiler/LabelScope.h
+++ b/Source/JavaScriptCore/bytecompiler/LabelScope.h
@@ -10,7 +10,7 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * 3. Neither the name of Apple Inc. ("Apple") nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
@@ -26,10 +26,8 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef LabelScope_h
-#define LabelScope_h
+#pragma once
-#include <wtf/PassRefPtr.h>
#include "Label.h"
namespace JSC {
@@ -40,18 +38,18 @@ namespace JSC {
public:
enum Type { Loop, Switch, NamedLabel };
- LabelScope(Type type, const Identifier* name, int scopeDepth, PassRefPtr<Label> breakTarget, PassRefPtr<Label> continueTarget)
+ LabelScope(Type type, const Identifier* name, int scopeDepth, Ref<Label>&& breakTarget, RefPtr<Label>&& continueTarget)
: m_refCount(0)
, m_type(type)
, m_name(name)
, m_scopeDepth(scopeDepth)
- , m_breakTarget(breakTarget)
- , m_continueTarget(continueTarget)
+ , m_breakTarget(WTFMove(breakTarget))
+ , m_continueTarget(WTFMove(continueTarget))
{
}
int refCount() const { return m_refCount; }
- Label* breakTarget() const { return m_breakTarget.get(); }
+ Label& breakTarget() const { return m_breakTarget.get(); }
Label* continueTarget() const { return m_continueTarget.get(); }
Type type() const { return m_type; }
@@ -72,7 +70,7 @@ namespace JSC {
Type m_type;
const Identifier* m_name;
int m_scopeDepth;
- RefPtr<Label> m_breakTarget;
+ Ref<Label> m_breakTarget;
RefPtr<Label> m_continueTarget;
};
@@ -85,8 +83,8 @@ namespace JSC {
, m_index(0)
{
}
- LabelScopePtr(LabelScopeStore* owner, size_t index)
- : m_owner(owner)
+ LabelScopePtr(LabelScopeStore& owner, size_t index)
+ : m_owner(&owner)
, m_index(index)
{
m_owner->at(index).ref();
@@ -117,16 +115,18 @@ namespace JSC {
m_owner->at(m_index).deref();
}
+ bool operator!() const { return !m_owner; }
+
LabelScope& operator*() { ASSERT(m_owner); return m_owner->at(m_index); }
LabelScope* operator->() { ASSERT(m_owner); return &m_owner->at(m_index); }
const LabelScope& operator*() const { ASSERT(m_owner); return m_owner->at(m_index); }
const LabelScope* operator->() const { ASSERT(m_owner); return &m_owner->at(m_index); }
+ static LabelScopePtr null() { return LabelScopePtr(); }
+
private:
LabelScopeStore* m_owner;
size_t m_index;
};
} // namespace JSC
-
-#endif // LabelScope_h