Changeset 184076 in webkit
- Timestamp:
- May 11, 2015, 4:04:08 AM (11 years ago)
- Location:
- releases/WebKitGTK/webkit-2.8/Source/JavaScriptCore
- Files:
-
- 3 edited
-
ChangeLog (modified) (1 diff)
-
dfg/DFGSpeculativeJIT32_64.cpp (modified) (8 diffs)
-
dfg/DFGSpeculativeJIT64.cpp (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
-
releases/WebKitGTK/webkit-2.8/Source/JavaScriptCore/ChangeLog
r182723 r184076 1 2015-04-14 Michael Saboff <msaboff@apple.com> 2 3 DFG register fillSpeculate*() functions should validate incoming spill format is compatible with requested fill format 4 https://bugs.webkit.org/show_bug.cgi?id=143727 5 6 Reviewed by Geoffrey Garen. 7 8 Used the result of AbstractInterpreter<>::filter() to check that the current spill format is compatible 9 with the requested fill format. If filter() reports a contradiction, then we force an OSR exit. 10 Removed individual checks made redundant by the new check. 11 12 * dfg/DFGSpeculativeJIT32_64.cpp: 13 (JSC::DFG::SpeculativeJIT::fillSpeculateInt32Internal): 14 (JSC::DFG::SpeculativeJIT::fillSpeculateCell): 15 (JSC::DFG::SpeculativeJIT::fillSpeculateBoolean): 16 * dfg/DFGSpeculativeJIT64.cpp: 17 (JSC::DFG::SpeculativeJIT::fillSpeculateInt32Internal): 18 (JSC::DFG::SpeculativeJIT::fillSpeculateInt52): 19 (JSC::DFG::SpeculativeJIT::fillSpeculateCell): 20 (JSC::DFG::SpeculativeJIT::fillSpeculateBoolean): 21 1 22 2015-04-10 Csaba Osztrogonác <ossy@webkit.org> 2 23 -
releases/WebKitGTK/webkit-2.8/Source/JavaScriptCore/dfg/DFGSpeculativeJIT32_64.cpp
r182721 r184076 733 733 SpeculatedType type = value.m_type; 734 734 ASSERT(edge.useKind() != KnownInt32Use || !(value.m_type & ~SpecInt32)); 735 m_interpreter.filter(value, SpecInt32); 736 VirtualRegister virtualRegister = edge->virtualRegister(); 737 GenerationInfo& info = generationInfoFromVirtualRegister(virtualRegister); 738 739 if (edge->hasConstant() && !edge->isInt32Constant()) { 735 736 if (m_interpreter.filter(value, SpecInt32) == Contradiction) { 740 737 terminateSpeculativeExecution(Uncountable, JSValueRegs(), 0); 741 738 returnFormat = DataFormatInt32; 742 739 return allocate(); 743 740 } 744 741 742 VirtualRegister virtualRegister = edge->virtualRegister(); 743 GenerationInfo& info = generationInfoFromVirtualRegister(virtualRegister); 744 745 745 switch (info.registerFormat()) { 746 746 case DataFormatNone: { … … 756 756 757 757 DataFormat spillFormat = info.spillFormat(); 758 759 if (spillFormat == DataFormatCell) {760 terminateSpeculativeExecution(BadType, JSValueRegs(), edge);761 returnFormat = DataFormatInt32;762 return allocate();763 }764 758 765 759 ASSERT_UNUSED(spillFormat, (spillFormat & DataFormatJS) || spillFormat == DataFormatInt32); … … 808 802 case DataFormatJSCell: 809 803 case DataFormatJSBoolean: 810 terminateSpeculativeExecution(Uncountable, JSValueRegs(), 0);811 returnFormat = DataFormatInt32;812 return allocate();813 814 804 case DataFormatDouble: 815 805 case DataFormatStorage: … … 870 860 SpeculatedType type = value.m_type; 871 861 ASSERT((edge.useKind() != KnownCellUse && edge.useKind() != KnownStringUse) || !(value.m_type & ~SpecCell)); 872 m_interpreter.filter(value, SpecCell); 862 863 if (m_interpreter.filter(value, SpecCell) == Contradiction) { 864 terminateSpeculativeExecution(Uncountable, JSValueRegs(), 0); 865 return allocate(); 866 } 867 873 868 VirtualRegister virtualRegister = edge->virtualRegister(); 874 869 GenerationInfo& info = generationInfoFromVirtualRegister(virtualRegister); 875 876 if (edge->hasConstant() && !edge->isCellConstant()) {877 // Protect the silent spill/fill logic by failing early. If we "speculate" on878 // the constant then the silent filler may think that we have a cell and a879 // constant, so it will try to fill this as an cell constant. Bad things will880 // happen.881 terminateSpeculativeExecution(Uncountable, JSValueRegs(), 0);882 return allocate();883 }884 870 885 871 switch (info.registerFormat()) { 886 872 case DataFormatNone: { 887 if (info.spillFormat() == DataFormatInt32) {888 terminateSpeculativeExecution(Uncountable, JSValueRegs(), 0);889 return allocate();890 }891 892 873 if (edge->hasConstant()) { 893 874 JSValue jsValue = edge->asJSValue(); … … 947 928 case DataFormatJSBoolean: 948 929 case DataFormatBoolean: 949 terminateSpeculativeExecution(Uncountable, JSValueRegs(), 0);950 return allocate();951 952 930 case DataFormatDouble: 953 931 case DataFormatStorage: … … 964 942 AbstractValue& value = m_state.forNode(edge); 965 943 SpeculatedType type = value.m_type; 966 m_interpreter.filter(value, SpecBoolean); 944 945 if (m_interpreter.filter(value, SpecBoolean) == Contradiction) { 946 terminateSpeculativeExecution(Uncountable, JSValueRegs(), 0); 947 return allocate(); 948 } 949 967 950 VirtualRegister virtualRegister = edge->virtualRegister(); 968 951 GenerationInfo& info = generationInfoFromVirtualRegister(virtualRegister); … … 970 953 switch (info.registerFormat()) { 971 954 case DataFormatNone: { 972 if (info.spillFormat() == DataFormatInt32) {973 terminateSpeculativeExecution(Uncountable, JSValueRegs(), 0);974 return allocate();975 }976 977 955 if (edge->hasConstant()) { 978 956 JSValue jsValue = edge->asJSValue(); 979 957 GPRReg gpr = allocate(); 980 if (jsValue.isBoolean()) { 981 m_gprs.retain(gpr, virtualRegister, SpillOrderConstant); 982 m_jit.move(MacroAssembler::TrustedImm32(jsValue.asBoolean()), gpr); 983 info.fillBoolean(*m_stream, gpr); 984 return gpr; 985 } 986 terminateSpeculativeExecution(Uncountable, JSValueRegs(), 0); 958 m_gprs.retain(gpr, virtualRegister, SpillOrderConstant); 959 m_jit.move(MacroAssembler::TrustedImm32(jsValue.asBoolean()), gpr); 960 info.fillBoolean(*m_stream, gpr); 987 961 return gpr; 988 962 } … … 1028 1002 case DataFormatJSCell: 1029 1003 case DataFormatCell: 1030 terminateSpeculativeExecution(Uncountable, JSValueRegs(), 0);1031 return allocate();1032 1033 1004 case DataFormatDouble: 1034 1005 case DataFormatStorage: -
releases/WebKitGTK/webkit-2.8/Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp
r182711 r184076 709 709 SpeculatedType type = value.m_type; 710 710 ASSERT(edge.useKind() != KnownInt32Use || !(value.m_type & ~SpecInt32)); 711 m_interpreter.filter(value, SpecInt32); 712 VirtualRegister virtualRegister = edge->virtualRegister(); 713 GenerationInfo& info = generationInfoFromVirtualRegister(virtualRegister); 714 715 if (edge->hasConstant() && !edge->isInt32Constant()) { 716 // Protect the silent spill/fill logic by failing early. If we "speculate" on 717 // the constant then the silent filler may think that we have an int32 and a 718 // constant, so it will try to fill this as an int32 constant. Bad things will 719 // happen. 711 712 if (m_interpreter.filter(value, SpecInt32) == Contradiction) { 720 713 terminateSpeculativeExecution(Uncountable, JSValueRegs(), 0); 721 714 returnFormat = DataFormatInt32; 722 715 return allocate(); 723 716 } 724 717 718 VirtualRegister virtualRegister = edge->virtualRegister(); 719 GenerationInfo& info = generationInfoFromVirtualRegister(virtualRegister); 720 725 721 switch (info.registerFormat()) { 726 722 case DataFormatNone: { … … 821 817 case DataFormatBoolean: 822 818 case DataFormatJSCell: 823 case DataFormatJSBoolean: { 824 terminateSpeculativeExecution(Uncountable, JSValueRegs(), 0); 825 returnFormat = DataFormatInt32; 826 return allocate(); 827 } 828 819 case DataFormatJSBoolean: 829 820 case DataFormatDouble: 830 821 case DataFormatStorage: … … 859 850 ASSERT(desiredFormat == DataFormatInt52 || desiredFormat == DataFormatStrictInt52); 860 851 AbstractValue& value = m_state.forNode(edge); 861 m_interpreter.filter(value, SpecMachineInt); 852 853 if (m_interpreter.filter(value, SpecMachineInt) == Contradiction) { 854 terminateSpeculativeExecution(Uncountable, JSValueRegs(), 0); 855 return allocate(); 856 } 857 862 858 VirtualRegister virtualRegister = edge->virtualRegister(); 863 859 GenerationInfo& info = generationInfoFromVirtualRegister(virtualRegister); … … 865 861 switch (info.registerFormat()) { 866 862 case DataFormatNone: { 867 if (edge->hasConstant() && !edge->isMachineIntConstant()) {868 terminateSpeculativeExecution(Uncountable, JSValueRegs(), 0);869 return allocate();870 }871 872 863 GPRReg gpr = allocate(); 873 864 … … 988 979 SpeculatedType type = value.m_type; 989 980 ASSERT((edge.useKind() != KnownCellUse && edge.useKind() != KnownStringUse) || !(value.m_type & ~SpecCell)); 990 m_interpreter.filter(value, SpecCell); 981 982 if (m_interpreter.filter(value, SpecCell) == Contradiction) { 983 terminateSpeculativeExecution(Uncountable, JSValueRegs(), 0); 984 return allocate(); 985 } 986 991 987 VirtualRegister virtualRegister = edge->virtualRegister(); 992 988 GenerationInfo& info = generationInfoFromVirtualRegister(virtualRegister); 993 994 if (edge->hasConstant() && !edge->isCellConstant()) {995 // Better to fail early on constants.996 terminateSpeculativeExecution(Uncountable, JSValueRegs(), 0);997 return allocate();998 }999 989 1000 990 switch (info.registerFormat()) { … … 1009 999 return gpr; 1010 1000 } 1011 1012 if (!(info.spillFormat() & DataFormatJS)) { 1013 terminateSpeculativeExecution(Uncountable, JSValueRegs(), 0); 1014 return gpr; 1015 } 1016 1001 1017 1002 m_gprs.retain(gpr, virtualRegister, SpillOrderSpilled); 1018 1003 m_jit.load64(JITCompiler::addressFor(virtualRegister), gpr); … … 1050 1035 case DataFormatJSDouble: 1051 1036 case DataFormatJSBoolean: 1052 case DataFormatBoolean: { 1053 terminateSpeculativeExecution(Uncountable, JSValueRegs(), 0); 1054 return allocate(); 1055 } 1056 1037 case DataFormatBoolean: 1057 1038 case DataFormatDouble: 1058 1039 case DataFormatStorage: … … 1071 1052 AbstractValue& value = m_state.forNode(edge); 1072 1053 SpeculatedType type = value.m_type; 1073 m_interpreter.filter(value, SpecBoolean); 1054 1055 if (m_interpreter.filter(value, SpecBoolean) == Contradiction) { 1056 terminateSpeculativeExecution(Uncountable, JSValueRegs(), 0); 1057 return allocate(); 1058 } 1059 1074 1060 VirtualRegister virtualRegister = edge->virtualRegister(); 1075 1061 GenerationInfo& info = generationInfoFromVirtualRegister(virtualRegister); … … 1077 1063 switch (info.registerFormat()) { 1078 1064 case DataFormatNone: { 1079 if (info.spillFormat() == DataFormatInt32) {1080 terminateSpeculativeExecution(Uncountable, JSValueRegs(), 0);1081 return allocate();1082 }1083 1084 1065 GPRReg gpr = allocate(); 1085 1066 1086 1067 if (edge->hasConstant()) { 1087 1068 JSValue jsValue = edge->asJSValue(); 1088 if (jsValue.isBoolean()) { 1089 m_gprs.retain(gpr, virtualRegister, SpillOrderConstant); 1090 m_jit.move(MacroAssembler::TrustedImm64(JSValue::encode(jsValue)), gpr); 1091 info.fillJSValue(*m_stream, gpr, DataFormatJSBoolean); 1092 return gpr; 1093 } 1094 terminateSpeculativeExecution(Uncountable, JSValueRegs(), 0); 1069 m_gprs.retain(gpr, virtualRegister, SpillOrderConstant); 1070 m_jit.move(MacroAssembler::TrustedImm64(JSValue::encode(jsValue)), gpr); 1071 info.fillJSValue(*m_stream, gpr, DataFormatJSBoolean); 1095 1072 return gpr; 1096 1073 } … … 1133 1110 case DataFormatJSCell: 1134 1111 case DataFormatCell: 1135 terminateSpeculativeExecution(Uncountable, JSValueRegs(), 0);1136 return allocate();1137 1138 1112 case DataFormatDouble: 1139 1113 case DataFormatStorage:
Note:
See TracChangeset
for help on using the changeset viewer.