WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
the wrong way
blah.patch (text/plain), 7.81 KB, created by
Filip Pizlo
on 2014-05-22 14:41:26 PDT
(
hide
)
Description:
the wrong way
Filename:
MIME Type:
Creator:
Filip Pizlo
Created:
2014-05-22 14:41:26 PDT
Size:
7.81 KB
patch
obsolete
>Index: Source/JavaScriptCore/bytecode/StructureSet.cpp >=================================================================== >--- Source/JavaScriptCore/bytecode/StructureSet.cpp (revision 169200) >+++ Source/JavaScriptCore/bytecode/StructureSet.cpp (working copy) >@@ -47,7 +47,7 @@ StructureSet& StructureSet::operator=(co > void StructureSet::clear() > { > deleteStructureListIfNecessary(); >- set(0, true); >+ setEmpty(); > } > > bool StructureSet::add(Structure* structure) >@@ -75,7 +75,7 @@ bool StructureSet::remove(Structure* str > { > if (isThin()) { > if (singleStructure() == structure) { >- set(0, true); >+ setEmpty(); > return true; > } > return false; >@@ -88,7 +88,7 @@ bool StructureSet::remove(Structure* str > list->list()[i] = list->list()[--list->m_length]; > if (!list->m_length) { > OutOfLineList::destroy(list); >- set(0, true); >+ setEmpty(); > } > return true; > } >Index: Source/JavaScriptCore/bytecode/StructureSet.h >=================================================================== >--- Source/JavaScriptCore/bytecode/StructureSet.h (revision 169200) >+++ Source/JavaScriptCore/bytecode/StructureSet.h (working copy) >@@ -33,11 +33,15 @@ > > namespace JSC { > >+namespace DFG { >+class StructureAbstractValue; >+} >+ > class StructureSet { > public: > StructureSet() > { >- set(0, true); >+ setEmpty(); > } > > StructureSet(Structure* structure) >@@ -124,6 +128,8 @@ public: > void dump(PrintStream&) const; > > private: >+ friend class DFG::StructureAbstractValue; >+ > static const uintptr_t thinFlag = 1; > static const uintptr_t reservedFlag = 2; > static const uintptr_t flags = 3; >@@ -154,7 +160,7 @@ private: > > void deleteStructureListIfNecessary() > { >- if (!isThin()) >+ if (!isThin() && m_pointer != reservedValue) > OutOfLineList::destroy(structureList()); > } > >@@ -185,6 +191,10 @@ private: > { > set(bitwise_cast<uintptr_t>(structures), false); > } >+ void setEmpty() >+ { >+ set(0, true); >+ } > void set(uintptr_t pointer, bool singleStructure) > { > m_pointer = pointer | (singleStructure ? thinFlag : 0) | (m_pointer & reservedFlag); >Index: Source/JavaScriptCore/dfg/DFGStructureAbstractValue.h >=================================================================== >--- Source/JavaScriptCore/dfg/DFGStructureAbstractValue.h (revision 169200) >+++ Source/JavaScriptCore/dfg/DFGStructureAbstractValue.h (working copy) >@@ -37,6 +37,229 @@ namespace JSC { namespace DFG { > > class StructureAbstractValue { > public: >+ StructureAbstractValue() { } >+ StructureAbstractValue(Structure* structure) >+ : m_set(structure) >+ { >+ } >+ StructureAbstractValue(const StructureSet& other) >+ : m_set(other) >+ { >+ } >+ >+ void clear() >+ { >+ m_set.deleteStructureListIfNecessary(); >+ m_set.setEmpty(); >+ setClobbered(false); >+ } >+ >+ void makeTop() >+ { >+ m_set.deleteStructureListIfNecessary(); >+ m_set.m_pointer = topValue; >+ } >+ >+ void clobber() >+ { >+ setClobbered(true); >+ } >+ >+ static StructureAbstractValue top() >+ { >+ StructureAbstractValue result; >+ result.makeTop(); >+ return result; >+ } >+ >+ bool isClear() const { return m_set.isEmpty(); } >+ bool isTop() const { return m_set.m_pointer == topValue; } >+ bool isClobbered() const { return m_set.m_pointer & clobberedFlag; } >+ >+ // The rough level in the abstract value lattice. >+ enum LatticeLevel { >+ Bottom, >+ Active, >+ Clobbered, >+ Top >+ }; >+ LatticeLevel latticeLevel() const >+ { >+ if (isClear()) >+ return Bottom; >+ if (isTop()) >+ return Top; >+ if (isClobbered()) >+ return Clobbered; >+ return Active; >+ } >+ >+ bool add(Structure* structure) >+ { >+ if (isTop()) >+ return false; >+ >+ if (!m_set.add(structure)) >+ return false; >+ >+ if (m_set.size() > polymorphismLimit) >+ makeTop(); >+ >+ return true; >+ } >+ >+ bool merge(const StructureSet& other) >+ { >+ if (isTop()) >+ return false; >+ >+ if (!m_set.merge(other)) >+ return false; >+ >+ if (m_set.size() > polymorphismLimit) >+ makeTop(); >+ >+ return true; >+ } >+ >+ bool merge(const StructureAbstractValue& other) >+ { >+ if (isTop()) >+ return false; >+ >+ if (other.isTop()) { >+ makeTop(); >+ return true; >+ } >+ >+ bool changed = false; >+ changed |= m_set.merge(other.m_set); >+ changed |= mergeClobbered(other.isClobbered()); >+ if (!changed) >+ return false; >+ >+ if (m_set.size() > polymorphismLimit) >+ makeTop(); >+ >+ return true; >+ } >+ >+ void filter(const StructureSet& other) >+ { >+ if (isTop() || isClobbered()) >+ m_set = other; >+ else >+ m_set.filter(other); >+ } >+ >+ void filter(const StructureAbstractValue& other) >+ { >+ if (latticeLevel() != other.latticeLevel()) { >+ if (latticeLevel() > other.latticeLevel()) >+ *this = other; >+ return; >+ } >+ >+ if (isTop()) >+ return; >+ >+ m_set.filter(other.m_set); >+ } >+ >+ bool contains(Structure* structure) const >+ { >+ if (isTop() || isClobbered()) >+ return true; >+ >+ return m_set.contains(structure); >+ } >+ >+ bool isSubsetOf(const StructureSet& other) const >+ { >+ if (isTop() || isClobbered()) >+ return false; >+ >+ return m_set.isSubsetOf(other); >+ } >+ >+ bool isSubsetOf(const StructureAbstractValue& other) const >+ { >+ if (other.isTop() || other.isClobbered()) >+ return true; >+ >+ if (isTop() || isClobbered()) >+ return false; >+ >+ return m_set.isSubsetOf(other.m_set); >+ } >+ >+ bool isSupersetOf(const StructureAbstractValue& other) const >+ { >+ return other.isSubsetOf(*this); >+ } >+ >+ bool overlaps(const StructureSet& other) const >+ { >+ if (isTop() || isClobbered() || other.isTop() || other.isClobbered()) >+ return true; >+ >+ return m_set.overlaps(other.m_set); >+ } >+ >+ bool operator==(const StructureAbstractValue& other) const >+ { >+ if (m_set.m_pointer == other.m_set.m_pointer) >+ return true; >+ >+ if (isTop() || other.isTop()) >+ return false; >+ >+ if (isClobbered() != other.isClobbered()) >+ return false; >+ >+ return m_set == other.m_set; >+ } >+ >+ size_t size() const >+ { >+ ASSERT(!isTop()); >+ return m_set.size(); >+ } >+ >+ Structure* at(size_t i) const >+ { >+ ASSERT(!isTop()); >+ return m_set.at(i); >+ } >+ >+private: >+ static uintptr_t clobberedFlag = StructureSet::reservedFlag; >+ static uintptr_t topValue = StructureSet::reservedValue; >+ static unsigned polymorphismLimit = 10; >+ >+ void setClobbered(bool isClobbered) >+ { >+ if (isClobbered) >+ m_set.m_pointer |= clobberedFlag; >+ else >+ m_set.m_pointer &= ~clobberedFlag; >+ } >+ >+ bool mergeClobbered(bool isClobbered) >+ { >+ if (!isClobbered) >+ return false; >+ if (isClobbered()) >+ return false; >+ setClobbered(true); >+ return true; >+ } >+ >+ StructureSet m_set; >+}; >+ >+class StructureAbstractValue { >+public: > StructureAbstractValue() > : m_structure(0) > {
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 128073
:
231915
|
231935
|
231983
|
232228
|
232232
|
232264
|
232270
|
232281
|
232304
|
232349
|
232350
|
232413
|
232437
|
232449
|
232460