Changeset 181650 in webkit
- Timestamp:
- Mar 17, 2015, 8:50:44 AM (11 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 22 edited
-
ChangeLog (modified) (1 diff)
-
dfg/DFGAbstractInterpreterInlines.h (modified) (1 diff)
-
dfg/DFGClobberize.h (modified) (1 diff)
-
dfg/DFGDoesGC.cpp (modified) (1 diff)
-
dfg/DFGFixupPhase.cpp (modified) (1 diff)
-
dfg/DFGGraph.cpp (modified) (2 diffs)
-
dfg/DFGMayExit.cpp (modified) (1 diff)
-
dfg/DFGNode.cpp (modified) (2 diffs)
-
dfg/DFGNode.h (modified) (4 diffs)
-
dfg/DFGNodeType.h (modified) (1 diff)
-
dfg/DFGOSRAvailabilityAnalysisPhase.cpp (modified) (1 diff)
-
dfg/DFGObjectAllocationSinkingPhase.cpp (modified) (5 diffs)
-
dfg/DFGPredictionPropagationPhase.cpp (modified) (1 diff)
-
dfg/DFGPromoteHeapAccess.h (modified) (3 diffs)
-
dfg/DFGPromotedHeapLocation.cpp (modified) (1 diff)
-
dfg/DFGPromotedHeapLocation.h (modified) (1 diff)
-
dfg/DFGSafeToExecute.h (modified) (1 diff)
-
dfg/DFGSpeculativeJIT32_64.cpp (modified) (1 diff)
-
dfg/DFGSpeculativeJIT64.cpp (modified) (1 diff)
-
dfg/DFGValidate.cpp (modified) (1 diff)
-
ftl/FTLCapabilities.cpp (modified) (1 diff)
-
ftl/FTLLowerDFGToLLVM.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r181628 r181650 1 2015-03-16 Filip Pizlo <fpizlo@apple.com> 2 3 DFG IR shouldn't have a separate node for every kind of put hint that could be described using PromotedLocationDescriptor 4 https://bugs.webkit.org/show_bug.cgi?id=142769 5 6 Reviewed by Michael Saboff. 7 8 When we sink an object allocation, we need to have some way of tracking what stores would 9 have happened had the allocation not been sunk, so that we know how to rematerialize the 10 object on OSR exit. Prior to this change, trunk had two ways of describing such a "put 11 hint": 12 13 - The PutStrutureHint and PutByOffsetHint node types. 14 - The PromotedLocationDescriptor class, which has an enum with cases StructurePLoc and 15 NamedPropertyPLoc. 16 17 We also had ways of converting from a Node with those two node types to a 18 PromotedLocationDescriptor, and we had a way of converting a PromotedLocationDescriptor to 19 a Node. 20 21 This change removes the redundancy. We now have just one node type that corresponds to a 22 put hint, and it's called PutHint. It has a PromotedLocationDescriptor as metadata. 23 Converting between a PutHint node and a PromotedLocationDescriptor and vice-versa is now 24 trivial. 25 26 This means that if we add new kinds of sunken objects, we'll have less pro-forma to write 27 for the put hints to those objects. This is mainly to simplify the implementation of 28 arguments elimination in bug 141174. 29 30 * dfg/DFGAbstractInterpreterInlines.h: 31 (JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects): 32 * dfg/DFGClobberize.h: 33 (JSC::DFG::clobberize): 34 * dfg/DFGDoesGC.cpp: 35 (JSC::DFG::doesGC): 36 * dfg/DFGFixupPhase.cpp: 37 (JSC::DFG::FixupPhase::fixupNode): 38 * dfg/DFGGraph.cpp: 39 (JSC::DFG::Graph::dump): 40 (JSC::DFG::Graph::mergeRelevantToOSR): 41 * dfg/DFGMayExit.cpp: 42 (JSC::DFG::mayExit): 43 * dfg/DFGNode.cpp: 44 (JSC::DFG::Node::convertToPutHint): 45 (JSC::DFG::Node::convertToPutStructureHint): 46 (JSC::DFG::Node::convertToPutByOffsetHint): 47 (JSC::DFG::Node::promotedLocationDescriptor): 48 * dfg/DFGNode.h: 49 (JSC::DFG::Node::hasIdentifier): 50 (JSC::DFG::Node::hasPromotedLocationDescriptor): 51 (JSC::DFG::Node::convertToPutByOffsetHint): Deleted. 52 (JSC::DFG::Node::convertToPutStructureHint): Deleted. 53 * dfg/DFGNodeType.h: 54 * dfg/DFGOSRAvailabilityAnalysisPhase.cpp: 55 (JSC::DFG::LocalOSRAvailabilityCalculator::executeNode): 56 * dfg/DFGObjectAllocationSinkingPhase.cpp: 57 (JSC::DFG::ObjectAllocationSinkingPhase::run): 58 (JSC::DFG::ObjectAllocationSinkingPhase::lowerNonReadingOperationsOnPhantomAllocations): 59 (JSC::DFG::ObjectAllocationSinkingPhase::handleNode): 60 * dfg/DFGPredictionPropagationPhase.cpp: 61 (JSC::DFG::PredictionPropagationPhase::propagate): 62 * dfg/DFGPromoteHeapAccess.h: 63 (JSC::DFG::promoteHeapAccess): 64 * dfg/DFGPromotedHeapLocation.cpp: 65 (JSC::DFG::PromotedHeapLocation::createHint): 66 * dfg/DFGPromotedHeapLocation.h: 67 (JSC::DFG::PromotedLocationDescriptor::imm1): 68 (JSC::DFG::PromotedLocationDescriptor::imm2): 69 * dfg/DFGSafeToExecute.h: 70 (JSC::DFG::safeToExecute): 71 * dfg/DFGSpeculativeJIT32_64.cpp: 72 (JSC::DFG::SpeculativeJIT::compile): 73 * dfg/DFGSpeculativeJIT64.cpp: 74 (JSC::DFG::SpeculativeJIT::compile): 75 * dfg/DFGValidate.cpp: 76 (JSC::DFG::Validate::validateCPS): 77 * ftl/FTLCapabilities.cpp: 78 (JSC::FTL::canCompile): 79 * ftl/FTLLowerDFGToLLVM.cpp: 80 (JSC::FTL::LowerDFGToLLVM::compileNode): 81 1 82 2015-03-17 Michael Saboff <msaboff@apple.com> 2 83 -
trunk/Source/JavaScriptCore/dfg/DFGAbstractInterpreterInlines.h
r181466 r181650 1309 1309 break; 1310 1310 1311 case PutByOffsetHint: 1312 case PutStructureHint: 1311 case PutHint: 1313 1312 break; 1314 1313 -
trunk/Source/JavaScriptCore/dfg/DFGClobberize.h
r181466 r181650 291 291 case StoreBarrier: 292 292 case StoreBarrierWithNullCheck: 293 case PutByOffsetHint: 294 case PutStructureHint: 293 case PutHint: 295 294 write(SideState); 296 295 return; -
trunk/Source/JavaScriptCore/dfg/DFGDoesGC.cpp
r181466 r181650 205 205 case BottomValue: 206 206 case PhantomNewObject: 207 case Put ByOffsetHint:207 case PutHint: 208 208 case CheckStructureImmediate: 209 case PutStructureHint:210 209 case PutStack: 211 210 case KillStack: -
trunk/Source/JavaScriptCore/dfg/DFGFixupPhase.cpp
r181570 r181650 1069 1069 case BooleanToNumber: 1070 1070 case PhantomNewObject: 1071 case Put ByOffsetHint:1071 case PutHint: 1072 1072 case CheckStructureImmediate: 1073 case PutStructureHint:1074 1073 case MaterializeNewObject: 1075 1074 case PutStack: -
trunk/Source/JavaScriptCore/dfg/DFGGraph.cpp
r180993 r181650 223 223 if (node->hasIdentifier()) 224 224 out.print(comma, "id", node->identifierNumber(), "{", identifiers()[node->identifierNumber()], "}"); 225 if (node->hasPromotedLocationDescriptor()) 226 out.print(comma, node->promotedLocationDescriptor()); 225 227 if (node->hasStructureSet()) 226 228 out.print(comma, inContext(node->structureSet(), context)); … … 586 588 break; 587 589 588 case PutStructureHint: 589 case PutByOffsetHint: 590 case PutHint: 590 591 node->child2()->mergeFlags(NodeRelevantToOSR); 591 592 break; -
trunk/Source/JavaScriptCore/dfg/DFGMayExit.cpp
r180691 r181650 77 77 case ZombieHint: 78 78 case BottomValue: 79 case PutStructureHint: 80 case PutByOffsetHint: 79 case PutHint: 81 80 case PhantomNewObject: 82 81 case PutStack: -
trunk/Source/JavaScriptCore/dfg/DFGNode.cpp
r180691 r181650 31 31 #include "DFGGraph.h" 32 32 #include "DFGNodeAllocator.h" 33 #include "DFGPromotedHeapLocation.h" 33 34 #include "JSCInlines.h" 34 35 … … 94 95 } 95 96 97 void Node::convertToPutHint(const PromotedLocationDescriptor& descriptor, Node* base, Node* value) 98 { 99 m_op = PutHint; 100 m_opInfo = descriptor.imm1().m_value; 101 m_opInfo2 = descriptor.imm2().m_value; 102 child1() = base->defaultEdge(); 103 child2() = value->defaultEdge(); 104 child3() = Edge(); 105 } 106 107 void Node::convertToPutStructureHint(Node* structure) 108 { 109 ASSERT(m_op == PutStructure); 110 ASSERT(structure->castConstant<Structure*>() == transition()->next); 111 convertToPutHint(StructurePLoc, child1().node(), structure); 112 } 113 114 void Node::convertToPutByOffsetHint() 115 { 116 ASSERT(m_op == PutByOffset); 117 convertToPutHint( 118 PromotedLocationDescriptor(NamedPropertyPLoc, storageAccessData().identifierNumber), 119 child2().node(), child3().node()); 120 } 121 122 PromotedLocationDescriptor Node::promotedLocationDescriptor() 123 { 124 return PromotedLocationDescriptor(static_cast<PromotedLocationKind>(m_opInfo), m_opInfo2); 125 } 126 96 127 } } // namespace JSC::DFG 97 128 -
trunk/Source/JavaScriptCore/dfg/DFGNode.h
r180993 r181650 57 57 58 58 class Graph; 59 class PromotedLocationDescriptor; 59 60 struct BasicBlock; 60 61 … … 558 559 } 559 560 560 void convertToPutByOffsetHint() 561 { 562 ASSERT(m_op == PutByOffset); 563 m_opInfo = storageAccessData().identifierNumber; 564 m_op = PutByOffsetHint; 565 child1() = child2(); 566 child2() = child3(); 567 child3() = Edge(); 568 } 569 570 void convertToPutStructureHint(Node* structure) 571 { 572 ASSERT(m_op == PutStructure); 573 ASSERT(structure->castConstant<Structure*>() == transition()->next); 574 m_op = PutStructureHint; 575 m_opInfo = 0; 576 child2() = Edge(structure, KnownCellUse); 577 } 561 void convertToPutHint(const PromotedLocationDescriptor&, Node* base, Node* value); 562 563 void convertToPutByOffsetHint(); 564 void convertToPutStructureHint(Node* structure); 578 565 579 566 void convertToPhantomNewObject() … … 831 818 case PutByIdFlush: 832 819 case PutByIdDirect: 833 case PutByOffsetHint:834 820 return true; 835 821 default: … … 843 829 return m_opInfo; 844 830 } 831 832 bool hasPromotedLocationDescriptor() 833 { 834 return op() == PutHint; 835 } 836 837 PromotedLocationDescriptor promotedLocationDescriptor(); 845 838 846 839 // This corrects the arithmetic node flags, so that irrelevant bits are -
trunk/Source/JavaScriptCore/dfg/DFGNodeType.h
r181466 r181650 238 238 /* Support for allocation sinking. */\ 239 239 macro(PhantomNewObject, NodeResultJS) \ 240 macro(Put ByOffsetHint, NodeMustGenerate) \240 macro(PutHint, NodeMustGenerate) \ 241 241 macro(CheckStructureImmediate, NodeMustGenerate) \ 242 macro(PutStructureHint, NodeMustGenerate) \243 242 macro(MaterializeNewObject, NodeResultJS | NodeHasVarArgs) \ 244 243 \ -
trunk/Source/JavaScriptCore/dfg/DFGOSRAvailabilityAnalysisPhase.cpp
r180691 r181650 167 167 } 168 168 169 case PutHint: { 170 m_availability.m_heap.set( 171 PromotedHeapLocation(node->child1().node(), node->promotedLocationDescriptor()), 172 Availability(node->child2().node())); 173 break; 174 } 175 169 176 default: 170 177 break; 171 178 } 172 173 promoteHeapAccess(174 node,175 [&] (PromotedHeapLocation location, Edge value) {176 m_availability.m_heap.set(location, Availability(value.node()));177 },178 [&] (PromotedHeapLocation) { });179 179 } 180 180 -
trunk/Source/JavaScriptCore/dfg/DFGObjectAllocationSinkingPhase.cpp
r181495 r181650 1 1 /* 2 * Copyright (C) 2014 Apple Inc. All rights reserved.2 * Copyright (C) 2014, 2015 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 73 73 // insert additional MaterializeNewObject nodes on Upsilons that feed into Phis that mix 74 74 // materializations and the original PhantomNewObject. We then turn each PutByOffset over a 75 // PhantomNewObject into a Put ByOffsetHint.75 // PhantomNewObject into a PutHint. 76 76 // 77 77 // - We perform the same optimization for MaterializeNewObject. This allows us to cover 78 // cases where we had MaterializeNewObject flowing into a Put ByOffsetHint.78 // cases where we had MaterializeNewObject flowing into a PutHint. 79 79 // 80 80 // We could also add this rule: … … 528 528 Node* structure = m_insertionSet.insertConstant( 529 529 nodeIndex + 1, node->origin, JSValue(node->structure())); 530 m_insertionSet.insertNode( 531 nodeIndex + 1, SpecNone, PutStructureHint, node->origin, 532 Edge(node, KnownCellUse), Edge(structure, KnownCellUse)); 530 m_insertionSet.insert( 531 nodeIndex + 1, 532 PromotedHeapLocation(StructurePLoc, node).createHint( 533 m_graph, node->origin, structure)); 533 534 node->convertToPhantomNewObject(); 534 535 } … … 538 539 case MaterializeNewObject: { 539 540 if (m_sinkCandidates.contains(node)) { 540 m_insertionSet.insertNode( 541 nodeIndex + 1, SpecNone, PutStructureHint, node->origin, 542 Edge(node, KnownCellUse), m_graph.varArgChild(node, 0)); 541 m_insertionSet.insert( 542 nodeIndex + 1, 543 PromotedHeapLocation(StructurePLoc, node).createHint( 544 m_graph, node->origin, m_graph.varArgChild(node, 0).node())); 543 545 for (unsigned i = 0; i < node->objectMaterializationData().m_properties.size(); ++i) { 544 m_insertionSet.insertNode( 545 nodeIndex + 1, SpecNone, PutByOffsetHint, node->origin, 546 Edge(node, KnownCellUse), m_graph.varArgChild(node, i + 1)); 546 unsigned identifierNumber = 547 node->objectMaterializationData().m_properties[i].m_identifierNumber; 548 m_insertionSet.insert( 549 nodeIndex + 1, 550 PromotedHeapLocation( 551 NamedPropertyPLoc, node, identifierNumber).createHint( 552 m_graph, node->origin, 553 m_graph.varArgChild(node, i + 1).node())); 547 554 } 548 555 node->convertToPhantomNewObject(); … … 763 770 case StoreBarrier: 764 771 case StoreBarrierWithNullCheck: 765 case Put ByOffsetHint:772 case PutHint: 766 773 break; 767 774 -
trunk/Source/JavaScriptCore/dfg/DFGPredictionPropagationPhase.cpp
r181466 r181650 543 543 case BooleanToNumber: 544 544 case PhantomNewObject: 545 case Put ByOffsetHint:545 case PutHint: 546 546 case CheckStructureImmediate: 547 case PutStructureHint:548 547 case MaterializeNewObject: 549 548 case PutStack: -
trunk/Source/JavaScriptCore/dfg/DFGPromoteHeapAccess.h
r173993 r181650 1 1 /* 2 * Copyright (C) 2014 Apple Inc. All rights reserved.2 * Copyright (C) 2014, 2015 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 34 34 namespace JSC { namespace DFG { 35 35 36 // Note that the write functor is really the useful thing here. The read functor is only useful37 // for the object allocation sinking phase.38 36 template<typename WriteFunctor, typename ReadFunctor> 39 37 void promoteHeapAccess(Node* node, const WriteFunctor& write, const ReadFunctor& read) … … 62 60 break; 63 61 } 64 65 case Put StructureHint: {62 63 case PutHint: { 66 64 ASSERT(node->child1()->isPhantomObjectAllocation()); 67 write(PromotedHeapLocation(StructurePLoc, node->child1()), node->child2());68 break;69 }70 71 case PutByOffsetHint: {72 ASSERT(node->child1()->isPhantomObjectAllocation());73 unsigned identifierNumber = node->identifierNumber();74 65 write( 75 PromotedHeapLocation( NamedPropertyPLoc, node->child1(), identifierNumber),66 PromotedHeapLocation(node->child1().node(), node->promotedLocationDescriptor()), 76 67 node->child2()); 77 68 break; -
trunk/Source/JavaScriptCore/dfg/DFGPromotedHeapLocation.cpp
r173993 r181650 41 41 Node* PromotedHeapLocation::createHint(Graph& graph, NodeOrigin origin, Node* value) 42 42 { 43 switch (kind()) { 44 case StructurePLoc: 45 return graph.addNode( 46 SpecNone, PutStructureHint, origin, 47 Edge(base(), KnownCellUse), Edge(value, KnownCellUse)); 48 49 case NamedPropertyPLoc: 50 return graph.addNode( 51 SpecNone, PutByOffsetHint, origin, 52 OpInfo(info()), Edge(base(), KnownCellUse), Edge(value, UntypedUse)); 53 54 case InvalidPromotedLocationKind: 55 return nullptr; 56 } 57 58 RELEASE_ASSERT_NOT_REACHED(); 59 return nullptr; 43 return graph.addNode( 44 SpecNone, PutHint, origin, OpInfo(descriptor().imm1()), OpInfo(descriptor().imm2()), 45 base()->defaultEdge(), value->defaultEdge()); 60 46 } 61 47 -
trunk/Source/JavaScriptCore/dfg/DFGPromotedHeapLocation.h
r173993 r181650 54 54 PromotedLocationKind kind() const { return m_kind; } 55 55 unsigned info() const { return m_info; } 56 57 OpInfo imm1() const { return OpInfo(static_cast<uint32_t>(m_kind)); } 58 OpInfo imm2() const { return OpInfo(static_cast<uint32_t>(m_info)); } 56 59 57 60 unsigned hash() const -
trunk/Source/JavaScriptCore/dfg/DFGSafeToExecute.h
r181466 r181650 278 278 case ToIndexString: 279 279 case PhantomNewObject: 280 case Put ByOffsetHint:280 case PutHint: 281 281 case CheckStructureImmediate: 282 case PutStructureHint:283 282 case MaterializeNewObject: 284 283 return true; -
trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT32_64.cpp
r181466 r181650 5093 5093 case BottomValue: 5094 5094 case PhantomNewObject: 5095 case Put ByOffsetHint:5095 case PutHint: 5096 5096 case CheckStructureImmediate: 5097 case PutStructureHint:5098 5097 case MaterializeNewObject: 5099 5098 case PutStack: -
trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp
r181466 r181650 5164 5164 case BottomValue: 5165 5165 case PhantomNewObject: 5166 case Put ByOffsetHint:5166 case PutHint: 5167 5167 case CheckStructureImmediate: 5168 case PutStructureHint:5169 5168 case MaterializeNewObject: 5170 5169 case PutStack: -
trunk/Source/JavaScriptCore/dfg/DFGValidate.cpp
r180813 r181650 439 439 case CheckInBounds: 440 440 case PhantomNewObject: 441 case Put ByOffsetHint:441 case PutHint: 442 442 case CheckStructureImmediate: 443 case PutStructureHint:444 443 case MaterializeNewObject: 445 444 case PutStack: -
trunk/Source/JavaScriptCore/ftl/FTLCapabilities.cpp
r181466 r181650 178 178 case BottomValue: 179 179 case PhantomNewObject: 180 case Put ByOffsetHint:180 case PutHint: 181 181 case CheckStructureImmediate: 182 case PutStructureHint:183 182 case MaterializeNewObject: 184 183 // These are OK. -
trunk/Source/JavaScriptCore/ftl/FTLLowerDFGToLLVM.cpp
r181466 r181650 830 830 case ZombieHint: 831 831 case PhantomNewObject: 832 case PutByOffsetHint: 833 case PutStructureHint: 832 case PutHint: 834 833 case BottomValue: 835 834 case KillStack:
Note:
See TracChangeset
for help on using the changeset viewer.