Changeset 155482 in webkit for trunk/Source/JavaScriptCore/dfg/DFGGraph.h
- Timestamp:
- Sep 10, 2013, 3:16:00 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/dfg/DFGGraph.h
r155023 r155482 62 62 63 63 enum AddSpeculationMode { 64 DontSpeculateInt eger,65 SpeculateInt egerAndTruncateConstants,66 SpeculateInt eger64 DontSpeculateInt32, 65 SpeculateInt32AndTruncateConstants, 66 SpeculateInt32 67 67 }; 68 68 … … 191 191 } 192 192 193 AddSpeculationMode addSpeculationMode(Node* add, bool leftShouldSpeculateInt eger, bool rightShouldSpeculateInteger)193 AddSpeculationMode addSpeculationMode(Node* add, bool leftShouldSpeculateInt32, bool rightShouldSpeculateInt32) 194 194 { 195 195 ASSERT(add->op() == ValueAdd || add->op() == ArithAdd || add->op() == ArithSub); … … 199 199 200 200 if (left->hasConstant()) 201 return addImmediateShouldSpeculateInt eger(add, rightShouldSpeculateInteger, left);201 return addImmediateShouldSpeculateInt32(add, rightShouldSpeculateInt32, left); 202 202 if (right->hasConstant()) 203 return addImmediateShouldSpeculateInt eger(add, leftShouldSpeculateInteger, right);204 205 return (leftShouldSpeculateInt eger && rightShouldSpeculateInteger && add->canSpeculateInteger()) ? SpeculateInteger : DontSpeculateInteger;203 return addImmediateShouldSpeculateInt32(add, leftShouldSpeculateInt32, right); 204 205 return (leftShouldSpeculateInt32 && rightShouldSpeculateInt32 && add->canSpeculateInt32()) ? SpeculateInt32 : DontSpeculateInt32; 206 206 } 207 207 208 208 AddSpeculationMode valueAddSpeculationMode(Node* add) 209 209 { 210 return addSpeculationMode(add, add->child1()->shouldSpeculateInt egerExpectingDefined(), add->child2()->shouldSpeculateIntegerExpectingDefined());210 return addSpeculationMode(add, add->child1()->shouldSpeculateInt32ExpectingDefined(), add->child2()->shouldSpeculateInt32ExpectingDefined()); 211 211 } 212 212 213 213 AddSpeculationMode arithAddSpeculationMode(Node* add) 214 214 { 215 return addSpeculationMode(add, add->child1()->shouldSpeculateInt egerForArithmetic(), add->child2()->shouldSpeculateIntegerForArithmetic());215 return addSpeculationMode(add, add->child1()->shouldSpeculateInt32ForArithmetic(), add->child2()->shouldSpeculateInt32ForArithmetic()); 216 216 } 217 217 … … 224 224 } 225 225 226 bool addShouldSpeculateInt eger(Node* add)227 { 228 return addSpeculationMode(add) != DontSpeculateInt eger;229 } 230 231 bool mulShouldSpeculateInt eger(Node* mul)226 bool addShouldSpeculateInt32(Node* add) 227 { 228 return addSpeculationMode(add) != DontSpeculateInt32; 229 } 230 231 bool mulShouldSpeculateInt32(Node* mul) 232 232 { 233 233 ASSERT(mul->op() == ArithMul); … … 236 236 Node* right = mul->child2().node(); 237 237 238 return Node::shouldSpeculateInt egerForArithmetic(left, right) && mul->canSpeculateInteger();239 } 240 241 bool negateShouldSpeculateInt eger(Node* negate)238 return Node::shouldSpeculateInt32ForArithmetic(left, right) && mul->canSpeculateInt32(); 239 } 240 241 bool negateShouldSpeculateInt32(Node* negate) 242 242 { 243 243 ASSERT(negate->op() == ArithNegate); 244 return negate->child1()->shouldSpeculateInt egerForArithmetic() && negate->canSpeculateInteger();244 return negate->child1()->shouldSpeculateInt32ForArithmetic() && negate->canSpeculateInt32(); 245 245 } 246 246 … … 718 718 void addForDepthFirstSort(Vector<BasicBlock*>& result, Vector<BasicBlock*, 16>& worklist, HashSet<BasicBlock*>& seen, BasicBlock*); 719 719 720 AddSpeculationMode addImmediateShouldSpeculateInt eger(Node* add, bool variableShouldSpeculateInteger, Node* immediate)720 AddSpeculationMode addImmediateShouldSpeculateInt32(Node* add, bool variableShouldSpeculateInt32, Node* immediate) 721 721 { 722 722 ASSERT(immediate->hasConstant()); … … 724 724 JSValue immediateValue = immediate->valueOfJSConstant(m_codeBlock); 725 725 if (!immediateValue.isNumber()) 726 return DontSpeculateInt eger;727 728 if (!variableShouldSpeculateInt eger)729 return DontSpeculateInt eger;726 return DontSpeculateInt32; 727 728 if (!variableShouldSpeculateInt32) 729 return DontSpeculateInt32; 730 730 731 731 if (immediateValue.isInt32()) 732 return add->canSpeculateInt eger() ? SpeculateInteger : DontSpeculateInteger;732 return add->canSpeculateInt32() ? SpeculateInt32 : DontSpeculateInt32; 733 733 734 734 double doubleImmediate = immediateValue.asDouble(); 735 735 const double twoToThe48 = 281474976710656.0; 736 736 if (doubleImmediate < -twoToThe48 || doubleImmediate > twoToThe48) 737 return DontSpeculateInt eger;738 739 return nodeCanTruncateInteger(add->arithNodeFlags()) ? SpeculateInt egerAndTruncateConstants : DontSpeculateInteger;740 } 741 742 bool mulImmediateShouldSpeculateInt eger(Node* mul, Node* variable, Node* immediate)737 return DontSpeculateInt32; 738 739 return nodeCanTruncateInteger(add->arithNodeFlags()) ? SpeculateInt32AndTruncateConstants : DontSpeculateInt32; 740 } 741 742 bool mulImmediateShouldSpeculateInt32(Node* mul, Node* variable, Node* immediate) 743 743 { 744 744 ASSERT(immediate->hasConstant()); … … 748 748 return false; 749 749 750 if (!variable->shouldSpeculateInt egerForArithmetic())750 if (!variable->shouldSpeculateInt32ForArithmetic()) 751 751 return false; 752 752 … … 756 756 // rounding in a double multiplication - hence it will be equivalent to an integer 757 757 // multiplication, if we are doing int32 truncation afterwards (which is what 758 // canSpeculateInt eger() implies).758 // canSpeculateInt32() implies). 759 759 const int32_t twoToThe22 = 1 << 22; 760 760 if (intImmediate <= -twoToThe22 || intImmediate >= twoToThe22) 761 return mul->canSpeculateInt eger() && !nodeMayOverflow(mul->arithNodeFlags());762 763 return mul->canSpeculateInt eger();761 return mul->canSpeculateInt32() && !nodeMayOverflow(mul->arithNodeFlags()); 762 763 return mul->canSpeculateInt32(); 764 764 } 765 765 };
Note:
See TracChangeset
for help on using the changeset viewer.