Changeset 232000 in webkit for trunk/Source/JavaScriptCore/dfg/DFGLICMPhase.cpp
- Timestamp:
- May 19, 2018, 3:00:21 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/dfg/DFGLICMPhase.cpp
r231185 r232000 1 1 /* 2 * Copyright (C) 2013-201 6Apple Inc. All rights reserved.2 * Copyright (C) 2013-2018 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 265 265 266 266 m_state.initializeTo(data.preHeader); 267 if (!safeToExecute(m_state, m_graph, node)) { 268 if (verbose) { 269 dataLog( 270 " Not hoisting ", node, " because it isn't safe to execute.\n"); 271 } 272 return false; 273 } 274 267 275 268 NodeOrigin originalOrigin = node->origin; 269 bool canSpeculateBlindly = !m_graph.hasGlobalExitSite(originalOrigin.semantic, HoistingFailed); 276 270 277 271 // NOTE: We could just use BackwardsDominators here directly, since we already know that the … … 281 275 && !m_graph.m_controlEquivalenceAnalysis->dominatesEquivalently(data.preHeader, fromBlock); 282 276 283 if (addsBlindSpeculation 284 && m_graph.hasGlobalExitSite(originalOrigin.semantic, HoistingFailed)) { 277 if (addsBlindSpeculation && !canSpeculateBlindly) { 285 278 if (verbose) { 286 279 dataLog( … … 292 285 } 293 286 287 // For abstract interpretation, these are in the reverse order that they appear in this 288 // vector. 289 Vector<Node*, 2> hoistedNodesReverse; 290 hoistedNodesReverse.append(node); 291 292 NodeOrigin terminalOrigin = data.preHeader->terminal()->origin; 293 294 auto insertHoistedNode = [&] (Node* node) { 295 data.preHeader->insertBeforeTerminal(node); 296 node->owner = data.preHeader; 297 node->origin = terminalOrigin.withSemantic(node->origin.semantic); 298 node->origin.wasHoisted |= addsBlindSpeculation; 299 }; 300 301 if (!safeToExecute(m_state, m_graph, node)) { 302 // See if we can rescue the situation by inserting blind speculations. 303 bool ignoreEmptyChildren = true; 304 if (canSpeculateBlindly 305 && safeToExecute(m_state, m_graph, node, ignoreEmptyChildren)) { 306 if (verbose) { 307 dataLog( 308 " Rescuing hoisting by inserting empty checks.\n"); 309 } 310 m_graph.doToChildren( 311 node, 312 [&] (Edge& edge) { 313 if (!(m_state.forNode(edge).m_type & SpecEmpty)) 314 return; 315 316 Node* check = m_graph.addNode(CheckNotEmpty, originalOrigin, Edge(edge.node(), UntypedUse)); 317 insertHoistedNode(check); 318 hoistedNodesReverse.append(check); 319 }); 320 } else { 321 if (verbose) { 322 dataLog( 323 " Not hoisting ", node, " because it isn't safe to execute.\n"); 324 } 325 return false; 326 } 327 } 328 294 329 if (verbose) { 295 330 dataLog( … … 298 333 } 299 334 300 data.preHeader->insertBeforeTerminal(node); 301 node->owner = data.preHeader; 302 NodeOrigin terminalOrigin = data.preHeader->terminal()->origin; 303 node->origin = terminalOrigin.withSemantic(node->origin.semantic); 304 node->origin.wasHoisted |= addsBlindSpeculation; 335 insertHoistedNode(node); 305 336 306 337 // We can trust what AI proves about edge proof statuses when hoisting to the preheader. 307 338 m_state.trustEdgeProofs(); 308 339 m_state.initializeTo(data.preHeader); 309 m_interpreter.execute(node); 340 for (unsigned i = hoistedNodesReverse.size(); i--;) 341 m_interpreter.execute(hoistedNodesReverse[i]); 310 342 // However, when walking various inner loops below, the proof status of 311 343 // an edge may be trivially true, even if it's not true in the preheader … … 341 373 continue; 342 374 m_state.initializeTo(subPreHeader); 343 m_interpreter.execute(node); 375 for (unsigned i = hoistedNodesReverse.size(); i--;) 376 m_interpreter.execute(hoistedNodesReverse[i]); 344 377 } 345 378
Note:
See TracChangeset
for help on using the changeset viewer.