Changeset 156019 in webkit for trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.h
- Timestamp:
- Sep 17, 2013, 6:31:04 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.h
r155783 r156019 160 160 bool canReuse(Node* node) 161 161 { 162 VirtualRegister virtualRegister = node->virtualRegister(); 163 GenerationInfo& info = generationInfoFromVirtualRegister(virtualRegister); 164 return info.canReuse(); 162 return generationInfo(node).canReuse(); 165 163 } 166 164 bool canReuse(Edge nodeUse) … … 238 236 bool isFilled(Node* node) 239 237 { 240 VirtualRegister virtualRegister = node->virtualRegister(); 241 GenerationInfo& info = generationInfoFromVirtualRegister(virtualRegister); 242 return info.registerFormat() != DataFormatNone; 238 return generationInfo(node).registerFormat() != DataFormatNone; 243 239 } 244 240 bool isFilledDouble(Node* node) 245 241 { 246 VirtualRegister virtualRegister = node->virtualRegister(); 247 GenerationInfo& info = generationInfoFromVirtualRegister(virtualRegister); 248 return info.registerFormat() == DataFormatDouble; 242 return generationInfo(node).registerFormat() == DataFormatDouble; 249 243 } 250 244 … … 254 248 if (!node->hasResult()) 255 249 return; 256 VirtualRegister virtualRegister = node->virtualRegister(); 257 GenerationInfo& info = generationInfoFromVirtualRegister(virtualRegister); 250 GenerationInfo& info = generationInfo(node); 258 251 259 252 // use() returns true when the value becomes dead, and any … … 334 327 GPRReg fillSpeculateInt32(Edge, DataFormat& returnFormat); 335 328 GPRReg fillSpeculateInt32Strict(Edge); 329 GPRReg fillSpeculateInt52(Edge, DataFormat desiredFormat); 336 330 FPRReg fillSpeculateDouble(Edge); 337 331 GPRReg fillSpeculateCell(Edge); … … 469 463 return boxDouble(fpr, allocate()); 470 464 } 465 466 void boxInt52(GPRReg sourceGPR, GPRReg targetGPR, DataFormat); 471 467 #elif USE(JSVALUE32_64) 472 468 void boxDouble(FPRReg fpr, GPRReg tagGPR, GPRReg payloadGPR) … … 560 556 } 561 557 562 bool isKnownInteger(Node* node) { return !(m_state.forNode(node).m_type & ~SpecInt32); }563 bool isKnownCell(Node* node) { return !(m_state.forNode(node).m_type & ~SpecCell); }558 bool isKnownInteger(Node* node) { return m_state.forNode(node).isType(SpecInt32); } 559 bool isKnownCell(Node* node) { return m_state.forNode(node).isType(SpecCell); } 564 560 565 561 bool isKnownNotInteger(Node* node) { return !(m_state.forNode(node).m_type & SpecInt32); } 566 bool isKnownNotNumber(Node* node) { return !(m_state.forNode(node).m_type & Spec Number); }562 bool isKnownNotNumber(Node* node) { return !(m_state.forNode(node).m_type & SpecFullNumber); } 567 563 bool isKnownNotCell(Node* node) { return !(m_state.forNode(node).m_type & SpecCell); } 568 564 … … 817 813 int32Result(reg, node, DataFormatInt32, mode); 818 814 } 815 void int52Result(GPRReg reg, Node* node, DataFormat format, UseChildrenMode mode = CallUseChildren) 816 { 817 if (mode == CallUseChildren) 818 useChildren(node); 819 820 VirtualRegister virtualRegister = node->virtualRegister(); 821 GenerationInfo& info = generationInfoFromVirtualRegister(virtualRegister); 822 823 m_gprs.retain(reg, virtualRegister, SpillOrderJS); 824 info.initInt52(node, node->refCount(), reg, format); 825 } 826 void int52Result(GPRReg reg, Node* node, UseChildrenMode mode = CallUseChildren) 827 { 828 int52Result(reg, node, DataFormatInt52, mode); 829 } 830 void strictInt52Result(GPRReg reg, Node* node, UseChildrenMode mode = CallUseChildren) 831 { 832 int52Result(reg, node, DataFormatStrictInt52, mode); 833 } 819 834 void noResult(Node* node, UseChildrenMode mode = CallUseChildren) 820 835 { … … 901 916 { 902 917 ASSERT(isInt32Constant(node) || isNumberConstant(node) || isJSConstant(node)); 903 generationInfo FromVirtualRegister(node->virtualRegister()).initConstant(node, node->refCount());918 generationInfo(node).initConstant(node, node->refCount()); 904 919 } 905 920 … … 1890 1905 return true; 1891 1906 1892 VirtualRegister virtualRegister = node->virtualRegister(); 1893 GenerationInfo& info = generationInfoFromVirtualRegister(virtualRegister); 1894 1895 return info.isJSInt32(); 1907 return generationInfo(node).isJSInt32(); 1908 } 1909 1910 bool betterUseStrictInt52(Node* node) 1911 { 1912 return !generationInfo(node).isInt52(); 1913 } 1914 bool betterUseStrictInt52(Edge edge) 1915 { 1916 return betterUseStrictInt52(edge.node()); 1896 1917 } 1897 1918 … … 1899 1920 bool compilePeepHoleBranch(Node*, MacroAssembler::RelationalCondition, MacroAssembler::DoubleCondition, S_DFGOperation_EJJ); 1900 1921 void compilePeepHoleInt32Branch(Node*, Node* branchNode, JITCompiler::RelationalCondition); 1922 void compilePeepHoleInt52Branch(Node*, Node* branchNode, JITCompiler::RelationalCondition); 1901 1923 void compilePeepHoleBooleanBranch(Node*, Node* branchNode, JITCompiler::RelationalCondition); 1902 1924 void compilePeepHoleDoubleBranch(Node*, Node* branchNode, JITCompiler::DoubleCondition); … … 1946 1968 1947 1969 void compileInt32Compare(Node*, MacroAssembler::RelationalCondition); 1970 void compileInt52Compare(Node*, MacroAssembler::RelationalCondition); 1948 1971 void compileBooleanCompare(Node*, MacroAssembler::RelationalCondition); 1949 1972 void compileDoubleCompare(Node*, MacroAssembler::DoubleCondition); … … 2119 2142 2120 2143 void speculateInt32(Edge); 2144 void speculateMachineInt(Edge); 2121 2145 void speculateNumber(Edge); 2122 2146 void speculateRealNumber(Edge); … … 2196 2220 return m_generationInfo[operandToLocal(virtualRegister)]; 2197 2221 } 2222 2223 GenerationInfo& generationInfo(Node* node) 2224 { 2225 return generationInfoFromVirtualRegister(node->virtualRegister()); 2226 } 2227 2228 GenerationInfo& generationInfo(Edge edge) 2229 { 2230 return generationInfo(edge.node()); 2231 } 2198 2232 2199 2233 // The JIT, while also provides MacroAssembler functionality. … … 2677 2711 }; 2678 2712 2713 // Gives you a canonical Int52 (i.e. it's left-shifted by 16, low bits zero). 2714 class SpeculateInt52Operand { 2715 public: 2716 explicit SpeculateInt52Operand(SpeculativeJIT* jit, Edge edge, OperandSpeculationMode mode = AutomaticOperandSpeculation) 2717 : m_jit(jit) 2718 , m_edge(edge) 2719 , m_gprOrInvalid(InvalidGPRReg) 2720 { 2721 ASSERT_UNUSED(mode, mode == ManualOperandSpeculation || edge.useKind() == MachineIntUse); 2722 if (jit->isFilled(node())) 2723 gpr(); 2724 } 2725 2726 ~SpeculateInt52Operand() 2727 { 2728 ASSERT(m_gprOrInvalid != InvalidGPRReg); 2729 m_jit->unlock(m_gprOrInvalid); 2730 } 2731 2732 Edge edge() const 2733 { 2734 return m_edge; 2735 } 2736 2737 Node* node() const 2738 { 2739 return edge().node(); 2740 } 2741 2742 GPRReg gpr() 2743 { 2744 if (m_gprOrInvalid == InvalidGPRReg) 2745 m_gprOrInvalid = m_jit->fillSpeculateInt52(edge(), DataFormatInt52); 2746 return m_gprOrInvalid; 2747 } 2748 2749 void use() 2750 { 2751 m_jit->use(node()); 2752 } 2753 2754 private: 2755 SpeculativeJIT* m_jit; 2756 Edge m_edge; 2757 GPRReg m_gprOrInvalid; 2758 }; 2759 2760 // Gives you a strict Int52 (i.e. the payload is in the low 48 bits, high 16 bits are sign-extended). 2761 class SpeculateStrictInt52Operand { 2762 public: 2763 explicit SpeculateStrictInt52Operand(SpeculativeJIT* jit, Edge edge, OperandSpeculationMode mode = AutomaticOperandSpeculation) 2764 : m_jit(jit) 2765 , m_edge(edge) 2766 , m_gprOrInvalid(InvalidGPRReg) 2767 { 2768 ASSERT_UNUSED(mode, mode == ManualOperandSpeculation || edge.useKind() == MachineIntUse); 2769 if (jit->isFilled(node())) 2770 gpr(); 2771 } 2772 2773 ~SpeculateStrictInt52Operand() 2774 { 2775 ASSERT(m_gprOrInvalid != InvalidGPRReg); 2776 m_jit->unlock(m_gprOrInvalid); 2777 } 2778 2779 Edge edge() const 2780 { 2781 return m_edge; 2782 } 2783 2784 Node* node() const 2785 { 2786 return edge().node(); 2787 } 2788 2789 GPRReg gpr() 2790 { 2791 if (m_gprOrInvalid == InvalidGPRReg) 2792 m_gprOrInvalid = m_jit->fillSpeculateInt52(edge(), DataFormatStrictInt52); 2793 return m_gprOrInvalid; 2794 } 2795 2796 void use() 2797 { 2798 m_jit->use(node()); 2799 } 2800 2801 private: 2802 SpeculativeJIT* m_jit; 2803 Edge m_edge; 2804 GPRReg m_gprOrInvalid; 2805 }; 2806 2807 enum OppositeShiftTag { OppositeShift }; 2808 2809 class SpeculateWhicheverInt52Operand { 2810 public: 2811 explicit SpeculateWhicheverInt52Operand(SpeculativeJIT* jit, Edge edge, OperandSpeculationMode mode = AutomaticOperandSpeculation) 2812 : m_jit(jit) 2813 , m_edge(edge) 2814 , m_gprOrInvalid(InvalidGPRReg) 2815 , m_strict(jit->betterUseStrictInt52(edge)) 2816 { 2817 ASSERT_UNUSED(mode, mode == ManualOperandSpeculation || edge.useKind() == MachineIntUse); 2818 if (jit->isFilled(node())) 2819 gpr(); 2820 } 2821 2822 explicit SpeculateWhicheverInt52Operand(SpeculativeJIT* jit, Edge edge, const SpeculateWhicheverInt52Operand& other, OperandSpeculationMode mode = AutomaticOperandSpeculation) 2823 : m_jit(jit) 2824 , m_edge(edge) 2825 , m_gprOrInvalid(InvalidGPRReg) 2826 , m_strict(other.m_strict) 2827 { 2828 ASSERT_UNUSED(mode, mode == ManualOperandSpeculation || edge.useKind() == MachineIntUse); 2829 if (jit->isFilled(node())) 2830 gpr(); 2831 } 2832 2833 explicit SpeculateWhicheverInt52Operand(SpeculativeJIT* jit, Edge edge, OppositeShiftTag, const SpeculateWhicheverInt52Operand& other, OperandSpeculationMode mode = AutomaticOperandSpeculation) 2834 : m_jit(jit) 2835 , m_edge(edge) 2836 , m_gprOrInvalid(InvalidGPRReg) 2837 , m_strict(!other.m_strict) 2838 { 2839 ASSERT_UNUSED(mode, mode == ManualOperandSpeculation || edge.useKind() == MachineIntUse); 2840 if (jit->isFilled(node())) 2841 gpr(); 2842 } 2843 2844 ~SpeculateWhicheverInt52Operand() 2845 { 2846 ASSERT(m_gprOrInvalid != InvalidGPRReg); 2847 m_jit->unlock(m_gprOrInvalid); 2848 } 2849 2850 Edge edge() const 2851 { 2852 return m_edge; 2853 } 2854 2855 Node* node() const 2856 { 2857 return edge().node(); 2858 } 2859 2860 GPRReg gpr() 2861 { 2862 if (m_gprOrInvalid == InvalidGPRReg) { 2863 m_gprOrInvalid = m_jit->fillSpeculateInt52( 2864 edge(), m_strict ? DataFormatStrictInt52 : DataFormatInt52); 2865 } 2866 return m_gprOrInvalid; 2867 } 2868 2869 void use() 2870 { 2871 m_jit->use(node()); 2872 } 2873 2874 DataFormat format() const 2875 { 2876 return m_strict ? DataFormatStrictInt52 : DataFormatInt52; 2877 } 2878 2879 private: 2880 SpeculativeJIT* m_jit; 2881 Edge m_edge; 2882 GPRReg m_gprOrInvalid; 2883 bool m_strict; 2884 }; 2885 2679 2886 class SpeculateDoubleOperand { 2680 2887 public:
Note:
See TracChangeset
for help on using the changeset viewer.