Changeset 244309 in webkit for trunk/Source/JavaScriptCore/b3/B3Value.cpp
- Timestamp:
- Apr 15, 2019, 4:53:23 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/b3/B3Value.cpp
r243851 r244309 48 48 #include <wtf/ListDump.h> 49 49 #include <wtf/StringPrintStream.h> 50 #include <wtf/Vector.h> 50 51 51 52 namespace JSC { namespace B3 { 52 53 53 54 const char* const Value::dumpPrefix = "@"; 55 void DeepValueDump::dump(PrintStream& out) const 56 { 57 if (m_value) 58 m_value->deepDump(m_proc, out); 59 else 60 out.print("<null>"); 61 } 54 62 55 63 Value::~Value() 56 64 { 65 if (m_numChildren == VarArgs) 66 bitwise_cast<Vector<Value*, 3> *>(childrenAlloc())->Vector<Value*, 3>::~Vector(); 57 67 } 58 68 … … 63 73 // previous value in place, and then we construct the Identity Value in place. 64 74 65 ASSERT(m_type == value->m_type);75 RELEASE_ASSERT(m_type == value->m_type); 66 76 ASSERT(value != this); 67 77 68 if (m_type == Void) {78 if (m_type == Void) 69 79 replaceWithNopIgnoringType(); 70 return; 71 } 72 73 unsigned index = m_index; 74 Type type = m_type; 75 Origin origin = m_origin; 76 BasicBlock* owner = this->owner; 77 78 RELEASE_ASSERT(type == value->type()); 79 80 this->~Value(); 81 82 new (this) Value(Identity, type, origin, value); 83 84 this->owner = owner; 85 this->m_index = index; 80 else 81 replaceWith(Identity, m_type, this->owner, value); 86 82 } 87 83 … … 99 95 void Value::replaceWithNopIgnoringType() 100 96 { 101 unsigned index = m_index; 102 Origin origin = m_origin; 103 BasicBlock* owner = this->owner; 104 105 this->~Value(); 106 107 new (this) Value(Nop, Void, origin); 108 109 this->owner = owner; 110 this->m_index = index; 97 replaceWith(Nop, Void, this->owner); 111 98 } 112 99 … … 117 104 return; 118 105 } 119 106 107 replaceWith(Phi, m_type, this->owner); 108 } 109 110 void Value::replaceWithJump(BasicBlock* owner, FrequentedBlock target) 111 { 112 RELEASE_ASSERT(owner->last() == this); 113 replaceWith(Jump, Void, this->owner); 114 owner->setSuccessors(target); 115 } 116 117 void Value::replaceWithOops(BasicBlock* owner) 118 { 119 RELEASE_ASSERT(owner->last() == this); 120 replaceWith(Oops, Void, this->owner); 121 owner->clearSuccessors(); 122 } 123 124 void Value::replaceWithJump(FrequentedBlock target) 125 { 126 replaceWithJump(owner, target); 127 } 128 129 void Value::replaceWithOops() 130 { 131 replaceWithOops(owner); 132 } 133 134 void Value::replaceWith(Kind kind, Type type, BasicBlock* owner) 135 { 120 136 unsigned index = m_index; 121 Origin origin = m_origin;122 BasicBlock* owner = this->owner;123 Type type = m_type;124 137 125 138 this->~Value(); 126 139 127 new (this) Value(Phi, type, origin); 128 140 new (this) Value(kind, type, m_origin); 141 142 this->m_index = index; 129 143 this->owner = owner; 144 } 145 146 void Value::replaceWith(Kind kind, Type type, BasicBlock* owner, Value* value) 147 { 148 unsigned index = m_index; 149 150 this->~Value(); 151 152 new (this) Value(kind, type, m_origin, value); 153 130 154 this->m_index = index; 131 }132 133 void Value::replaceWithJump(BasicBlock* owner, FrequentedBlock target)134 {135 RELEASE_ASSERT(owner->last() == this);136 137 unsigned index = m_index;138 Origin origin = m_origin;139 140 this->~Value();141 142 new (this) Value(Jump, Void, origin);143 144 155 this->owner = owner; 145 this->m_index = index;146 147 owner->setSuccessors(target);148 }149 150 void Value::replaceWithOops(BasicBlock* owner)151 {152 RELEASE_ASSERT(owner->last() == this);153 154 unsigned index = m_index;155 Origin origin = m_origin;156 157 this->~Value();158 159 new (this) Value(Oops, Void, origin);160 161 this->owner = owner;162 this->m_index = index;163 164 owner->clearSuccessors();165 }166 167 void Value::replaceWithJump(FrequentedBlock target)168 {169 replaceWithJump(owner, target);170 }171 172 void Value::replaceWithOops()173 {174 replaceWithOops(owner);175 156 } 176 157 … … 204 185 if (isConstant) 205 186 out.print(")"); 206 }207 208 Value* Value::cloneImpl() const209 {210 return new Value(*this);211 187 } 212 188 … … 459 435 Value* Value::invertedCompare(Procedure& proc) const 460 436 { 461 if ( !numChildren())437 if (numChildren() != 2) 462 438 return nullptr; 463 439 if (Optional<Opcode> invertedOpcode = B3::invertedCompare(opcode(), child(0)->type())) { 464 440 ASSERT(!kind().hasExtraBits()); 465 return proc.add<Value>(*invertedOpcode, type(), origin(), child ren());441 return proc.add<Value>(*invertedOpcode, type(), origin(), child(0), child(1)); 466 442 } 467 443 return nullptr; … … 497 473 if (type() != Int32) 498 474 return false; 475 499 476 switch (opcode()) { 500 477 case Const32:
Note:
See TracChangeset
for help on using the changeset viewer.