Changeset 240114 in webkit
- Timestamp:
- Jan 17, 2019 9:50:27 AM (5 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 1 deleted
- 19 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JSTests/ChangeLog
r240106 r240114 1 2019-01-17 Saam barati <sbarati@apple.com> 2 3 StringObjectUse should not be a structure check for the original string object structure 4 https://bugs.webkit.org/show_bug.cgi?id=193483 5 <rdar://problem/47280522> 6 7 Reviewed by Yusuke Suzuki. 8 9 * stress/cant-eliminate-string-object-structure-check-when-string-object-is-proven.js: Added. 10 (foo): 11 (a.valueOf.0): 12 1 13 2019-01-17 Yusuke Suzuki <yusukesuzuki@slowstart.org> 2 14 -
trunk/Source/JavaScriptCore/ChangeLog
r240113 r240114 1 2019-01-17 Saam barati <sbarati@apple.com> 2 3 StringObjectUse should not be a structure check for the original string object structure 4 https://bugs.webkit.org/show_bug.cgi?id=193483 5 <rdar://problem/47280522> 6 7 Reviewed by Yusuke Suzuki. 8 9 Prior to this patch, the use kind for StringObjectUse implied that we 10 do a StructureCheck on the input operand for the *original* StringObject 11 structure. This is generally not how we use UseKinds, so it's no surprise 12 that this is buggy. A UseKind should map to a set of SpeculatedTypes, not an 13 actual set of structures. This patch changes the meaning of StringObjectUse 14 to mean an object where jsDynamicCast<StringObject*> would succeed. 15 16 This patch also fixes a bug that was caused by the old and weird usage of the 17 UseKind to mean StructureCheck. Consider a program like this: 18 ``` 19 S1 = Original StringObject structure 20 S2 = Original StringObject structure with the field "f" added 21 22 a: GetLocal() 23 b: CheckStructure(@a, {S2}) 24 c: ToString(StringObject:@a) 25 ``` 26 27 According to AI, in the above program, we would exit at @c, since 28 StringObject:@a implies a structure check of {S1}, and the intersection 29 of {S1} and {S2} is {}. So, we'd convert the program to be: 30 ``` 31 a: GetLocal() 32 b: CheckStructure(@a, {S2}) 33 c: Check(StringObject:@a) 34 d: Unreachable 35 ``` 36 37 However, AI would set the proof status of the StringObject:@a edge 38 to be proven, since the SpeculatedType for @a is SpecStringObject. 39 This was incorrect of AI to do because the SpeculatedType itself 40 didn't capture the full power of StringObjectUse. However, having 41 a UseKind mean CheckStructure is weird precisely because what AI was 42 doing is a natural fit to how we typically we think about UseKinds. 43 44 So the above program would then incorrectly be converted to this, and 45 we'd crash when reaching the Unreachable node: 46 ``` 47 a: GetLocal() 48 b: CheckStructure(@a, {S2}) 49 d: Unreachable 50 ``` 51 52 This patch makes it so that StringObjectUse just means that the object that 53 filters through a StringObjectUse check must !!jsDynamicCast<StringObject*>. 54 This is now in line with all other UseKinds. It also lets us simplify a bunch 55 of other code that had weird checks for the StringObjectUse UseKind. 56 57 This patch also makes it so that anywhere where we used to rely on 58 StringObjectUse implying a structure check we actually emit an explicit 59 CheckStructure node. 60 61 * JavaScriptCore.xcodeproj/project.pbxproj: 62 * bytecode/ExitKind.cpp: 63 (JSC::exitKindToString): 64 * bytecode/ExitKind.h: 65 * dfg/DFGAbstractInterpreterInlines.h: 66 (JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects): 67 * dfg/DFGCSEPhase.cpp: 68 * dfg/DFGClobberize.h: 69 (JSC::DFG::clobberize): 70 * dfg/DFGEdgeUsesStructure.h: Removed. 71 * dfg/DFGFixupPhase.cpp: 72 (JSC::DFG::FixupPhase::attemptToForceStringArrayModeByToStringConversion): 73 (JSC::DFG::FixupPhase::addCheckStructureForOriginalStringObjectUse): 74 (JSC::DFG::FixupPhase::fixupToPrimitive): 75 (JSC::DFG::FixupPhase::fixupToStringOrCallStringConstructor): 76 (JSC::DFG::FixupPhase::attemptToMakeFastStringAdd): 77 (JSC::DFG::FixupPhase::isStringObjectUse): Deleted. 78 * dfg/DFGGraph.cpp: 79 (JSC::DFG::Graph::canOptimizeStringObjectAccess): 80 * dfg/DFGMayExit.cpp: 81 * dfg/DFGSpeculativeJIT.cpp: 82 (JSC::DFG::SpeculativeJIT::compileToStringOrCallStringConstructorOrStringValueOf): 83 (JSC::DFG::SpeculativeJIT::speculateStringObject): 84 (JSC::DFG::SpeculativeJIT::speculateStringOrStringObject): 85 * dfg/DFGSpeculativeJIT.h: 86 (JSC::DFG::SpeculativeJIT::speculateStringObjectForStructure): Deleted. 87 * dfg/DFGUseKind.h: 88 (JSC::DFG::alreadyChecked): 89 (JSC::DFG::usesStructure): Deleted. 90 * ftl/FTLLowerDFGToB3.cpp: 91 (JSC::FTL::DFG::LowerDFGToB3::compileToStringOrCallStringConstructorOrStringValueOf): 92 (JSC::FTL::DFG::LowerDFGToB3::speculateStringObject): 93 (JSC::FTL::DFG::LowerDFGToB3::speculateStringOrStringObject): 94 (JSC::FTL::DFG::LowerDFGToB3::speculateStringObjectForCell): 95 (JSC::FTL::DFG::LowerDFGToB3::speculateStringObjectForStructureID): Deleted. 96 * runtime/JSType.cpp: 97 (WTF::printInternal): 98 * runtime/JSType.h: 99 * runtime/StringObject.h: 100 (JSC::StringObject::createStructure): 101 * runtime/StringPrototype.h: 102 1 103 2019-01-17 Yusuke Suzuki <yusukesuzuki@slowstart.org> 2 104 -
trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
r240023 r240114 1465 1465 A790DD6E182F499700588807 /* SetIteratorPrototype.h in Headers */ = {isa = PBXBuildFile; fileRef = A790DD68182F499700588807 /* SetIteratorPrototype.h */; }; 1466 1466 A790DD70182F499700588807 /* JSSetIterator.h in Headers */ = {isa = PBXBuildFile; fileRef = A790DD6A182F499700588807 /* JSSetIterator.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1467 A7986D5717A0BB1E00A95DD0 /* DFGEdgeUsesStructure.h in Headers */ = {isa = PBXBuildFile; fileRef = A7986D5617A0BB1E00A95DD0 /* DFGEdgeUsesStructure.h */; };1468 1467 A79D3ED9C5064DD0A8466A3A /* ModuleScopeData.h in Headers */ = {isa = PBXBuildFile; fileRef = 000BEAF0DF604481AF6AB68C /* ModuleScopeData.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1469 1468 A7A8AF3517ADB5F3005AB174 /* ArrayBuffer.h in Headers */ = {isa = PBXBuildFile; fileRef = A7A8AF2617ADB5F3005AB174 /* ArrayBuffer.h */; settings = {ATTRIBUTES = (Private, ); }; }; … … 4269 4268 A790DD69182F499700588807 /* JSSetIterator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSSetIterator.cpp; sourceTree = "<group>"; }; 4270 4269 A790DD6A182F499700588807 /* JSSetIterator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSSetIterator.h; sourceTree = "<group>"; }; 4271 A7986D5617A0BB1E00A95DD0 /* DFGEdgeUsesStructure.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DFGEdgeUsesStructure.h; path = dfg/DFGEdgeUsesStructure.h; sourceTree = "<group>"; };4272 4270 A79E781E15EECBA80047C855 /* UnlinkedCodeBlock.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UnlinkedCodeBlock.cpp; sourceTree = "<group>"; }; 4273 4271 A79E781F15EECBA80047C855 /* UnlinkedCodeBlock.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UnlinkedCodeBlock.h; sourceTree = "<group>"; }; … … 7370 7368 0F66E16914DF3F1300B7B2E4 /* DFGEdge.h */, 7371 7369 A7D9A29117A0BC7400EE2618 /* DFGEdgeDominates.h */, 7372 A7986D5617A0BB1E00A95DD0 /* DFGEdgeUsesStructure.h */,7373 7370 0F8F142F1ADF090100ED792C /* DFGEpoch.cpp */, 7374 7371 0F8F14301ADF090100ED792C /* DFGEpoch.h */, … … 8751 8748 0F66E16C14DF3F1600B7B2E4 /* DFGEdge.h in Headers */, 8752 8749 A7D9A29617A0BC7400EE2618 /* DFGEdgeDominates.h in Headers */, 8753 A7986D5717A0BB1E00A95DD0 /* DFGEdgeUsesStructure.h in Headers */,8754 8750 0F8F14341ADF090100ED792C /* DFGEpoch.h in Headers */, 8755 8751 0FBC0AE81496C7C700D4FBDD /* DFGExitProfile.h in Headers */, -
trunk/Source/JavaScriptCore/bytecode/ExitKind.cpp
r231607 r240114 71 71 case ExoticObjectMode: 72 72 return "ExoticObjectMode"; 73 case NotStringObject:74 return "NotStringObject";75 73 case VarargsOverflow: 76 74 return "VarargsOverflow"; -
trunk/Source/JavaScriptCore/bytecode/ExitKind.h
r221341 r240114 47 47 ArgumentsEscaped, // We exited because arguments escaped but we didn't expect them to. 48 48 ExoticObjectMode, // We exited because some exotic object that we were accessing was in an exotic mode (like Arguments with slow arguments). 49 NotStringObject, // We exited because we shouldn't have attempted to optimize string object access.50 49 VarargsOverflow, // We exited because a varargs call passed more arguments than we expected. 51 50 TDZFailure, // We exited because we were in the TDZ and accessed the variable. -
trunk/Source/JavaScriptCore/dfg/DFGAbstractInterpreterInlines.h
r240106 r240114 2422 2422 switch (node->child1().useKind()) { 2423 2423 case StringObjectUse: 2424 // This also filters that the StringObject has the primordial StringObject2425 // structure.2426 filter(2427 node->child1(),2428 m_graph.registerStructure(m_graph.globalObjectFor(node->origin.semantic)->stringObjectStructure()));2429 break;2430 2424 case StringOrStringObjectUse: 2431 2425 case Int32Use: -
trunk/Source/JavaScriptCore/dfg/DFGCSEPhase.cpp
r230287 r240114 34 34 #include "DFGClobberize.h" 35 35 #include "DFGDominators.h" 36 #include "DFGEdgeUsesStructure.h"37 36 #include "DFGGraph.h" 38 37 #include "DFGPhase.h" -
trunk/Source/JavaScriptCore/dfg/DFGClobberize.h
r239761 r240114 29 29 30 30 #include "DFGAbstractHeap.h" 31 #include "DFGEdgeUsesStructure.h"32 31 #include "DFGGraph.h" 33 32 #include "DFGHeapLocation.h" … … 108 107 // just ignore def() by using a NoOpClobberize functor. 109 108 110 if (edgesUseStructure(graph, node))111 read(JSCell_structureID);112 113 109 // We allow the runtime to perform a stack scan at any time. We don't model which nodes get implemented 114 110 // by calls into the runtime. For debugging we might replace the implementation of any node with a call … … 1654 1650 case CallStringConstructor: 1655 1651 switch (node->child1().useKind()) { 1652 case CellUse: 1653 case UntypedUse: 1654 read(World); 1655 write(Heap); 1656 return; 1657 1656 1658 case StringObjectUse: 1657 1659 case StringOrStringObjectUse: 1658 // These don't def a pure value, unfortunately. I'll avoid load-eliminating these for 1659 // now. 1660 return; 1661 1662 case CellUse: 1663 case UntypedUse: 1664 read(World); 1665 write(Heap); 1666 return; 1660 // These two StringObjectUse's are pure because if we emit this node with either 1661 // of these UseKinds, we'll first emit a StructureCheck ensuring that we're the 1662 // original String or StringObject structure. Therefore, we don't have an overridden 1663 // valueOf, etc. 1667 1664 1668 1665 case Int32Use: -
trunk/Source/JavaScriptCore/dfg/DFGFixupPhase.cpp
r240024 r240114 2455 2455 return; 2456 2456 2457 addCheckStructureForOriginalStringObjectUse(useKind, node->origin, node->child1().node()); 2457 2458 createToString<useKind>(node, node->child1()); 2458 2459 arrayMode = ArrayMode(Array::String, Array::Read); 2459 2460 } 2460 2461 template<UseKind useKind> 2462 bool isStringObjectUse() 2463 { 2464 switch (useKind) { 2465 case StringObjectUse: 2466 case StringOrStringObjectUse: 2467 return true; 2468 default: 2469 return false; 2470 } 2461 2462 void addCheckStructureForOriginalStringObjectUse(UseKind useKind, const NodeOrigin& origin, Node* node) 2463 { 2464 RELEASE_ASSERT(useKind == StringObjectUse || StringOrStringObjectUse); 2465 2466 StructureSet set; 2467 set.add(m_graph.globalObjectFor(node->origin.semantic)->stringObjectStructure()); 2468 if (useKind == StringOrStringObjectUse) 2469 set.add(vm().stringStructure.get()); 2470 2471 m_insertionSet.insertNode( 2472 m_indexInBlock, SpecNone, CheckStructure, origin, 2473 OpInfo(m_graph.addStructureSet(set)), Edge(node, CellUse)); 2471 2474 } 2472 2475 … … 2750 2753 if (node->child1()->shouldSpeculateStringObject() 2751 2754 && m_graph.canOptimizeStringObjectAccess(node->origin.semantic)) { 2755 addCheckStructureForOriginalStringObjectUse(StringObjectUse, node->origin, node->child1().node()); 2752 2756 fixEdge<StringObjectUse>(node->child1()); 2753 2757 node->convertToToString(); … … 2757 2761 if (node->child1()->shouldSpeculateStringOrStringObject() 2758 2762 && m_graph.canOptimizeStringObjectAccess(node->origin.semantic)) { 2763 addCheckStructureForOriginalStringObjectUse(StringOrStringObjectUse, node->origin, node->child1().node()); 2759 2764 fixEdge<StringOrStringObjectUse>(node->child1()); 2760 2765 node->convertToToString(); … … 2872 2877 if (node->child1()->shouldSpeculateStringObject() 2873 2878 && m_graph.canOptimizeStringObjectAccess(node->origin.semantic)) { 2879 addCheckStructureForOriginalStringObjectUse(StringObjectUse, node->origin, node->child1().node()); 2874 2880 fixEdge<StringObjectUse>(node->child1()); 2875 2881 return; … … 2878 2884 if (node->child1()->shouldSpeculateStringOrStringObject() 2879 2885 && m_graph.canOptimizeStringObjectAccess(node->origin.semantic)) { 2886 addCheckStructureForOriginalStringObjectUse(StringOrStringObjectUse, node->origin, node->child1().node()); 2880 2887 fixEdge<StringOrStringObjectUse>(node->child1()); 2881 2888 return; … … 2976 2983 return; 2977 2984 } 2978 ASSERT(m_graph.canOptimizeStringObjectAccess(node->origin.semantic)); 2985 if (!Options::useConcurrentJIT()) 2986 ASSERT(m_graph.canOptimizeStringObjectAccess(node->origin.semantic)); 2979 2987 if (edge->shouldSpeculateStringObject()) { 2988 addCheckStructureForOriginalStringObjectUse(StringObjectUse, node->origin, edge.node()); 2980 2989 convertStringAddUse<StringObjectUse>(node, edge); 2981 2990 return; 2982 2991 } 2983 2992 if (edge->shouldSpeculateStringOrStringObject()) { 2993 addCheckStructureForOriginalStringObjectUse(StringOrStringObjectUse, node->origin, edge.node()); 2984 2994 convertStringAddUse<StringOrStringObjectUse>(node, edge); 2985 2995 return; -
trunk/Source/JavaScriptCore/dfg/DFGGraph.cpp
r240023 r240114 1691 1691 bool Graph::canOptimizeStringObjectAccess(const CodeOrigin& codeOrigin) 1692 1692 { 1693 if (hasExitSite(codeOrigin, NotStringObject))1693 if (hasExitSite(codeOrigin, BadCache) || hasExitSite(codeOrigin, BadConstantCache)) 1694 1694 return false; 1695 1695 -
trunk/Source/JavaScriptCore/dfg/DFGMayExit.cpp
r239142 r240114 176 176 break; 177 177 178 // These are shady because they check the structure even if the type of the child node179 // passes the StringObject type filter.180 case StringObjectUse:181 case StringOrStringObjectUse:182 result = Exits;183 break;184 185 178 default: 186 179 break; -
trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp
r239612 r240114 9469 9469 9470 9470 speculateStringObject(node->child1(), op1GPR); 9471 m_interpreter.filter(node->child1(), SpecStringObject);9472 9471 9473 9472 m_jit.loadPtr(JITCompiler::Address(op1GPR, JSWrapperObject::internalValueCellOffset()), resultGPR); … … 9480 9479 GPRReg resultGPR = result.gpr(); 9481 9480 9482 m_jit.load32(JITCompiler::Address(op1GPR, JSCell::structureIDOffset()), resultGPR); 9483 JITCompiler::Jump isString = m_jit.branchWeakStructure( 9484 JITCompiler::Equal, 9485 resultGPR, 9486 m_jit.graph().registerStructure(m_jit.vm()->stringStructure.get())); 9487 9488 speculateStringObjectForStructure(node->child1(), resultGPR); 9489 9481 m_jit.load8(JITCompiler::Address(op1GPR, JSCell::typeInfoTypeOffset()), resultGPR); 9482 JITCompiler::Jump isString = m_jit.branch32(JITCompiler::Equal, resultGPR, TrustedImm32(StringType)); 9483 9484 speculationCheck(BadType, JSValueSource::unboxedCell(op1GPR), node->child1().node(), m_jit.branch32(JITCompiler::NotEqual, resultGPR, TrustedImm32(StringObjectType))); 9490 9485 m_jit.loadPtr(JITCompiler::Address(op1GPR, JSWrapperObject::internalValueCellOffset()), resultGPR); 9491 9492 9486 JITCompiler::Jump done = m_jit.jump(); 9487 9493 9488 isString.link(&m_jit); 9494 9489 m_jit.move(op1GPR, resultGPR); … … 10193 10188 } 10194 10189 10195 void SpeculativeJIT::speculateStringObject(Edge edge, GPRReg gpr)10196 { 10197 speculateStringObjectForStructure(edge, JITCompiler::Address(gpr, JSCell::structureIDOffset()));10190 void SpeculativeJIT::speculateStringObject(Edge edge, GPRReg cellGPR) 10191 { 10192 DFG_TYPE_CHECK(JSValueSource::unboxedCell(cellGPR), edge, ~SpecCellCheck | SpecStringObject, m_jit.branchIfNotType(cellGPR, StringObjectType)); 10198 10193 } 10199 10194 … … 10205 10200 SpeculateCellOperand operand(this, edge); 10206 10201 GPRReg gpr = operand.gpr(); 10207 if (!needsTypeCheck(edge, SpecStringObject))10208 return;10209 10210 10202 speculateStringObject(edge, gpr); 10211 m_interpreter.filter(edge, SpecStringObject);10212 10203 } 10213 10204 … … 10222 10213 return; 10223 10214 10224 GPRTemporary structureID(this); 10225 GPRReg structureIDGPR = structureID.gpr(); 10226 10227 m_jit.load32(JITCompiler::Address(gpr, JSCell::structureIDOffset()), structureIDGPR); 10228 JITCompiler::Jump isString = m_jit.branchWeakStructure( 10229 JITCompiler::Equal, 10230 structureIDGPR, 10231 m_jit.graph().registerStructure(m_jit.vm()->stringStructure.get())); 10232 10233 speculateStringObjectForStructure(edge, structureIDGPR); 10234 10215 GPRTemporary typeTemp(this); 10216 GPRReg typeGPR = typeTemp.gpr(); 10217 10218 m_jit.load8(JITCompiler::Address(gpr, JSCell::typeInfoTypeOffset()), typeGPR); 10219 10220 JITCompiler::Jump isString = m_jit.branch32(JITCompiler::Equal, typeGPR, TrustedImm32(StringType)); 10221 speculationCheck(BadType, JSValueSource::unboxedCell(gpr), edge.node(), m_jit.branch32(JITCompiler::NotEqual, typeGPR, TrustedImm32(StringObjectType))); 10235 10222 isString.link(&m_jit); 10236 10223 -
trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.h
r239612 r240114 1632 1632 void speculateNotStringVar(Edge); 1633 1633 void speculateNotSymbol(Edge); 1634 template<typename StructureLocationType>1635 void speculateStringObjectForStructure(Edge, StructureLocationType);1636 1634 void speculateStringObject(Edge, GPRReg); 1637 1635 void speculateStringObject(Edge); … … 2605 2603 }; 2606 2604 2607 template<typename StructureLocationType>2608 void SpeculativeJIT::speculateStringObjectForStructure(Edge edge, StructureLocationType structureLocation)2609 {2610 RegisteredStructure stringObjectStructure =2611 m_jit.graph().registerStructure(m_jit.globalObjectFor(m_currentNode->origin.semantic)->stringObjectStructure());2612 2613 if (!m_state.forNode(edge).m_structure.isSubsetOf(RegisteredStructureSet(stringObjectStructure))) {2614 speculationCheck(2615 NotStringObject, JSValueRegs(), 0,2616 m_jit.branchWeakStructure(2617 JITCompiler::NotEqual, structureLocation, stringObjectStructure));2618 }2619 }2620 2621 2605 #define DFG_TYPE_CHECK_WITH_EXIT_KIND(exitKind, source, edge, typesPassedThrough, jumpToFail) do { \ 2622 2606 JSValueSource _dtc_source = (source); \ -
trunk/Source/JavaScriptCore/dfg/DFGUseKind.h
r238297 r240114 269 269 } 270 270 271 // Returns true if it uses structure in a way that could be clobbered by272 // things that change the structure.273 inline bool usesStructure(UseKind kind)274 {275 switch (kind) {276 case StringObjectUse:277 case StringOrStringObjectUse:278 return true;279 default:280 return false;281 }282 }283 284 271 // Returns true if we've already guaranteed the type 285 272 inline bool alreadyChecked(UseKind kind, SpeculatedType type) 286 273 { 287 // If the check involves the structure then we need to know more than just the type to be sure288 // that the check is done.289 if (usesStructure(kind))290 return false;291 292 274 return !(type & ~typeFilterFor(kind)); 293 275 } -
trunk/Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp
r240024 r240114 6327 6327 LValue cell = lowCell(m_node->child1()); 6328 6328 speculateStringObjectForCell(m_node->child1(), cell); 6329 m_interpreter.filter(m_node->child1(), SpecStringObject);6330 6331 6329 setJSValue(m_out.loadPtr(cell, m_heaps.JSWrapperObject_internalValue)); 6332 6330 return; … … 6335 6333 case StringOrStringObjectUse: { 6336 6334 LValue cell = lowCell(m_node->child1()); 6337 LValue structureID = m_out.load32(cell, m_heaps.JSCell_structureID);6335 LValue type = m_out.load8ZeroExt32(cell, m_heaps.JSCell_typeInfoType); 6338 6336 6339 6337 LBasicBlock notString = m_out.newBlock(); … … 6342 6340 ValueFromBlock simpleResult = m_out.anchor(cell); 6343 6341 m_out.branch( 6344 m_out.equal( structureID, m_out.constInt32(vm().stringStructure->id())),6342 m_out.equal(type, m_out.constInt32(StringType)), 6345 6343 unsure(continuation), unsure(notString)); 6346 6344 6347 6345 LBasicBlock lastNext = m_out.appendTo(notString, continuation); 6348 speculateStringObjectForStructureID(m_node->child1(), structureID); 6346 speculate( 6347 BadType, jsValueValue(cell), m_node->child1().node(), 6348 m_out.notEqual(type, m_out.constInt32(StringObjectType))); 6349 6349 ValueFromBlock unboxedResult = m_out.anchor( 6350 6350 m_out.loadPtr(cell, m_heaps.JSWrapperObject_internalValue)); … … 16052 16052 16053 16053 speculateStringObjectForCell(edge, lowCell(edge)); 16054 m_interpreter.filter(edge, SpecStringObject);16055 16054 } 16056 16055 16057 16056 void speculateStringOrStringObject(Edge edge) 16058 16057 { 16058 if (!m_interpreter.needsTypeCheck(edge, SpecString | SpecStringObject)) 16059 return; 16060 16061 LValue cellBase = lowCell(edge); 16059 16062 if (!m_interpreter.needsTypeCheck(edge, SpecString | SpecStringObject)) 16060 16063 return; … … 16063 16066 LBasicBlock continuation = m_out.newBlock(); 16064 16067 16065 LValue structureID = m_out.load32(lowCell(edge), m_heaps.JSCell_structureID);16068 LValue type = m_out.load8ZeroExt32(cellBase, m_heaps.JSCell_typeInfoType); 16066 16069 m_out.branch( 16067 m_out.equal( structureID, m_out.constInt32(vm().stringStructure->id())),16070 m_out.equal(type, m_out.constInt32(StringType)), 16068 16071 unsure(continuation), unsure(notString)); 16069 16072 16070 16073 LBasicBlock lastNext = m_out.appendTo(notString, continuation); 16071 speculateStringObjectForStructureID(edge, structureID); 16074 speculate( 16075 BadType, jsValueValue(cellBase), edge.node(), 16076 m_out.notEqual(type, m_out.constInt32(StringObjectType))); 16072 16077 m_out.jump(continuation); 16073 16078 16074 16079 m_out.appendTo(continuation, lastNext); 16075 16076 16080 m_interpreter.filter(edge, SpecString | SpecStringObject); 16077 16081 } … … 16079 16083 void speculateStringObjectForCell(Edge edge, LValue cell) 16080 16084 { 16081 speculateStringObjectForStructureID(edge, m_out.load32(cell, m_heaps.JSCell_structureID)); 16082 } 16083 16084 void speculateStringObjectForStructureID(Edge edge, LValue structureID) 16085 { 16086 RegisteredStructure stringObjectStructure = 16087 m_graph.registerStructure(m_graph.globalObjectFor(m_node->origin.semantic)->stringObjectStructure()); 16088 16089 if (abstractStructure(edge).isSubsetOf(RegisteredStructureSet(stringObjectStructure))) 16090 return; 16091 16092 speculate( 16093 NotStringObject, noValue(), 0, 16094 m_out.notEqual(structureID, weakStructureID(stringObjectStructure))); 16095 } 16096 16085 if (!m_interpreter.needsTypeCheck(edge, SpecStringObject)) 16086 return; 16087 16088 LValue type = m_out.load8ZeroExt32(cell, m_heaps.JSCell_typeInfoType); 16089 FTL_TYPE_CHECK(jsValueValue(cell), edge, SpecStringObject, m_out.notEqual(type, m_out.constInt32(StringObjectType))); 16090 } 16091 16097 16092 void speculateSymbol(Edge edge, LValue cell) 16098 16093 { -
trunk/Source/JavaScriptCore/runtime/JSType.cpp
r237547 r240114 101 101 CASE(JSWeakSetType) 102 102 CASE(WebAssemblyToJSCalleeType) 103 CASE(StringObjectType) 103 104 CASE(MaxJSType) 104 105 } -
trunk/Source/JavaScriptCore/runtime/JSType.h
r239951 r240114 111 111 JSWeakMapType, 112 112 JSWeakSetType, 113 WebAssemblyToJSCalleeType, 114 StringObjectType, 113 115 114 WebAssemblyToJSCalleeType, 115 116 LastJSCObjectType = WebAssemblyToJSCalleeType, // This is the last "JSC" Object type. After this, we have embedder's (e.g., WebCore) extended object types. 116 LastJSCObjectType = StringObjectType, // This is the last "JSC" Object type. After this, we have embedder's (e.g., WebCore) extended object types. 117 117 MaxJSType = 0b11111111, 118 118 }; -
trunk/Source/JavaScriptCore/runtime/StringObject.h
r229410 r240114 64 64 static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue prototype) 65 65 { 66 return Structure::create(vm, globalObject, prototype, TypeInfo( ObjectType, StructureFlags), info());66 return Structure::create(vm, globalObject, prototype, TypeInfo(StringObjectType, StructureFlags), info()); 67 67 } 68 68 -
trunk/Source/JavaScriptCore/runtime/StringPrototype.h
r239191 r240114 42 42 static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue prototype) 43 43 { 44 return Structure::create(vm, globalObject, prototype, TypeInfo( ObjectType, StructureFlags), info());44 return Structure::create(vm, globalObject, prototype, TypeInfo(StringObjectType, StructureFlags), info()); 45 45 } 46 46
Note: See TracChangeset
for help on using the changeset viewer.