Changeset 140904 in webkit for trunk/Source/JavaScriptCore/dfg/DFGValueSource.h
- Timestamp:
- Jan 25, 2013, 10:07:23 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/dfg/DFGValueSource.h
r140619 r140904 1 1 /* 2 * Copyright (C) 2011 Apple Inc. All rights reserved.2 * Copyright (C) 2011, 2013 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 32 32 33 33 #include "DFGCommon.h" 34 #include "DFGMinifiedID.h" 34 35 #include "DataFormat.h" 35 36 #include "SpeculatedType.h" … … 109 110 public: 110 111 ValueSource() 111 : m_ nodeIndex(nodeIndexFromKind(SourceNotSet))112 : m_value(idFromKind(SourceNotSet)) 112 113 { 113 114 } 114 115 115 116 explicit ValueSource(ValueSourceKind valueSourceKind) 116 : m_ nodeIndex(nodeIndexFromKind(valueSourceKind))117 : m_value(idFromKind(valueSourceKind)) 117 118 { 118 119 ASSERT(kind() != SourceNotSet); … … 120 121 } 121 122 122 explicit ValueSource( NodeIndex nodeIndex)123 : m_ nodeIndex(nodeIndex)124 { 125 RELEASE_ASSERT(nodeIndex != NoNode);123 explicit ValueSource(MinifiedID id) 124 : m_value(id.m_id) 125 { 126 ASSERT(!!id); 126 127 ASSERT(kind() == HaveNode); 127 128 } … … 145 146 bool isSet() const 146 147 { 147 return kindFrom NodeIndex(m_nodeIndex) != SourceNotSet;148 return kindFromID(m_value) != SourceNotSet; 148 149 } 149 150 150 151 ValueSourceKind kind() const 151 152 { 152 return kindFrom NodeIndex(m_nodeIndex);153 return kindFromID(m_value); 153 154 } 154 155 … … 192 193 } 193 194 194 NodeIndex nodeIndex() const195 MinifiedID id() const 195 196 { 196 197 ASSERT(kind() == HaveNode); 197 return m_ nodeIndex;198 } 199 200 void dump( FILE* out) const;198 return m_value; 199 } 200 201 void dump(PrintStream&) const; 201 202 202 203 private: 203 static NodeIndex nodeIndexFromKind(ValueSourceKind kind)204 static MinifiedID idFromKind(ValueSourceKind kind) 204 205 { 205 206 ASSERT(kind >= SourceNotSet && kind < HaveNode); 206 return NoNode - kind;207 } 208 209 static ValueSourceKind kindFrom NodeIndex(NodeIndex nodeIndex)210 { 211 u nsigned kind = static_cast<unsigned>(NoNode - nodeIndex);212 if (kind >= static_cast<u nsigned>(HaveNode))207 return MinifiedID::fromBits(MinifiedID::invalidID() - kind); 208 } 209 210 static ValueSourceKind kindFromID(MinifiedID id) 211 { 212 uintptr_t kind = static_cast<uintptr_t>(MinifiedID::invalidID() - id.m_id); 213 if (kind >= static_cast<uintptr_t>(HaveNode)) 213 214 return HaveNode; 214 215 return static_cast<ValueSourceKind>(kind); 215 216 } 216 217 217 NodeIndex m_nodeIndex;218 MinifiedID m_value; 218 219 }; 219 220
Note:
See TracChangeset
for help on using the changeset viewer.