Changeset 204130 in webkit for trunk/Source/JavaScriptCore/dfg/DFGInPlaceAbstractState.cpp
- Timestamp:
- Aug 4, 2016, 12:33:21 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/dfg/DFGInPlaceAbstractState.cpp
r204112 r204130 1 1 /* 2 * Copyright (C) 2013-201 5Apple Inc. All rights reserved.2 * Copyright (C) 2013-2016 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 81 81 } 82 82 83 static void setLiveValues(HashMap<Node*, AbstractValue>& values, const Vector<Node*>& liveNodes)84 {85 values.clear();86 for (Node* node : liveNodes)87 values.add(node, AbstractValue());88 }89 90 83 static void setLiveValues(Vector<BasicBlock::SSAData::NodeAbstractValuePair>& values, const Vector<Node*>& live) 91 84 { … … 186 179 return false; 187 180 } 188 189 b ool changed = checkAndSet(block->cfaStructureClobberStateAtTail, m_structureClobberState);190 181 182 block->cfaStructureClobberStateAtTail = m_structureClobberState; 183 191 184 switch (m_graph.m_form) { 192 185 case ThreadedCPS: { 193 186 for (size_t argument = 0; argument < block->variablesAtTail.numberOfArguments(); ++argument) { 194 187 AbstractValue& destination = block->valuesAtTail.argument(argument); 195 changed |=mergeStateAtTail(destination, m_variables.argument(argument), block->variablesAtTail.argument(argument));188 mergeStateAtTail(destination, m_variables.argument(argument), block->variablesAtTail.argument(argument)); 196 189 } 197 190 198 191 for (size_t local = 0; local < block->variablesAtTail.numberOfLocals(); ++local) { 199 192 AbstractValue& destination = block->valuesAtTail.local(local); 200 changed |=mergeStateAtTail(destination, m_variables.local(local), block->variablesAtTail.local(local));193 mergeStateAtTail(destination, m_variables.local(local), block->variablesAtTail.local(local)); 201 194 } 202 195 break; … … 205 198 case SSA: { 206 199 for (size_t i = 0; i < block->valuesAtTail.size(); ++i) 207 changed |= block->valuesAtTail[i].merge(m_variables[i]); 208 209 for (Node* node : block->ssa->liveAtTail) { 210 changed |= block->ssa->valuesAtTail.find(node)->value.merge(forNode(node)); 200 block->valuesAtTail[i].merge(m_variables[i]); 201 202 for (auto& valueAtTail : block->ssa->valuesAtTail) { 203 AbstractValue& valueAtNode = forNode(valueAtTail.node); 204 valueAtTail.value.merge(valueAtNode); 205 valueAtNode = valueAtTail.value; 211 206 } 212 207 break; … … 230 225 } 231 226 232 boolInPlaceAbstractState::mergeStateAtTail(AbstractValue& destination, AbstractValue& inVariable, Node* node)227 void InPlaceAbstractState::mergeStateAtTail(AbstractValue& destination, AbstractValue& inVariable, Node* node) 233 228 { 234 229 if (!node) 235 return false;236 237 AbstractValue source;230 return; 231 232 const AbstractValue* source = nullptr; 238 233 239 234 switch (node->op()) { … … 243 238 case Flush: 244 239 // The block transfers the value from head to tail. 245 source = inVariable;240 source = &inVariable; 246 241 break; 247 242 248 243 case GetLocal: 249 244 // The block refines the value with additional speculations. 250 source = forNode(node);245 source = &forNode(node); 251 246 break; 252 247 … … 254 249 // The block sets the variable, and potentially refines it, both 255 250 // before and after setting it. 256 source = forNode(node->child1());251 source = &forNode(node->child1()); 257 252 if (node->variableAccessData()->flushFormat() == FlushedDouble) 258 RELEASE_ASSERT(!(source .m_type & ~SpecFullDouble));253 RELEASE_ASSERT(!(source->m_type & ~SpecFullDouble)); 259 254 break; 260 255 … … 263 258 break; 264 259 } 265 266 if (destination == source) { 267 // Abstract execution did not change the output value of the variable, for this 268 // basic block, on this iteration. 269 return false; 270 } 271 272 // Abstract execution reached a new conclusion about the speculations reached about 273 // this variable after execution of this basic block. Update the state, and return 274 // true to indicate that the fixpoint must go on! 275 destination = source; 276 return true; 260 destination = *source; 277 261 } 278 262 … … 311 295 Node* node = entry.node; 312 296 if (verbose) 313 dataLog(" Merging for ", node, ": from ", from->ssa->valuesAtTail.find(node)->value, " to ", entry.value, "\n"); 314 changed |= entry.value.merge( 315 from->ssa->valuesAtTail.find(node)->value); 297 dataLog(" Merging for ", node, ": from ", forNode(node), " to ", entry.value, "\n"); 298 #ifndef NDEBUG 299 unsigned valueCountInFromBlock = 0; 300 for (auto& fromBlockValueAtTail : from->ssa->valuesAtTail) { 301 if (fromBlockValueAtTail.node == node) { 302 ASSERT(fromBlockValueAtTail.value == forNode(node)); 303 ++valueCountInFromBlock; 304 } 305 } 306 ASSERT(valueCountInFromBlock == 1); 307 #endif 308 309 changed |= entry.value.merge(forNode(node)); 316 310 317 311 if (verbose)
Note:
See TracChangeset
for help on using the changeset viewer.