Changeset 165085 in webkit for trunk/Source/JavaScriptCore/dfg
- Timestamp:
- Mar 4, 2014, 5:03:55 PM (11 years ago)
- Location:
- trunk/Source/JavaScriptCore/dfg
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/dfg/DFGAbstractInterpreterInlines.h
r164620 r165085 918 918 SpeculatedType leftType = forNode(node->child1()).m_type; 919 919 SpeculatedType rightType = forNode(node->child2()).m_type; 920 if ((isInt32Speculation(leftType) && isOtherSpeculation(rightType)) 921 || (isOtherSpeculation(leftType) && isInt32Speculation(rightType))) { 920 if (!valuesCouldBeEqual(leftType, rightType)) { 922 921 setConstant(node, jsBoolean(false)); 923 922 break; … … 944 943 JSValue right = forNode(rightNode).value(); 945 944 if (left && right) { 946 if (left.isNumber() && right.isNumber()) {947 setConstant(node, jsBoolean(left.asNumber() == right.asNumber()));948 break;949 }950 945 if (left.isString() && right.isString()) { 946 // We need this case because JSValue::strictEqual is otherwise too racy for 947 // string comparisons. 951 948 const StringImpl* a = asString(left)->tryGetValueImpl(); 952 949 const StringImpl* b = asString(right)->tryGetValueImpl(); … … 955 952 break; 956 953 } 957 } 958 } 954 } else { 955 setConstant(node, jsBoolean(JSValue::strictEqual(0, left, right))); 956 break; 957 } 958 } 959 960 SpeculatedType leftLUB = leastUpperBoundOfStrictlyEquivalentSpeculations(forNode(leftNode).m_type); 961 SpeculatedType rightLUB = leastUpperBoundOfStrictlyEquivalentSpeculations(forNode(rightNode).m_type); 962 if (!(leftLUB & rightLUB)) { 963 setConstant(node, jsBoolean(false)); 964 break; 965 } 966 959 967 forNode(node).setType(SpecBoolean); 960 968 node->setCanExit(true); // This is overly conservative. -
trunk/Source/JavaScriptCore/dfg/DFGArrayMode.cpp
r164229 r165085 1 1 /* 2 * Copyright (C) 2012, 2013 Apple Inc. All rights reserved.2 * Copyright (C) 2012, 2013, 2014 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 133 133 134 134 ArrayMode ArrayMode::refine( 135 Graph& graph, CodeOrigin codeOrigin,135 Graph& graph, Node* node, 136 136 SpeculatedType base, SpeculatedType index, SpeculatedType value, 137 137 NodeFlags flags) const … … 200 200 201 201 ArrayMode result; 202 if (graph.hasExitSite(codeOrigin, OutOfBounds) || !isInBounds()) 203 result = withSpeculation(Array::OutOfBounds); 204 else 202 switch (node->op()) { 203 case PutByVal: 204 if (graph.hasExitSite(node->origin.semantic, OutOfBounds) || !isInBounds()) 205 result = withSpeculation(Array::OutOfBounds); 206 else 207 result = withSpeculation(Array::InBounds); 208 break; 209 210 default: 205 211 result = withSpeculation(Array::InBounds); 212 break; 213 } 206 214 207 215 if (isInt8ArraySpeculation(base)) -
trunk/Source/JavaScriptCore/dfg/DFGArrayMode.h
r164424 r165085 1 1 /* 2 * Copyright (C) 2012, 2013 Apple Inc. All rights reserved.2 * Copyright (C) 2012, 2013, 2014 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 221 221 } 222 222 223 ArrayMode refine(Graph&, CodeOrigin, SpeculatedType base, SpeculatedType index, SpeculatedType value = SpecNone, NodeFlags = 0) const;223 ArrayMode refine(Graph&, Node*, SpeculatedType base, SpeculatedType index, SpeculatedType value = SpecNone, NodeFlags = 0) const; 224 224 225 225 bool alreadyChecked(Graph&, Node*, AbstractValue&) const; -
trunk/Source/JavaScriptCore/dfg/DFGFixupPhase.cpp
r164651 r165085 433 433 break; 434 434 } 435 if (node->child1()->shouldSpeculateMisc() && node->child2()->shouldSpeculateMisc()) { 436 fixEdge<MiscUse>(node->child1()); 437 fixEdge<MiscUse>(node->child2()); 438 break; 439 } 435 440 break; 436 441 } … … 453 458 node->setArrayMode( 454 459 node->arrayMode().refine( 455 m_graph, node ->origin.semantic,460 m_graph, node, 456 461 node->child1()->prediction(), 457 462 node->child2()->prediction(), … … 511 516 node->setArrayMode( 512 517 node->arrayMode().refine( 513 m_graph, node ->origin.semantic,518 m_graph, node, 514 519 child1->prediction(), 515 520 child2->prediction(), … … 597 602 node->setArrayMode( 598 603 node->arrayMode().refine( 599 m_graph, node ->origin.semantic,604 m_graph, node, 600 605 node->child1()->prediction() & SpecCell, 601 606 SpecInt32, … … 1751 1756 1752 1757 arrayMode = arrayMode.refine( 1753 m_graph, node ->origin.semantic, node->child1()->prediction(), node->prediction());1758 m_graph, node, node->child1()->prediction(), node->prediction()); 1754 1759 1755 1760 if (arrayMode.type() == Array::Generic) { -
trunk/Source/JavaScriptCore/dfg/DFGNode.h
r164651 r165085 1400 1400 return isBooleanSpeculation(prediction()); 1401 1401 } 1402 1403 bool shouldSpeculateMisc() 1404 { 1405 return isMiscSpeculation(prediction()); 1406 } 1402 1407 1403 1408 bool shouldSpeculateStringIdent() -
trunk/Source/JavaScriptCore/dfg/DFGSafeToExecute.h
r164620 r165085 60 60 case NotCellUse: 61 61 case OtherUse: 62 case MiscUse: 62 63 case MachineIntUse: 63 64 return; -
trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp
r164764 r165085 3803 3803 } 3804 3804 3805 case MiscUse: { 3806 compileMiscStrictEq(node); 3807 return false; 3808 } 3809 3805 3810 case UntypedUse: { 3806 3811 return nonSpeculativeStrictEq(node); … … 4831 4836 } 4832 4837 4838 void SpeculativeJIT::speculateMisc(Edge edge, JSValueRegs regs) 4839 { 4840 #if USE(JSVALUE64) 4841 typeCheck( 4842 regs, edge, SpecMisc, 4843 m_jit.branch64(MacroAssembler::Above, regs.gpr(), MacroAssembler::TrustedImm64(TagBitTypeOther | TagBitBool | TagBitUndefined))); 4844 #else 4845 typeCheck( 4846 regs, edge, SpecMisc | SpecInt32, 4847 m_jit.branch32(MacroAssembler::Equal, regs.tagGPR(), MacroAssembler::TrustedImm32(JSValue::Int32Tag))); 4848 typeCheck( 4849 regs, edge, SpecMisc, 4850 m_jit.branch32(MacroAssembler::Below, regs.tagGPR(), MacroAssembler::TrustedImm32(JSValue::UndefinedTag))); 4851 #endif 4852 } 4853 4854 void SpeculativeJIT::speculateMisc(Edge edge) 4855 { 4856 if (!needsTypeCheck(edge, SpecMisc)) 4857 return; 4858 4859 JSValueOperand operand(this, edge, ManualOperandSpeculation); 4860 speculateMisc(edge, operand.jsValueRegs()); 4861 } 4862 4833 4863 void SpeculativeJIT::speculate(Node*, Edge edge) 4834 4864 { … … 4892 4922 case OtherUse: 4893 4923 speculateOther(edge); 4924 break; 4925 case MiscUse: 4926 speculateMisc(edge); 4894 4927 break; 4895 4928 default: -
trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.h
r164813 r165085 1986 1986 void compileStringIdentEquality(Node*); 1987 1987 void compileStringZeroLength(Node*); 1988 void compileMiscStrictEq(Node*); 1988 1989 1989 1990 void emitObjectOrOtherBranch(Edge value, BasicBlock* taken, BasicBlock* notTaken); … … 2204 2205 void speculateNotCell(Edge); 2205 2206 void speculateOther(Edge); 2207 void speculateMisc(Edge, JSValueRegs); 2208 void speculateMisc(Edge); 2206 2209 void speculate(Node*, Edge); 2207 2210 -
trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT32_64.cpp
r164766 r165085 612 612 613 613 booleanResult(resultPayloadGPR, node, UseChildrenCalledExplicitly); 614 } 615 616 void SpeculativeJIT::compileMiscStrictEq(Node* node) 617 { 618 JSValueOperand op1(this, node->child1(), ManualOperandSpeculation); 619 JSValueOperand op2(this, node->child2(), ManualOperandSpeculation); 620 GPRTemporary result(this); 621 622 speculateMisc(node->child1(), op1.jsValueRegs()); 623 speculateMisc(node->child2(), op2.jsValueRegs()); 624 625 m_jit.move(TrustedImm32(0), result.gpr()); 626 JITCompiler::Jump notEqual = m_jit.branch32(JITCompiler::NotEqual, op1.tagGPR(), op2.tagGPR()); 627 m_jit.compare32(JITCompiler::Equal, op1.payloadGPR(), op2.payloadGPR(), result.gpr()); 628 notEqual.link(&m_jit); 629 booleanResult(result.gpr(), node); 614 630 } 615 631 -
trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp
r164764 r165085 647 647 648 648 jsValueResult(resultGPR, m_currentNode, DataFormatJSBoolean, UseChildrenCalledExplicitly); 649 } 650 651 void SpeculativeJIT::compileMiscStrictEq(Node* node) 652 { 653 JSValueOperand op1(this, node->child1(), ManualOperandSpeculation); 654 JSValueOperand op2(this, node->child2(), ManualOperandSpeculation); 655 GPRTemporary result(this); 656 657 speculateMisc(node->child1(), op1.jsValueRegs()); 658 speculateMisc(node->child2(), op2.jsValueRegs()); 659 660 m_jit.compare32(JITCompiler::Equal, op1.gpr(), op2.gpr(), result.gpr()); 661 m_jit.or32(TrustedImm32(ValueFalse), result.gpr()); 662 jsValueResult(result.gpr(), node, DataFormatJSBoolean); 649 663 } 650 664 -
trunk/Source/JavaScriptCore/dfg/DFGUseKind.cpp
r164229 r165085 1 1 /* 2 * Copyright (C) 2013 Apple Inc. All rights reserved.2 * Copyright (C) 2013, 2014 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 98 98 out.print("Other"); 99 99 break; 100 case MiscUse: 101 out.print("Misc"); 102 break; 100 103 default: 101 104 RELEASE_ASSERT_NOT_REACHED(); -
trunk/Source/JavaScriptCore/dfg/DFGUseKind.h
r164424 r165085 1 1 /* 2 * Copyright (C) 2013 Apple Inc. All rights reserved.2 * Copyright (C) 2013, 2014 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 55 55 NotCellUse, 56 56 OtherUse, 57 MiscUse, 57 58 LastUseKind // Must always be the last entry in the enum, as it is used to denote the number of enum elements. 58 59 }; … … 97 98 case OtherUse: 98 99 return SpecOther; 100 case MiscUse: 101 return SpecMisc; 99 102 default: 100 103 RELEASE_ASSERT_NOT_REACHED();
Note:
See TracChangeset
for help on using the changeset viewer.