Changeset 230488 in webkit
- Timestamp:
- Apr 10, 2018 12:45:54 PM (6 years ago)
- Location:
- trunk
- Files:
-
- 7 added
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JSTests/ChangeLog
r230457 r230488 1 2018-04-10 Filip Pizlo <fpizlo@apple.com> 2 3 DFG AI and clobberize should agree with each other 4 https://bugs.webkit.org/show_bug.cgi?id=184440 5 6 Reviewed by Saam Barati. 7 8 Add tests for all of the bugs I fixed. 9 10 * stress/direct-arguments-out-of-bounds-change-structure.js: Added. 11 (foo): 12 * stress/new-typed-array-cse-effects.js: Added. 13 (foo): 14 * stress/scoped-arguments-out-of-bounds-change-structure.js: Added. 15 (foo.theO): 16 (foo): 17 * stress/string-from-char-code-change-structure-not-dead.js: Added. 18 (foo): 19 (i.valueOf): 20 (weirdValue.valueOf): 21 * stress/string-from-char-code-change-structure.js: Added. 22 (foo): 23 (i.valueOf): 24 (weirdValue.valueOf): 25 1 26 2018-04-09 Leo Balter <leonardo.balter@gmail.com> 2 27 -
trunk/Source/JavaScriptCore/ChangeLog
r230486 r230488 1 2018-04-09 Filip Pizlo <fpizlo@apple.com> 2 3 DFG AI and clobberize should agree with each other 4 https://bugs.webkit.org/show_bug.cgi?id=184440 5 6 Reviewed by Saam Barati. 7 8 One way to fix bugs involving underapproximation in AI or clobberize is to assert that they 9 agree with each other. That's what this patch does: it adds an assertion that AI's structure 10 state tracking must be equivalent to JSCell_structureID being clobbered. 11 12 One subtlety is that AI sometimes folds away structure clobbering using information that 13 clobberize doesn't have. So, we track this wuth special kinds of AI states (FoldedClobber and 14 ObservedTransitions). 15 16 This fixes a bunch of cases of AI missing clobberStructures/clobberWorld and one case of 17 clobberize missing a write(Heap). 18 19 This also makes some cases more precise in order to appease the assertion. Making things more 20 precise might make things faster, but I didn't measure it because that wasn't the goal. 21 22 * JavaScriptCore.xcodeproj/project.pbxproj: 23 * Sources.txt: 24 * dfg/DFGAbstractInterpreter.h: 25 * dfg/DFGAbstractInterpreterClobberState.cpp: Added. 26 (WTF::printInternal): 27 * dfg/DFGAbstractInterpreterClobberState.h: Added. 28 (JSC::DFG::mergeClobberStates): 29 * dfg/DFGAbstractInterpreterInlines.h: 30 (JSC::DFG::AbstractInterpreter<AbstractStateType>::startExecuting): 31 (JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects): 32 (JSC::DFG::AbstractInterpreter<AbstractStateType>::didFoldClobberWorld): 33 (JSC::DFG::AbstractInterpreter<AbstractStateType>::clobberStructures): 34 (JSC::DFG::AbstractInterpreter<AbstractStateType>::didFoldClobberStructures): 35 (JSC::DFG::AbstractInterpreter<AbstractStateType>::observeTransition): 36 (JSC::DFG::AbstractInterpreter<AbstractStateType>::observeTransitions): 37 (JSC::DFG::AbstractInterpreter<AbstractStateType>::setDidClobber): Deleted. 38 * dfg/DFGAtTailAbstractState.h: 39 (JSC::DFG::AtTailAbstractState::setClobberState): 40 (JSC::DFG::AtTailAbstractState::mergeClobberState): 41 (JSC::DFG::AtTailAbstractState::setDidClobber): Deleted. 42 * dfg/DFGCFAPhase.cpp: 43 (JSC::DFG::CFAPhase::performBlockCFA): 44 * dfg/DFGClobberSet.cpp: 45 (JSC::DFG::writeSet): 46 * dfg/DFGClobberSet.h: 47 * dfg/DFGClobberize.h: 48 (JSC::DFG::clobberize): 49 * dfg/DFGConstantFoldingPhase.cpp: 50 (JSC::DFG::ConstantFoldingPhase::foldConstants): 51 * dfg/DFGInPlaceAbstractState.h: 52 (JSC::DFG::InPlaceAbstractState::clobberState const): 53 (JSC::DFG::InPlaceAbstractState::didClobberOrFolded const): 54 (JSC::DFG::InPlaceAbstractState::didClobber const): 55 (JSC::DFG::InPlaceAbstractState::setClobberState): 56 (JSC::DFG::InPlaceAbstractState::mergeClobberState): 57 (JSC::DFG::InPlaceAbstractState::setDidClobber): Deleted. 58 1 59 2018-04-10 Filip Pizlo <fpizlo@apple.com> 2 60 -
trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
r230294 r230488 343 343 0F5CF9841E9D537700C18692 /* AirLowerStackArgs.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F5CF9831E9D537500C18692 /* AirLowerStackArgs.h */; }; 344 344 0F5CF9891E9ED65200C18692 /* AirStackAllocation.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F5CF9871E9ED64E00C18692 /* AirStackAllocation.h */; }; 345 0F5E0FD8207C72730097F0DE /* DFGAbstractInterpreterClobberState.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F5E0FD6207C72710097F0DE /* DFGAbstractInterpreterClobberState.h */; }; 345 346 0F5EF91F16878F7D003E5C25 /* JITThunks.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F5EF91C16878F78003E5C25 /* JITThunks.h */; settings = {ATTRIBUTES = (Private, ); }; }; 346 347 0F5F08CF146C7633000472A9 /* UnconditionalFinalizer.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F5F08CE146C762F000472A9 /* UnconditionalFinalizer.h */; settings = {ATTRIBUTES = (Private, ); }; }; … … 2347 2348 0F5CF9871E9ED64E00C18692 /* AirStackAllocation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AirStackAllocation.h; path = b3/air/AirStackAllocation.h; sourceTree = "<group>"; }; 2348 2349 0F5D085C1B8CF99D001143B4 /* DFGNodeOrigin.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DFGNodeOrigin.cpp; path = dfg/DFGNodeOrigin.cpp; sourceTree = "<group>"; }; 2350 0F5E0FD6207C72710097F0DE /* DFGAbstractInterpreterClobberState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DFGAbstractInterpreterClobberState.h; path = dfg/DFGAbstractInterpreterClobberState.h; sourceTree = "<group>"; }; 2351 0F5E0FD7207C72710097F0DE /* DFGAbstractInterpreterClobberState.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DFGAbstractInterpreterClobberState.cpp; path = dfg/DFGAbstractInterpreterClobberState.cpp; sourceTree = "<group>"; }; 2349 2352 0F5EF91B16878F78003E5C25 /* JITThunks.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JITThunks.cpp; sourceTree = "<group>"; }; 2350 2353 0F5EF91C16878F78003E5C25 /* JITThunks.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JITThunks.h; sourceTree = "<group>"; }; … … 7092 7095 A77A423717A0BBFD00A8DB81 /* DFGAbstractHeap.h */, 7093 7096 A704D8FE17A0BAA8006BA554 /* DFGAbstractInterpreter.h */, 7097 0F5E0FD7207C72710097F0DE /* DFGAbstractInterpreterClobberState.cpp */, 7098 0F5E0FD6207C72710097F0DE /* DFGAbstractInterpreterClobberState.h */, 7094 7099 A704D8FF17A0BAA8006BA554 /* DFGAbstractInterpreterInlines.h */, 7095 7100 0F55C19317276E4600CEABFD /* DFGAbstractValue.cpp */, … … 8216 8221 8B3BF5E41E3D368B0076A87A /* AsyncGeneratorPrototype.lut.h in Headers */, 8217 8222 8BC064961E1D845C00B2B8CA /* AsyncIteratorPrototype.h in Headers */, 8223 0F5E0FD8207C72730097F0DE /* DFGAbstractInterpreterClobberState.h in Headers */, 8218 8224 6A38CFAA1E32B5AB0060206F /* AsyncStackTrace.h in Headers */, 8219 8225 0F7CF9571DC125900098CC12 /* AtomicsObject.h in Headers */, -
trunk/Source/JavaScriptCore/Sources.txt
r230294 r230488 275 275 276 276 dfg/DFGAbstractHeap.cpp 277 dfg/DFGAbstractInterpreterClobberState.cpp 277 278 dfg/DFGAbstractValue.cpp 278 279 dfg/DFGAdaptiveInferredPropertyValueWatchpoint.cpp -
trunk/Source/JavaScriptCore/dfg/DFGAbstractInterpreter.h
r227341 r230488 151 151 private: 152 152 void clobberWorld(const CodeOrigin&, unsigned indexInBlock); 153 void didFoldClobberWorld(); 153 154 154 155 template<typename Functor> … … 156 157 157 158 void clobberStructures(unsigned indexInBlock); 159 void didFoldClobberStructures(); 160 158 161 void observeTransition(unsigned indexInBlock, RegisteredStructure from, RegisteredStructure to); 159 162 void observeTransitions(unsigned indexInBlock, const TransitionVector&); 160 void setDidClobber();161 163 162 164 enum BooleanResult { -
trunk/Source/JavaScriptCore/dfg/DFGAbstractInterpreterInlines.h
r230485 r230488 30 30 #include "ArrayConstructor.h" 31 31 #include "DFGAbstractInterpreter.h" 32 #include "DFGAbstractInterpreterClobberState.h" 32 33 #include "DOMJITGetterSetter.h" 33 34 #include "DOMJITSignature.h" … … 98 99 ASSERT(m_state.isValid()); 99 100 100 m_state.set DidClobber(false);101 m_state.setClobberState(AbstractInterpreterClobberState::NotClobbered); 101 102 } 102 103 … … 330 331 // itself into a straight-line sequence of GetStack/PutStack. 331 332 // https://bugs.webkit.org/show_bug.cgi?id=143071 332 clobberWorld(node->origin.semantic, clobberLimit); 333 switch (node->op()) { 334 case LoadVarargs: 335 clobberWorld(node->origin.semantic, clobberLimit); 336 break; 337 case ForwardVarargs: 338 break; 339 default: 340 DFG_CRASH(m_graph, node, "Bad opcode"); 341 break; 342 } 333 343 LoadVarargsData* data = node->loadVarargsData(); 334 344 m_state.variables().operand(data->count).setType(SpecInt32Only); … … 610 620 JSValue operand = forNode(node->child1()).value(); 611 621 if (std::optional<double> number = operand.toNumberFromPrimitive()) { 622 switch (node->child1().useKind()) { 623 case Int32Use: 624 case KnownInt32Use: 625 break; 626 default: 627 didFoldClobberWorld(); 628 break; 629 } 612 630 uint32_t value = toUInt32(*number); 613 631 setConstant(node, jsNumber(clz32(value))); … … 1017 1035 JSValue operand = forNode(node->child1()).value(); 1018 1036 if (std::optional<double> number = operand.toNumberFromPrimitive()) { 1037 if (node->child1().useKind() != DoubleRepUse) 1038 didFoldClobberWorld(); 1039 1019 1040 double roundedValue = 0; 1020 1041 if (node->op() == ArithRound) … … 1516 1537 case CompareGreaterEq: 1517 1538 case CompareEq: { 1539 bool isClobbering = node->isBinaryUseKind(UntypedUse); 1540 1541 if (isClobbering) 1542 didFoldClobberWorld(); 1543 1518 1544 JSValue leftConst = forNode(node->child1()).value(); 1519 1545 JSValue rightConst = forNode(node->child2()).value(); … … 1637 1663 } 1638 1664 1639 if ( node->isBinaryUseKind(UntypedUse))1665 if (isClobbering) 1640 1666 clobberWorld(node->origin.semantic, clobberLimit); 1641 1667 forNode(node).setType(SpecBoolean); … … 1724 1750 1725 1751 case StringFromCharCode: 1752 switch (node->child1().useKind()) { 1753 case Int32Use: 1754 break; 1755 case UntypedUse: 1756 clobberWorld(node->origin.semantic, clobberLimit); 1757 break; 1758 default: 1759 DFG_CRASH(m_graph, node, "Bad use kind"); 1760 break; 1761 } 1726 1762 forNode(node).setType(m_graph, SpecString); 1727 1763 break; … … 1784 1820 case Array::DirectArguments: 1785 1821 case Array::ScopedArguments: 1822 if (node->arrayMode().isOutOfBounds()) 1823 clobberWorld(node->origin.semantic, clobberLimit); 1786 1824 forNode(node).makeHeapTop(); 1787 1825 break; … … 2070 2108 JSValue childConst = forNode(node->child1()).value(); 2071 2109 if (childConst && childConst.isNumber()) { 2110 didFoldClobberWorld(); 2072 2111 setConstant(node, childConst); 2073 2112 break; … … 2078 2117 if (!(forNode(node->child1()).m_type & ~(SpecFullNumber | SpecBoolean | SpecString | SpecSymbol))) { 2079 2118 m_state.setFoundConstants(true); 2119 didFoldClobberWorld(); 2080 2120 forNode(node) = forNode(node->child1()); 2081 2121 break; … … 2091 2131 JSValue childConst = forNode(node->child1()).value(); 2092 2132 if (childConst && childConst.isNumber()) { 2133 didFoldClobberWorld(); 2093 2134 setConstant(node, childConst); 2094 2135 break; … … 2099 2140 if (!(forNode(node->child1()).m_type & ~SpecBytecodeNumber)) { 2100 2141 m_state.setFoundConstants(true); 2142 didFoldClobberWorld(); 2101 2143 forNode(node) = forNode(node->child1()); 2102 2144 break; … … 2142 2184 if (2 <= radix && radix <= 36) { 2143 2185 m_state.setFoundConstants(true); 2186 didFoldClobberWorld(); 2144 2187 forNode(node).set(m_graph, m_graph.m_vm.stringStructure.get()); 2145 2188 break; … … 2185 2228 2186 2229 case Spread: 2187 if (!m_graph.canDoFastSpread(node, forNode(node->child1()))) 2188 clobberWorld(node->origin.semantic, clobberLimit); 2230 switch (node->child1()->op()) { 2231 case PhantomNewArrayBuffer: 2232 case PhantomCreateRest: 2233 break; 2234 default: 2235 if (!m_graph.canDoFastSpread(node, forNode(node->child1()))) 2236 clobberWorld(node->origin.semantic, clobberLimit); 2237 else 2238 didFoldClobberWorld(); 2239 break; 2240 } 2189 2241 2190 2242 forNode(node).set( … … 2268 2320 m_graph.watchpoints().addLazily(rareData->allocationProfileWatchpointSet()); 2269 2321 m_state.setFoundConstants(true); 2322 didFoldClobberWorld(); 2270 2323 forNode(node).set(m_graph, structure); 2271 2324 break; … … 2292 2345 if (!(source.m_type & ~SpecObject)) { 2293 2346 m_state.setFoundConstants(true); 2347 if (node->op() == ToObject) 2348 didFoldClobberWorld(); 2294 2349 destination = source; 2295 2350 break; … … 2316 2371 case PhantomNewRegexp: 2317 2372 case BottomValue: 2318 m_state.setDidClobber(true); // Prevent constant folding.2319 2373 // This claims to return bottom. 2320 2374 break; … … 2521 2575 case GetById: 2522 2576 case GetByIdFlush: { 2523 if (!node->prediction()) {2524 m_state.setIsValid(false);2525 break;2526 }2527 2528 2577 AbstractValue& value = forNode(node->child1()); 2529 2578 if (value.m_structure.isFinite() … … 2545 2594 } 2546 2595 m_state.setFoundConstants(true); 2596 didFoldClobberWorld(); 2547 2597 forNode(node) = result; 2548 2598 break; … … 2674 2724 case PutStructure: 2675 2725 if (!forNode(node->child1()).m_structure.isClear()) { 2676 if (forNode(node->child1()).m_structure.onlyStructure() == node->transition()->next) 2726 if (forNode(node->child1()).m_structure.onlyStructure() == node->transition()->next) { 2727 didFoldClobberStructures(); 2677 2728 m_state.setFoundConstants(true); 2678 else {2729 } else { 2679 2730 observeTransition( 2680 2731 clobberLimit, node->transition()->previous, node->transition()->next); … … 2689 2740 // FIXME: We don't model the fact that the structureID is nuked, simply because currently 2690 2741 // nobody would currently benefit from having that information. But it's a bug nonetheless. 2742 if (node->op() == NukeStructureAndSetButterfly) 2743 didFoldClobberStructures(); 2691 2744 forNode(node).clear(); // The result is not a JS value. 2692 2745 break; … … 2788 2841 case Arrayify: { 2789 2842 if (node->arrayMode().alreadyChecked(m_graph, node, forNode(node->child1()))) { 2843 didFoldClobberStructures(); 2790 2844 m_state.setFoundConstants(true); 2791 2845 break; … … 2879 2933 2880 2934 if (prototype && canFold) { 2935 switch (node->child1().useKind()) { 2936 case ArrayUse: 2937 case FunctionUse: 2938 case FinalObjectUse: 2939 break; 2940 default: 2941 didFoldClobberWorld(); 2942 break; 2943 } 2881 2944 setConstant(node, *m_graph.freeze(prototype)); 2882 2945 break; … … 3010 3073 AbstractValue resultingValue; 3011 3074 3075 if (node->multiPutByOffsetData().writesStructures()) 3076 didFoldClobberStructures(); 3077 3012 3078 for (unsigned i = node->multiPutByOffsetData().variants.size(); i--;) { 3013 3079 const PutByIdVariant& variant = node->multiPutByOffsetData().variants[i]; … … 3140 3206 m_state.setFoundConstants(true); 3141 3207 3208 didFoldClobberWorld(); 3142 3209 observeTransitions(clobberLimit, transitions); 3143 3210 if (forNode(node->child1()).changeStructure(m_graph, newSet) == Contradiction) … … 3367 3434 && (radix.asNumber() == 0 || radix.asNumber() == 10)) { 3368 3435 m_state.setFoundConstants(true); 3436 if (node->child1().useKind() == UntypedUse) 3437 didFoldClobberWorld(); 3369 3438 forNode(node).setType(SpecInt32Only); 3370 3439 break; … … 3467 3536 { 3468 3537 clobberStructures(clobberLimit); 3538 } 3539 3540 template<typename AbstractStateType> 3541 void AbstractInterpreter<AbstractStateType>::didFoldClobberWorld() 3542 { 3543 didFoldClobberStructures(); 3469 3544 } 3470 3545 … … 3502 3577 { 3503 3578 forAllValues(clobberLimit, AbstractValue::clobberStructuresFor); 3504 setDidClobber(); 3579 m_state.mergeClobberState(AbstractInterpreterClobberState::ClobberedStructures); 3580 m_state.setStructureClobberState(StructuresAreClobbered); 3581 } 3582 3583 template<typename AbstractStateType> 3584 void AbstractInterpreter<AbstractStateType>::didFoldClobberStructures() 3585 { 3586 m_state.mergeClobberState(AbstractInterpreterClobberState::FoldedClobber); 3505 3587 } 3506 3588 … … 3513 3595 3514 3596 ASSERT(!from->dfgShouldWatch()); // We don't need to claim to be in a clobbered state because 'from' was never watchable (during the time we were compiling), hence no constants ever introduced into the DFG IR that ever had a watchable structure would ever have the same structure as from. 3597 3598 m_state.mergeClobberState(AbstractInterpreterClobberState::ObservedTransitions); 3515 3599 } 3516 3600 … … 3519 3603 unsigned clobberLimit, const TransitionVector& vector) 3520 3604 { 3605 if (vector.isEmpty()) 3606 return; 3607 3521 3608 AbstractValue::TransitionsObserver transitionsObserver(vector); 3522 3609 forAllValues(clobberLimit, transitionsObserver); … … 3527 3614 ASSERT(!vector[i].previous->dfgShouldWatch()); 3528 3615 } 3529 } 3530 3531 template<typename AbstractStateType> 3532 void AbstractInterpreter<AbstractStateType>::setDidClobber() 3533 { 3534 m_state.setDidClobber(true); 3535 m_state.setStructureClobberState(StructuresAreClobbered); 3616 3617 m_state.mergeClobberState(AbstractInterpreterClobberState::ObservedTransitions); 3536 3618 } 3537 3619 … … 3633 3715 JSValue child = forNode(node->child1()).value(); 3634 3716 if (std::optional<double> number = child.toNumberFromPrimitive()) { 3717 if (node->child1().useKind() != DoubleRepUse) 3718 didFoldClobberWorld(); 3635 3719 setConstant(node, jsDoubleNumber(equivalentFunction(*number))); 3636 3720 return; -
trunk/Source/JavaScriptCore/dfg/DFGAtTailAbstractState.h
r225966 r230488 1 1 /* 2 * Copyright (C) 2013 , 2016Apple 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 … … 28 28 #if ENABLE(DFG_JIT) 29 29 30 #include "DFGAbstractInterpreterClobberState.h" 30 31 #include "DFGAbstractValue.h" 31 32 #include "DFGBasicBlock.h" … … 60 61 StructureClobberState structureClobberState() const { return m_block->cfaStructureClobberStateAtTail; } 61 62 62 void setDidClobber(bool) { } 63 void setClobberState(AbstractInterpreterClobberState) { } 64 void mergeClobberState(AbstractInterpreterClobberState) { } 63 65 void setStructureClobberState(StructureClobberState state) { RELEASE_ASSERT(state == m_block->cfaStructureClobberStateAtTail); } 64 66 void setIsValid(bool isValid) { m_block->cfaDidFinish = isValid; } -
trunk/Source/JavaScriptCore/dfg/DFGCFAPhase.cpp
r204130 r230488 1 1 /* 2 * Copyright (C) 2011 , 2013-2016Apple Inc. All rights reserved.2 * Copyright (C) 2011-2018 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 30 30 31 31 #include "DFGAbstractInterpreterInlines.h" 32 #include "DFGClobberSet.h" 32 33 #include "DFGGraph.h" 33 34 #include "DFGInPlaceAbstractState.h" … … 164 165 } 165 166 for (unsigned i = 0; i < block->size(); ++i) { 167 Node* node = block->at(i); 166 168 if (m_verbose) { 167 Node* node = block->at(i);168 169 dataLogF(" %s @%u: ", Graph::opName(node->op()), node->index()); 169 170 … … 180 181 break; 181 182 } 183 184 if (m_state.didClobberOrFolded() != writesOverlap(m_graph, node, JSCell_structureID)) 185 DFG_CRASH(m_graph, node, toCString("AI-clobberize disagreement; AI says ", m_state.clobberState(), " while clobberize says ", writeSet(m_graph, node)).data()); 182 186 } 183 187 if (m_verbose) { -
trunk/Source/JavaScriptCore/dfg/DFGClobberSet.cpp
r210023 r230488 1 1 /* 2 * Copyright (C) 2013 , 2014Apple 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 … … 159 159 } 160 160 161 ClobberSet writeSet(Graph& graph, Node* node) 162 { 163 ClobberSet result; 164 addWrites(graph, node, result); 165 return result; 166 } 167 161 168 bool readsOverlap(Graph& graph, Node* node, ClobberSet& readSet) 162 169 { -
trunk/Source/JavaScriptCore/dfg/DFGClobberSet.h
r207787 r230488 1 1 /* 2 * Copyright (C) 2013 Apple 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 … … 114 114 void addReadsAndWrites(Graph&, Node*, ClobberSet& reads, ClobberSet& writes); 115 115 116 ClobberSet writeSet(Graph&, Node*); 117 116 118 bool readsOverlap(Graph&, Node*, ClobberSet&); 117 119 bool writesOverlap(Graph&, Node*, ClobberSet&); -
trunk/Source/JavaScriptCore/dfg/DFGClobberize.h
r230485 r230488 955 955 956 956 case Array::ArrayStorage: 957 if (node->arrayMode().isOutOfBounds()) { 958 read(World); 959 write(Heap); 960 return; 961 } 962 read(Butterfly_publicLength); 963 read(Butterfly_vectorLength); 964 read(ArrayStorageProperties); 965 write(ArrayStorageProperties); 966 if (node->arrayMode().mayStoreToHole()) 967 write(Butterfly_publicLength); 968 return; 969 957 970 case Array::SlowPutArrayStorage: 958 // Give up on life for now. 959 read(World); 960 write(Heap); 971 if (node->arrayMode().mayStoreToHole()) { 972 read(World); 973 write(Heap); 974 return; 975 } 976 read(Butterfly_publicLength); 977 read(Butterfly_vectorLength); 978 read(ArrayStorageProperties); 979 write(ArrayStorageProperties); 961 980 return; 962 981 … … 1297 1316 1298 1317 case NewArrayWithSize: 1299 case NewTypedArray:1300 1318 read(HeapObjectCount); 1301 1319 write(HeapObjectCount); 1302 1320 return; 1321 1322 case NewTypedArray: 1323 switch (node->child1().useKind()) { 1324 case Int32Use: 1325 read(HeapObjectCount); 1326 write(HeapObjectCount); 1327 return; 1328 case UntypedUse: 1329 read(World); 1330 write(Heap); 1331 return; 1332 default: 1333 DFG_CRASH(graph, node, "Bad use kind"); 1334 } 1335 break; 1303 1336 1304 1337 case NewArrayWithSpread: { … … 1538 1571 return; 1539 1572 } 1540 1573 1541 1574 if (node->isBinaryUseKind(UntypedUse)) { 1542 1575 read(World); -
trunk/Source/JavaScriptCore/dfg/DFGConstantFoldingPhase.cpp
r230376 r230488 784 784 } 785 785 786 case PhantomNewObject: 787 case PhantomNewFunction: 788 case PhantomNewGeneratorFunction: 789 case PhantomNewAsyncGeneratorFunction: 790 case PhantomNewAsyncFunction: 791 case PhantomCreateActivation: 792 case PhantomDirectArguments: 793 case PhantomClonedArguments: 794 case PhantomCreateRest: 795 case PhantomSpread: 796 case PhantomNewArrayWithSpread: 797 case PhantomNewArrayBuffer: 798 case PhantomNewRegexp: 799 case BottomValue: 800 alreadyHandled = true; 801 break; 802 786 803 default: 787 804 break; -
trunk/Source/JavaScriptCore/dfg/DFGFixupPhase.cpp
r230376 r230488 686 686 687 687 case StringFromCharCode: 688 if (node->child1()->shouldSpeculateInt32()) 688 if (node->child1()->shouldSpeculateInt32()) { 689 689 fixEdge<Int32Use>(node->child1()); 690 else 690 node->clearFlags(NodeMustGenerate); 691 } else 691 692 fixEdge<UntypedUse>(node->child1()); 692 693 break; -
trunk/Source/JavaScriptCore/dfg/DFGInPlaceAbstractState.h
r225966 r230488 1 1 /* 2 * Copyright (C) 2013 , 2016Apple 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 … … 28 28 #if ENABLE(DFG_JIT) 29 29 30 #include "DFGAbstractInterpreterClobberState.h" 30 31 #include "DFGAbstractValue.h" 31 32 #include "DFGBranchDirection.h" … … 91 92 void reset(); 92 93 94 AbstractInterpreterClobberState clobberState() const { return m_clobberState; } 95 96 // Would have the last executed node clobbered things had we not found a way to fold it? 97 bool didClobberOrFolded() const { return clobberState() != AbstractInterpreterClobberState::NotClobbered; } 98 93 99 // Did the last executed node clobber the world? 94 bool didClobber() const { return m_didClobber; }100 bool didClobber() const { return clobberState() == AbstractInterpreterClobberState::ClobberedStructures; } 95 101 96 102 // Are structures currently clobbered? … … 115 121 116 122 // Methods intended to be called from AbstractInterpreter. 117 void setDidClobber(bool didClobber) { m_didClobber = didClobber; } 123 void setClobberState(AbstractInterpreterClobberState state) { m_clobberState = state; } 124 void mergeClobberState(AbstractInterpreterClobberState state) { m_clobberState = mergeClobberStates(m_clobberState, state); } 118 125 void setStructureClobberState(StructureClobberState value) { m_structureClobberState = value; } 119 126 void setIsValid(bool isValid) { m_isValid = isValid; } … … 146 153 147 154 bool m_isValid; 148 bool m_didClobber;155 AbstractInterpreterClobberState m_clobberState; 149 156 StructureClobberState m_structureClobberState; 150 157 -
trunk/Source/JavaScriptCore/dfg/DFGNodeType.h
r230376 r230488 283 283 macro(StringCharCodeAt, NodeResultInt32) \ 284 284 macro(StringCharAt, NodeResultJS) \ 285 macro(StringFromCharCode, NodeResultJS ) \285 macro(StringFromCharCode, NodeResultJS | NodeMustGenerate) \ 286 286 \ 287 287 /* Nodes for comparison operations. */\
Note: See TracChangeset
for help on using the changeset viewer.