Changeset 96461 in webkit
- Timestamp:
- Oct 1, 2011 2:46:51 PM (13 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r96458 r96461 1 2011-10-01 Oliver Hunt <oliver@apple.com> 2 3 Support string length in the DFG 4 https://bugs.webkit.org/show_bug.cgi?id=69215 5 6 Reviewed by Geoff Garen. 7 8 Adds a GetStringLength node to the DFG so that we can support 9 string.length inline. 10 11 * dfg/DFGNode.h: 12 * dfg/DFGPropagator.cpp: 13 (JSC::DFG::Propagator::propagateNodePredictions): 14 (JSC::DFG::Propagator::fixupNode): 15 (JSC::DFG::Propagator::performNodeCSE): 16 * dfg/DFGSpeculativeJIT.h: 17 (JSC::DFG::SpeculativeJIT::isKnownString): 18 * dfg/DFGSpeculativeJIT32_64.cpp: 19 (JSC::DFG::SpeculativeJIT::compile): 20 * dfg/DFGSpeculativeJIT64.cpp: 21 (JSC::DFG::SpeculativeJIT::compile): 22 * runtime/JSString.h: 23 (JSC::JSString::offsetOfLength): 24 1 25 2011-10-01 Yuqiang Xian <yuqiang.xian@intel.com> 2 26 -
trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
r96379 r96461 1071 1071 86880F1A14328BB900B08D42 /* DFGJITCompilerInlineMethods.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DFGJITCompilerInlineMethods.h; path = dfg/DFGJITCompilerInlineMethods.h; sourceTree = "<group>"; }; 1072 1072 86880F1B14328BB900B08D42 /* DFGSpeculativeJIT32_64.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DFGSpeculativeJIT32_64.cpp; path = dfg/DFGSpeculativeJIT32_64.cpp; sourceTree = "<group>"; }; 1073 86880F311434FFAF00B08D42 /* ChangeLog */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ChangeLog; sourceTree = "<group>"; };1074 1073 86880F43143531A700B08D42 /* DFGJITCodeGenerator64.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DFGJITCodeGenerator64.cpp; path = dfg/DFGJITCodeGenerator64.cpp; sourceTree = "<group>"; }; 1075 1074 86880F4C14353B2100B08D42 /* DFGSpeculativeJIT64.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DFGSpeculativeJIT64.cpp; path = dfg/DFGSpeculativeJIT64.cpp; sourceTree = "<group>"; }; … … 1543 1542 isa = PBXGroup; 1544 1543 children = ( 1545 86880F311434FFAF00B08D42 /* ChangeLog */,1546 1544 651122E5140469BA002B101D /* testRegExp.cpp */, 1547 1545 A718F8211178EB4B002465A7 /* create_regex_tables */, -
trunk/Source/JavaScriptCore/dfg/DFGNode.h
r96443 r96461 320 320 macro(PutByOffset, NodeMustGenerate | NodeClobbersWorld) \ 321 321 macro(GetArrayLength, NodeResultInt32) \ 322 macro(GetStringLength, NodeResultInt32) \ 322 323 macro(GetMethod, NodeResultJS | NodeMustGenerate) \ 323 324 macro(CheckMethod, NodeResultJS | NodeMustGenerate) \ -
trunk/Source/JavaScriptCore/dfg/DFGPropagator.cpp
r96443 r96461 560 560 561 561 case ValueToDouble: 562 case GetArrayLength: { 562 case GetArrayLength: 563 case GetStringLength: { 563 564 // This node should never be visible at this stage of compilation. It is 564 565 // inserted by fixup(), which follows this phase. … … 707 708 708 709 case GetById: { 709 if (!isArrayPrediction(m_predictions[node.child1()])) 710 bool isArray = isArrayPrediction(m_predictions[node.child1()]); 711 bool isString = isStringPrediction(m_predictions[node.child1()]); 712 if (!isArray && !isString) 710 713 break; 711 714 if (!isInt32Prediction(m_predictions[m_compileIndex])) … … 715 718 716 719 #if ENABLE(DFG_DEBUG_PROPAGATION_VERBOSE) 717 printf(" @%u -> GetArrayLength", nodeIndex);718 #endif 719 node.op = GetArrayLength;720 printf(" @%u -> %s", nodeIndex, isArray ? "GetArrayLength" : "GetStringLength"); 721 #endif 722 node.op = isArray ? GetArrayLength : GetStringLength; 720 723 break; 721 724 } … … 1190 1193 case GetCallee: 1191 1194 case GetArrayLength: 1195 case GetStringLength: 1192 1196 setReplacement(pureCSE(node)); 1193 1197 break; -
trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.h
r96458 r96461 580 580 } 581 581 } 582 583 bool isKnownString(NodeIndex op1) 584 { 585 Node& node = m_jit.graph()[op1]; 586 switch (node.op) { 587 case GetLocal: 588 return isStringPrediction(node.variableAccessData()->prediction()); 589 590 default: 591 return false; 592 } 593 } 582 594 583 595 bool compare(Node&, MacroAssembler::RelationalCondition, MacroAssembler::DoubleCondition, Z_DFGOperation_EJJ); -
trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT32_64.cpp
r96443 r96461 1656 1656 } 1657 1657 1658 case GetStringLength: { 1659 SpeculateCellOperand base(this, node.child1()); 1660 GPRTemporary result(this); 1661 1662 GPRReg baseGPR = base.gpr(); 1663 GPRReg resultGPR = result.gpr(); 1664 1665 if (!isKnownString(node.child1())) 1666 speculationCheck(m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(baseGPR), MacroAssembler::TrustedImmPtr(m_jit.globalData()->jsStringVPtr))); 1667 1668 m_jit.load32(MacroAssembler::Address(baseGPR, JSString::offsetOfLength()), resultGPR); 1669 1670 integerResult(resultGPR, m_compileIndex); 1671 break; 1672 } 1673 1658 1674 case CheckStructure: { 1659 1675 SpeculateCellOperand base(this, node.child1()); -
trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp
r96443 r96461 1716 1716 } 1717 1717 1718 case GetStringLength: { 1719 SpeculateCellOperand base(this, node.child1()); 1720 GPRTemporary result(this); 1721 1722 GPRReg baseGPR = base.gpr(); 1723 GPRReg resultGPR = result.gpr(); 1724 1725 if (!isKnownString(node.child1())) 1726 speculationCheck(m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(baseGPR), MacroAssembler::TrustedImmPtr(m_jit.globalData()->jsStringVPtr))); 1727 1728 m_jit.load32(MacroAssembler::Address(baseGPR, JSString::offsetOfLength()), resultGPR); 1729 1730 integerResult(resultGPR, m_compileIndex); 1731 break; 1732 } 1733 1718 1734 case CheckStructure: { 1719 1735 SpeculateCellOperand base(this, node.child1()); -
trunk/Source/JavaScriptCore/runtime/JSString.h
r96381 r96461 446 446 return Structure::create(globalData, globalObject, proto, TypeInfo(StringType, OverridesGetOwnPropertySlot), &s_info); 447 447 } 448 448 449 static size_t offsetOfLength() { return OBJECT_OFFSETOF(JSString, m_length); } 450 449 451 static const ClassInfo s_info; 450 452
Note: See TracChangeset
for help on using the changeset viewer.