Changeset 223523 in webkit for trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp
- Timestamp:
- Oct 17, 2017, 5:02:01 AM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp
r223318 r223523 9187 9187 } 9188 9188 9189 void SpeculativeJIT::speculateFunction(Edge edge, GPRReg cell) 9190 { 9191 speculateCellType(edge, cell, SpecFunction, JSFunctionType); 9192 } 9193 9189 9194 void SpeculativeJIT::speculateFunction(Edge edge) 9190 9195 { … … 9193 9198 9194 9199 SpeculateCellOperand operand(this, edge); 9195 speculateCellType(edge, operand.gpr(), SpecFunction, JSFunctionType); 9200 speculateFunction(edge, operand.gpr()); 9201 } 9202 9203 void SpeculativeJIT::speculateFinalObject(Edge edge, GPRReg cell) 9204 { 9205 speculateCellType(edge, cell, SpecFinalObject, FinalObjectType); 9196 9206 } 9197 9207 … … 9202 9212 9203 9213 SpeculateCellOperand operand(this, edge); 9204 speculate CellType(edge, operand.gpr(), SpecFinalObject, FinalObjectType);9214 speculateFinalObject(edge, operand.gpr()); 9205 9215 } 9206 9216 … … 10768 10778 } 10769 10779 10780 void SpeculativeJIT::compileGetPrototypeOf(Node* node) 10781 { 10782 switch (node->child1().useKind()) { 10783 case ArrayUse: 10784 case FunctionUse: 10785 case FinalObjectUse: { 10786 SpeculateCellOperand object(this, node->child1()); 10787 GPRTemporary temp(this); 10788 GPRTemporary temp2(this); 10789 10790 GPRReg objectGPR = object.gpr(); 10791 GPRReg tempGPR = temp.gpr(); 10792 GPRReg temp2GPR = temp2.gpr(); 10793 10794 switch (node->child1().useKind()) { 10795 case ArrayUse: 10796 speculateArray(node->child1(), objectGPR); 10797 break; 10798 case FunctionUse: 10799 speculateFunction(node->child1(), objectGPR); 10800 break; 10801 case FinalObjectUse: 10802 speculateFinalObject(node->child1(), objectGPR); 10803 break; 10804 default: 10805 RELEASE_ASSERT_NOT_REACHED(); 10806 break; 10807 } 10808 10809 m_jit.emitLoadStructure(*m_jit.vm(), objectGPR, tempGPR, temp2GPR); 10810 10811 AbstractValue& value = m_state.forNode(node->child1()); 10812 if ((value.m_type && !(value.m_type & ~SpecObject)) && value.m_structure.isFinite()) { 10813 bool hasPolyProto = false; 10814 bool hasMonoProto = false; 10815 value.m_structure.forEach([&] (RegisteredStructure structure) { 10816 if (structure->hasPolyProto()) 10817 hasPolyProto = true; 10818 else 10819 hasMonoProto = true; 10820 }); 10821 10822 if (hasMonoProto && !hasPolyProto) { 10823 #if USE(JSVALUE64) 10824 m_jit.load64(MacroAssembler::Address(tempGPR, Structure::prototypeOffset()), tempGPR); 10825 jsValueResult(tempGPR, node); 10826 #else 10827 m_jit.load32(MacroAssembler::Address(tempGPR, Structure::prototypeOffset() + TagOffset), temp2GPR); 10828 m_jit.load32(MacroAssembler::Address(tempGPR, Structure::prototypeOffset() + PayloadOffset), tempGPR); 10829 jsValueResult(temp2GPR, tempGPR, node); 10830 #endif 10831 return; 10832 } 10833 10834 if (hasPolyProto && !hasMonoProto) { 10835 #if USE(JSVALUE64) 10836 m_jit.load64(MacroAssembler::Address(tempGPR, Structure::prototypeOffset()), tempGPR); 10837 m_jit.zeroExtend32ToPtr(tempGPR, tempGPR); 10838 m_jit.load64(JITCompiler::BaseIndex(objectGPR, tempGPR, JITCompiler::TimesEight, JSObject::offsetOfInlineStorage()), tempGPR); 10839 jsValueResult(tempGPR, node); 10840 #else 10841 m_jit.load32(MacroAssembler::Address(tempGPR, Structure::prototypeOffset() + PayloadOffset), tempGPR); 10842 m_jit.load32(JITCompiler::BaseIndex(objectGPR, tempGPR, JITCompiler::TimesEight, JSObject::offsetOfInlineStorage() + TagOffset), temp2GPR); 10843 m_jit.load32(JITCompiler::BaseIndex(objectGPR, tempGPR, JITCompiler::TimesEight, JSObject::offsetOfInlineStorage() + PayloadOffset), tempGPR); 10844 jsValueResult(temp2GPR, tempGPR, node); 10845 #endif 10846 return; 10847 } 10848 } 10849 10850 #if USE(JSVALUE64) 10851 m_jit.load64(MacroAssembler::Address(tempGPR, Structure::prototypeOffset()), tempGPR); 10852 auto isMonoProto = m_jit.branchIfNotInt32(JSValueRegs(tempGPR)); 10853 m_jit.zeroExtend32ToPtr(tempGPR, tempGPR); 10854 m_jit.load64(JITCompiler::BaseIndex(objectGPR, tempGPR, JITCompiler::TimesEight, JSObject::offsetOfInlineStorage()), tempGPR); 10855 isMonoProto.link(&m_jit); 10856 jsValueResult(tempGPR, node); 10857 #else 10858 m_jit.load32(MacroAssembler::Address(tempGPR, Structure::prototypeOffset() + TagOffset), temp2GPR); 10859 m_jit.load32(MacroAssembler::Address(tempGPR, Structure::prototypeOffset() + PayloadOffset), tempGPR); 10860 auto isMonoProto = m_jit.branch32(CCallHelpers::NotEqual, temp2GPR, TrustedImm32(JSValue::Int32Tag)); 10861 m_jit.load32(JITCompiler::BaseIndex(objectGPR, tempGPR, JITCompiler::TimesEight, JSObject::offsetOfInlineStorage() + TagOffset), temp2GPR); 10862 m_jit.load32(JITCompiler::BaseIndex(objectGPR, tempGPR, JITCompiler::TimesEight, JSObject::offsetOfInlineStorage() + PayloadOffset), tempGPR); 10863 isMonoProto.link(&m_jit); 10864 jsValueResult(temp2GPR, tempGPR, node); 10865 #endif 10866 return; 10867 } 10868 case ObjectUse: { 10869 SpeculateCellOperand value(this, node->child1()); 10870 JSValueRegsTemporary result(this); 10871 10872 GPRReg valueGPR = value.gpr(); 10873 JSValueRegs resultRegs = result.regs(); 10874 10875 speculateObject(node->child1(), valueGPR); 10876 10877 flushRegisters(); 10878 callOperation(operationGetPrototypeOfObject, resultRegs, valueGPR); 10879 m_jit.exceptionCheck(); 10880 jsValueResult(resultRegs, node); 10881 return; 10882 } 10883 default: { 10884 JSValueOperand value(this, node->child1()); 10885 JSValueRegsTemporary result(this); 10886 10887 JSValueRegs valueRegs = value.jsValueRegs(); 10888 JSValueRegs resultRegs = result.regs(); 10889 10890 flushRegisters(); 10891 callOperation(operationGetPrototypeOf, resultRegs, valueRegs); 10892 m_jit.exceptionCheck(); 10893 jsValueResult(resultRegs, node); 10894 return; 10895 } 10896 } 10897 } 10898 10770 10899 } } // namespace JSC::DFG 10771 10900
Note:
See TracChangeset
for help on using the changeset viewer.