Changeset 103255 in webkit for trunk/Source/JavaScriptCore
- Timestamp:
- Dec 19, 2011, 12:22:31 PM (13 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r103250 r103255 1 2011-12-19 Sheriff Bot <[email protected]> 2 3 Unreviewed, rolling out r103250. 4 http://trac.webkit.org/changeset/103250 5 https://bugs.webkit.org/show_bug.cgi?id=74877 6 7 it still breaks codegen (Requested by olliej on #webkit). 8 9 * dfg/DFGAbstractState.cpp: 10 (JSC::DFG::AbstractState::execute): 11 * dfg/DFGByteCodeParser.cpp: 12 (JSC::DFG::ByteCodeParser::parseBlock): 13 * dfg/DFGNode.h: 14 * dfg/DFGPropagator.cpp: 15 (JSC::DFG::Propagator::propagateArithNodeFlags): 16 (JSC::DFG::Propagator::fixupNode): 17 (JSC::DFG::Propagator::byValIsPure): 18 (JSC::DFG::Propagator::clobbersWorld): 19 (JSC::DFG::Propagator::getByValLoadElimination): 20 (JSC::DFG::Propagator::checkStructureLoadElimination): 21 (JSC::DFG::Propagator::getByOffsetLoadElimination): 22 (JSC::DFG::Propagator::getPropertyStorageLoadElimination): 23 (JSC::DFG::Propagator::getIndexedPropertyStorageLoadElimination): 24 (JSC::DFG::Propagator::performNodeCSE): 25 * dfg/DFGSpeculativeJIT.cpp: 26 (JSC::DFG::SpeculativeJIT::compilePutByValForByteArray): 27 (JSC::DFG::SpeculativeJIT::compilePutByValForIntTypedArray): 28 (JSC::DFG::SpeculativeJIT::compilePutByValForFloatTypedArray): 29 * dfg/DFGSpeculativeJIT.h: 30 * dfg/DFGSpeculativeJIT32_64.cpp: 31 (JSC::DFG::SpeculativeJIT::compile): 32 * dfg/DFGSpeculativeJIT64.cpp: 33 (JSC::DFG::SpeculativeJIT::compile): 34 1 35 2011-12-16 Oliver Hunt <[email protected]> 2 36 -
trunk/Source/JavaScriptCore/dfg/DFGAbstractState.cpp
r103250 r103255 494 494 case PutByVal: 495 495 case PutByValAlias: { 496 NodeIndex child1 = m_graph.m_varArgChildren[node.firstChild()]; 497 NodeIndex child2 = m_graph.m_varArgChildren[node.firstChild() + 1]; 498 NodeIndex child3 = m_graph.m_varArgChildren[node.firstChild() + 2]; 499 PredictedType indexPrediction = m_graph[child2].prediction(); 496 PredictedType indexPrediction = m_graph[node.child2()].prediction(); 500 497 if (!(indexPrediction & PredictInt32) && indexPrediction) { 501 498 clobberStructures(nodeIndex); … … 503 500 break; 504 501 } 505 if (m_graph[ child1].shouldSpeculateByteArray()) {506 forNode( child1).filter(PredictByteArray);507 forNode( child2).filter(PredictInt32);508 forNode( child3).filter(PredictNumber);509 break; 510 } 511 512 if (m_graph[ child1].shouldSpeculateInt8Array()) {513 forNode( child1).filter(PredictInt8Array);514 forNode( child2).filter(PredictInt32);515 forNode( child3).filter(PredictNumber);516 break; 517 } 518 if (m_graph[ child1].shouldSpeculateInt16Array()) {519 forNode( child1).filter(PredictInt16Array);520 forNode( child2).filter(PredictInt32);521 forNode( child3).filter(PredictNumber);522 break; 523 } 524 if (m_graph[ child1].shouldSpeculateInt32Array()) {525 forNode( child1).filter(PredictInt32Array);526 forNode( child2).filter(PredictInt32);527 forNode( child3).filter(PredictNumber);528 break; 529 } 530 if (m_graph[ child1].shouldSpeculateUint8Array()) {531 forNode( child1).filter(PredictUint8Array);532 forNode( child2).filter(PredictInt32);533 forNode( child3).filter(PredictNumber);534 break; 535 } 536 if (m_graph[ child1].shouldSpeculateUint16Array()) {537 forNode( child1).filter(PredictUint16Array);538 forNode( child2).filter(PredictInt32);539 forNode( child3).filter(PredictNumber);540 break; 541 } 542 if (m_graph[ child1].shouldSpeculateUint32Array()) {543 forNode( child1).filter(PredictUint32Array);544 forNode( child2).filter(PredictInt32);545 forNode( child3).filter(PredictNumber);546 break; 547 } 548 if (m_graph[ child1].shouldSpeculateFloat32Array()) {549 forNode( child1).filter(PredictFloat32Array);550 forNode( child2).filter(PredictInt32);551 forNode( child3).filter(PredictNumber);552 break; 553 } 554 if (m_graph[ child1].shouldSpeculateFloat64Array()) {555 forNode( child1).filter(PredictFloat64Array);556 forNode( child2).filter(PredictInt32);557 forNode( child3).filter(PredictNumber);558 break; 559 } 560 561 forNode( child1).filter(PredictArray);562 forNode( child2).filter(PredictInt32);502 if (m_graph[node.child1()].shouldSpeculateByteArray()) { 503 forNode(node.child1()).filter(PredictByteArray); 504 forNode(node.child2()).filter(PredictInt32); 505 forNode(node.child3()).filter(PredictNumber); 506 break; 507 } 508 509 if (m_graph[node.child1()].shouldSpeculateInt8Array()) { 510 forNode(node.child1()).filter(PredictInt8Array); 511 forNode(node.child2()).filter(PredictInt32); 512 forNode(node.child3()).filter(PredictNumber); 513 break; 514 } 515 if (m_graph[node.child1()].shouldSpeculateInt16Array()) { 516 forNode(node.child1()).filter(PredictInt16Array); 517 forNode(node.child2()).filter(PredictInt32); 518 forNode(node.child3()).filter(PredictNumber); 519 break; 520 } 521 if (m_graph[node.child1()].shouldSpeculateInt32Array()) { 522 forNode(node.child1()).filter(PredictInt32Array); 523 forNode(node.child2()).filter(PredictInt32); 524 forNode(node.child3()).filter(PredictNumber); 525 break; 526 } 527 if (m_graph[node.child1()].shouldSpeculateUint8Array()) { 528 forNode(node.child1()).filter(PredictUint8Array); 529 forNode(node.child2()).filter(PredictInt32); 530 forNode(node.child3()).filter(PredictNumber); 531 break; 532 } 533 if (m_graph[node.child1()].shouldSpeculateUint16Array()) { 534 forNode(node.child1()).filter(PredictUint16Array); 535 forNode(node.child2()).filter(PredictInt32); 536 forNode(node.child3()).filter(PredictNumber); 537 break; 538 } 539 if (m_graph[node.child1()].shouldSpeculateUint32Array()) { 540 forNode(node.child1()).filter(PredictUint32Array); 541 forNode(node.child2()).filter(PredictInt32); 542 forNode(node.child3()).filter(PredictNumber); 543 break; 544 } 545 if (m_graph[node.child1()].shouldSpeculateFloat32Array()) { 546 forNode(node.child1()).filter(PredictFloat32Array); 547 forNode(node.child2()).filter(PredictInt32); 548 forNode(node.child3()).filter(PredictNumber); 549 break; 550 } 551 if (m_graph[node.child1()].shouldSpeculateFloat64Array()) { 552 forNode(node.child1()).filter(PredictFloat64Array); 553 forNode(node.child2()).filter(PredictInt32); 554 forNode(node.child3()).filter(PredictNumber); 555 break; 556 } 557 558 forNode(node.child1()).filter(PredictArray); 559 forNode(node.child2()).filter(PredictInt32); 563 560 break; 564 561 } -
trunk/Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp
r103250 r103255 1663 1663 NodeIndex property = get(currentInstruction[2].u.operand); 1664 1664 NodeIndex value = get(currentInstruction[3].u.operand); 1665 NodeIndex propertyStorage = addToGraph(GetIndexedPropertyStorage, base, property); 1666 1667 addVarArgChild(base); 1668 addVarArgChild(property); 1669 addVarArgChild(value); 1670 addVarArgChild(propertyStorage); 1671 1672 addToGraph(Node::VarArg, PutByVal, OpInfo(0), OpInfo(0)); 1665 1666 addToGraph(PutByVal, base, property, value); 1673 1667 1674 1668 NEXT_OPCODE(op_put_by_val); -
trunk/Source/JavaScriptCore/dfg/DFGNode.h
r103250 r103255 227 227 /* this must be the directly subsequent property put. */\ 228 228 macro(GetByVal, NodeResultJS | NodeMustGenerate | NodeMightClobber) \ 229 macro(PutByVal, NodeMustGenerate | NodeClobbersWorld | NodeHasVarArgs) \230 macro(PutByValAlias, NodeMustGenerate | NodeClobbersWorld | NodeHasVarArgs) \229 macro(PutByVal, NodeMustGenerate | NodeClobbersWorld) \ 230 macro(PutByValAlias, NodeMustGenerate | NodeClobbersWorld) \ 231 231 macro(GetById, NodeResultJS | NodeMustGenerate | NodeClobbersWorld) \ 232 232 macro(PutById, NodeMustGenerate | NodeClobbersWorld) \ … … 235 235 macro(PutStructure, NodeMustGenerate | NodeClobbersWorld) \ 236 236 macro(GetPropertyStorage, NodeResultStorage) \ 237 macro(GetIndexedPropertyStorage, Node ResultStorage) \237 macro(GetIndexedPropertyStorage, NodeMustGenerate | NodeResultStorage) \ 238 238 macro(GetByOffset, NodeResultJS) \ 239 239 macro(PutByOffset, NodeMustGenerate | NodeClobbersWorld) \ -
trunk/Source/JavaScriptCore/dfg/DFGPropagator.cpp
r103250 r103255 193 193 194 194 case PutByVal: { 195 NodeIndex base = m_graph.m_varArgChildren[node.firstChild()]; 196 NodeIndex property = m_graph.m_varArgChildren[node.firstChild() + 1]; 197 NodeIndex value = m_graph.m_varArgChildren[node.firstChild() + 2]; 198 changed |= m_graph[base].mergeArithNodeFlags(flags | NodeUsedAsNumber | NodeNeedsNegZero); 199 changed |= m_graph[property].mergeArithNodeFlags(flags | NodeUsedAsNumber); 200 changed |= m_graph[value].mergeArithNodeFlags(flags | NodeUsedAsNumber | NodeNeedsNegZero); 195 changed |= m_graph[node.child1()].mergeArithNodeFlags(flags | NodeUsedAsNumber | NodeNeedsNegZero); 196 changed |= m_graph[node.child2()].mergeArithNodeFlags(flags | NodeUsedAsNumber); 197 changed |= m_graph[node.child3()].mergeArithNodeFlags(flags | NodeUsedAsNumber | NodeNeedsNegZero); 201 198 break; 202 199 } … … 934 931 break; 935 932 } 936 case PutByVal:937 case PutByValAlias: {938 NodeIndex storage = m_graph.m_varArgChildren[node.firstChild() + 3];939 if (m_graph[storage].op == Nop)940 node.children.variable.numChildren = 3;941 break;942 }943 944 933 case GetByVal: 945 934 case StringCharAt: … … 1097 1086 } 1098 1087 1099 bool byValI ndexIsPure(Node& node)1100 { 1101 PredictedType prediction = node.prediction();1088 bool byValIsPure(Node& node) 1089 { 1090 PredictedType prediction = m_graph[node.child2()].prediction(); 1102 1091 return (prediction & PredictInt32) || !prediction; 1103 1092 } … … 1121 1110 return !logicalNotIsPure(node); 1122 1111 case GetByVal: 1123 return !byValI ndexIsPure(m_graph[node.child2()]);1112 return !byValIsPure(node); 1124 1113 default: 1125 1114 ASSERT_NOT_REACHED(); … … 1191 1180 switch (node.op) { 1192 1181 case GetByVal: 1193 if (!byValI ndexIsPure(m_graph[node.child2()]))1182 if (!byValIsPure(node)) 1194 1183 return NoNode; 1195 1184 if (node.child1() == child1 && canonicalize(node.child2()) == canonicalize(child2)) … … 1197 1186 break; 1198 1187 case PutByVal: 1199 case PutByValAlias: { 1200 1201 NodeIndex base = m_graph.m_varArgChildren[node.firstChild()]; 1202 NodeIndex property = m_graph.m_varArgChildren[node.firstChild() + 1]; 1203 if (!byValIndexIsPure(m_graph[property])) 1188 case PutByValAlias: 1189 if (!byValIsPure(node)) 1204 1190 return NoNode; 1205 if ( base == child1 && canonicalize(property) == canonicalize(child2))1206 return m_graph.m_varArgChildren[node.firstChild() + 2];1191 if (node.child1() == child1 && canonicalize(node.child2()) == canonicalize(child2)) 1192 return node.child3(); 1207 1193 // We must assume that the PutByVal will clobber the location we're getting from. 1208 1194 // FIXME: We can do better; if we know that the PutByVal is accessing an array of a 1209 1195 // different type than the GetByVal, then we know that they won't clobber each other. 1210 1196 return NoNode; 1211 }1212 1197 case PutStructure: 1213 1198 case PutByOffset: … … 1265 1250 1266 1251 case PutByVal: 1267 case PutByValAlias: { 1268 NodeIndex property = m_graph.m_varArgChildren[node.firstChild() + 1]; 1269 if (byValIndexIsPure(m_graph[property])) { 1252 case PutByValAlias: 1253 if (byValIsPure(node)) { 1270 1254 // If PutByVal speculates that it's accessing an array with an 1271 1255 // integer index, then it's impossible for it to cause a structure … … 1274 1258 } 1275 1259 return false; 1276 } 1277 1260 1278 1261 default: 1279 1262 if (clobbersWorld(index)) … … 1310 1293 1311 1294 case PutByVal: 1312 case PutByValAlias: { 1313 NodeIndex property = m_graph.m_varArgChildren[node.firstChild() + 1]; 1314 if (byValIndexIsPure(m_graph[property])) { 1295 case PutByValAlias: 1296 if (byValIsPure(node)) { 1315 1297 // If PutByVal speculates that it's accessing an array with an 1316 1298 // integer index, then it's impossible for it to cause a structure … … 1319 1301 } 1320 1302 return NoNode; 1321 } 1322 1303 1323 1304 default: 1324 1305 if (clobbersWorld(index)) … … 1348 1329 1349 1330 case PutByVal: 1350 case PutByValAlias: { 1351 NodeIndex property = m_graph.m_varArgChildren[node.firstChild() + 1]; 1352 if (byValIndexIsPure(m_graph[property])) { 1331 case PutByValAlias: 1332 if (byValIsPure(node)) { 1353 1333 // If PutByVal speculates that it's accessing an array with an 1354 1334 // integer index, then it's impossible for it to cause a structure … … 1357 1337 } 1358 1338 return NoNode; 1359 } 1360 1339 1361 1340 default: 1362 1341 if (clobbersWorld(index)) … … 1368 1347 } 1369 1348 1370 NodeIndex getIndexedPropertyStorageLoadElimination(NodeIndex child1 )1349 NodeIndex getIndexedPropertyStorageLoadElimination(NodeIndex child1, bool hasIntegerIndexPrediction) 1371 1350 { 1372 1351 NodeIndex start = startIndexForChildren(child1); … … 1377 1356 PredictedType basePrediction = m_graph[node.child2()].prediction(); 1378 1357 bool nodeHasIntegerIndexPrediction = !(!(basePrediction & PredictInt32) && basePrediction); 1379 if (node.child1() == child1 && nodeHasIntegerIndexPrediction)1358 if (node.child1() == child1 && hasIntegerIndexPrediction == nodeHasIntegerIndexPrediction) 1380 1359 return index; 1381 1360 break; … … 1392 1371 break; 1393 1372 1394 case PutByVal: { 1395 NodeIndex base = m_graph.m_varArgChildren[node.firstChild()]; 1396 NodeIndex property = m_graph.m_varArgChildren[node.firstChild() + 1]; 1397 if (isFixedIndexedStorageObjectPrediction(m_graph[base].prediction()) && byValIndexIsPure(m_graph[property])) 1373 case PutByVal: 1374 if (isFixedIndexedStorageObjectPrediction(m_graph[node.child1()].prediction()) && byValIsPure(node)) 1398 1375 break; 1399 1376 return NoNode; 1400 }1401 1377 1402 1378 default: … … 1579 1555 1580 1556 case GetByVal: 1581 if (byValI ndexIsPure(m_graph[node.child2()]))1557 if (byValIsPure(node)) 1582 1558 setReplacement(getByValLoadElimination(node.child1(), node.child2())); 1583 1559 break; 1584 1560 1585 case PutByVal: { 1586 NodeIndex base = m_graph.m_varArgChildren[node.firstChild()]; 1587 NodeIndex property = m_graph.m_varArgChildren[node.firstChild() + 1]; 1588 if (byValIndexIsPure(m_graph[property]) && getByValLoadElimination(base, property) != NoNode) 1561 case PutByVal: 1562 if (byValIsPure(node) && getByValLoadElimination(node.child1(), node.child2()) != NoNode) 1589 1563 node.op = PutByValAlias; 1590 1564 break; 1591 }1592 1565 1593 1566 case CheckStructure: … … 1604 1577 PredictedType basePrediction = m_graph[node.child2()].prediction(); 1605 1578 bool nodeHasIntegerIndexPrediction = !(!(basePrediction & PredictInt32) && basePrediction); 1606 if (nodeHasIntegerIndexPrediction) 1607 setReplacement(getIndexedPropertyStorageLoadElimination(node.child1())); 1579 setReplacement(getIndexedPropertyStorageLoadElimination(node.child1(), nodeHasIntegerIndexPrediction)); 1608 1580 break; 1609 1581 } -
trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp
r103250 r103255 1554 1554 } 1555 1555 1556 void SpeculativeJIT::compilePutByValForByteArray(Node& node) 1557 { 1558 NodeIndex baseIndex = m_jit.graph().m_varArgChildren[node.firstChild()]; 1559 NodeIndex propertyIndex = m_jit.graph().m_varArgChildren[node.firstChild() + 1]; 1560 NodeIndex valueIndex = m_jit.graph().m_varArgChildren[node.firstChild() + 2]; 1561 NodeIndex storageIndex = m_jit.graph().m_varArgChildren[node.firstChild() + 3]; 1562 1563 if (!isByteArrayPrediction(m_state.forNode(baseIndex).m_type)) { 1564 SpeculateCellOperand base(this, baseIndex); 1565 speculationCheck(BadType, JSValueSource::unboxedCell(base.gpr()), baseIndex, m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(base.gpr(), JSCell::classInfoOffset()), MacroAssembler::TrustedImmPtr(&JSByteArray::s_info))); 1566 } 1556 void SpeculativeJIT::compilePutByValForByteArray(GPRReg base, GPRReg property, Node& node) 1557 { 1558 NodeIndex baseIndex = node.child1(); 1559 NodeIndex valueIndex = node.child3(); 1560 1561 if (!isByteArrayPrediction(m_state.forNode(baseIndex).m_type)) 1562 speculationCheck(BadType, JSValueSource::unboxedCell(base), baseIndex, m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(base, JSCell::classInfoOffset()), MacroAssembler::TrustedImmPtr(&JSByteArray::s_info))); 1567 1563 GPRTemporary value; 1568 1564 GPRReg valueGPR; … … 1611 1607 valueGPR = gpr; 1612 1608 } 1613 StorageOperand storage(this, storageIndex); 1614 SpeculateIntegerOperand property(this, propertyIndex); 1609 ASSERT_UNUSED(valueGPR, valueGPR != property); 1610 ASSERT(valueGPR != base); 1611 GPRTemporary storage(this); 1615 1612 GPRReg storageReg = storage.gpr(); 1616 MacroAssembler::Jump outOfBounds = m_jit.branch32(MacroAssembler::AboveOrEqual, property.gpr(), MacroAssembler::Address(storageReg, ByteArray::offsetOfSize())); 1617 m_jit.store8(value.gpr(), MacroAssembler::BaseIndex(storageReg, property.gpr(), MacroAssembler::TimesOne, ByteArray::offsetOfData())); 1613 ASSERT(valueGPR != storageReg); 1614 m_jit.loadPtr(MacroAssembler::Address(base, JSByteArray::offsetOfStorage()), storageReg); 1615 MacroAssembler::Jump outOfBounds = m_jit.branch32(MacroAssembler::AboveOrEqual, property, MacroAssembler::Address(storageReg, ByteArray::offsetOfSize())); 1616 m_jit.store8(value.gpr(), MacroAssembler::BaseIndex(storageReg, property, MacroAssembler::TimesOne, ByteArray::offsetOfData())); 1618 1617 outOfBounds.link(&m_jit); 1619 1618 noResult(m_compileIndex); … … 1712 1711 } 1713 1712 1714 void SpeculativeJIT::compilePutByValForIntTypedArray(const TypedArrayDescriptor& descriptor, Node& node, size_t elementSize, TypedArraySpeculationRequirements speculationRequirements, TypedArraySignedness signedness) 1715 { 1716 NodeIndex baseIndex = m_jit.graph().m_varArgChildren[node.firstChild()]; 1717 NodeIndex propertyIndex = m_jit.graph().m_varArgChildren[node.firstChild() + 1]; 1718 NodeIndex valueIndex = m_jit.graph().m_varArgChildren[node.firstChild() + 2]; 1719 NodeIndex storageIndex = m_jit.graph().m_varArgChildren[node.firstChild() + 3]; 1720 1721 if (speculationRequirements != NoTypedArrayTypeSpecCheck) { 1722 SpeculateCellOperand base(this, baseIndex); 1723 speculationCheck(BadType, JSValueSource::unboxedCell(base.gpr()), baseIndex, m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(base.gpr()), MacroAssembler::TrustedImmPtr(descriptor.m_classInfo))); 1724 } 1725 1726 StorageOperand storage(this, storageIndex); 1727 GPRReg storageReg = storage.gpr(); 1728 SpeculateIntegerOperand property(this, propertyIndex); 1729 GPRReg propertyReg = property.gpr(); 1730 MacroAssembler::Jump outOfBounds; 1731 if (speculationRequirements != NoTypedArrayTypeSpecCheck || speculationRequirements != NoTypedArraySpecCheck) { 1732 SpeculateCellOperand base(this, baseIndex); 1733 if (speculationRequirements != NoTypedArrayTypeSpecCheck) 1734 speculationCheck(BadType, JSValueSource::unboxedCell(base.gpr()), baseIndex, m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(base.gpr(), JSCell::classInfoOffset()), MacroAssembler::TrustedImmPtr(descriptor.m_classInfo))); 1735 if (speculationRequirements != NoTypedArraySpecCheck) 1736 outOfBounds = m_jit.branch32(MacroAssembler::AboveOrEqual, propertyReg, MacroAssembler::Address(base.gpr(), descriptor.m_lengthOffset)); 1737 } 1713 void SpeculativeJIT::compilePutByValForIntTypedArray(const TypedArrayDescriptor& descriptor, GPRReg base, GPRReg property, Node& node, size_t elementSize, TypedArraySpeculationRequirements speculationRequirements, TypedArraySignedness signedness) 1714 { 1715 NodeIndex baseIndex = node.child1(); 1716 NodeIndex valueIndex = node.child3(); 1717 1718 if (speculationRequirements != NoTypedArrayTypeSpecCheck) 1719 speculationCheck(BadType, JSValueSource::unboxedCell(base), baseIndex, m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(base, JSCell::classInfoOffset()), MacroAssembler::TrustedImmPtr(descriptor.m_classInfo))); 1738 1720 GPRTemporary value; 1739 1721 GPRReg valueGPR; … … 1777 1759 valueGPR = gpr; 1778 1760 } 1761 ASSERT_UNUSED(valueGPR, valueGPR != property); 1762 ASSERT(valueGPR != base); 1763 GPRTemporary storage(this); 1764 GPRReg storageReg = storage.gpr(); 1765 ASSERT(valueGPR != storageReg); 1766 m_jit.loadPtr(MacroAssembler::Address(base, descriptor.m_storageOffset), storageReg); 1767 MacroAssembler::Jump outOfBounds; 1768 if (speculationRequirements != NoTypedArraySpecCheck) 1769 outOfBounds = m_jit.branch32(MacroAssembler::AboveOrEqual, property, MacroAssembler::Address(base, descriptor.m_lengthOffset)); 1779 1770 1780 1771 switch (elementSize) { 1781 1772 case 1: 1782 m_jit.store8(value.gpr(), MacroAssembler::BaseIndex(storageReg, property Reg, MacroAssembler::TimesOne));1773 m_jit.store8(value.gpr(), MacroAssembler::BaseIndex(storageReg, property, MacroAssembler::TimesOne)); 1783 1774 break; 1784 1775 case 2: 1785 m_jit.store16(value.gpr(), MacroAssembler::BaseIndex(storageReg, property Reg, MacroAssembler::TimesTwo));1776 m_jit.store16(value.gpr(), MacroAssembler::BaseIndex(storageReg, property, MacroAssembler::TimesTwo)); 1786 1777 break; 1787 1778 case 4: 1788 m_jit.store32(value.gpr(), MacroAssembler::BaseIndex(storageReg, property Reg, MacroAssembler::TimesFour));1779 m_jit.store32(value.gpr(), MacroAssembler::BaseIndex(storageReg, property, MacroAssembler::TimesFour)); 1789 1780 break; 1790 1781 default: … … 1841 1832 } 1842 1833 1843 void SpeculativeJIT::compilePutByValForFloatTypedArray(const TypedArrayDescriptor& descriptor, Node& node, size_t elementSize, TypedArraySpeculationRequirements speculationRequirements) 1844 { 1845 NodeIndex baseIndex = m_jit.graph().m_varArgChildren[node.firstChild()]; 1846 NodeIndex propertyIndex = m_jit.graph().m_varArgChildren[node.firstChild() + 1]; 1847 NodeIndex valueIndex = m_jit.graph().m_varArgChildren[node.firstChild() + 2]; 1848 NodeIndex storageIndex = m_jit.graph().m_varArgChildren[node.firstChild() + 3]; 1834 void SpeculativeJIT::compilePutByValForFloatTypedArray(const TypedArrayDescriptor& descriptor, GPRReg base, GPRReg property, Node& node, size_t elementSize, TypedArraySpeculationRequirements speculationRequirements) 1835 { 1836 NodeIndex baseIndex = node.child1(); 1837 NodeIndex valueIndex = node.child3(); 1849 1838 1850 1839 SpeculateDoubleOperand valueOp(this, valueIndex); 1851 SpeculateStrictInt32Operand property(this, propertyIndex); 1852 StorageOperand storage(this, storageIndex); 1840 1841 if (speculationRequirements != NoTypedArrayTypeSpecCheck) 1842 speculationCheck(BadType, JSValueSource::unboxedCell(base), baseIndex, m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(base, JSCell::classInfoOffset()), MacroAssembler::TrustedImmPtr(descriptor.m_classInfo))); 1843 1844 GPRTemporary result(this); 1845 1846 GPRTemporary storage(this); 1853 1847 GPRReg storageReg = storage.gpr(); 1854 GPRReg propertyReg = property.gpr();1855 1848 1849 m_jit.loadPtr(MacroAssembler::Address(base, descriptor.m_storageOffset), storageReg); 1856 1850 MacroAssembler::Jump outOfBounds; 1857 if (speculationRequirements != NoTypedArrayTypeSpecCheck || speculationRequirements != NoTypedArraySpecCheck) { 1858 SpeculateCellOperand base(this, baseIndex); 1859 if (speculationRequirements != NoTypedArrayTypeSpecCheck) 1860 speculationCheck(BadType, JSValueSource::unboxedCell(base.gpr()), baseIndex, m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(base.gpr(), JSCell::classInfoOffset()), MacroAssembler::TrustedImmPtr(descriptor.m_classInfo))); 1861 if (speculationRequirements != NoTypedArraySpecCheck) 1862 outOfBounds = m_jit.branch32(MacroAssembler::AboveOrEqual, propertyReg, MacroAssembler::Address(base.gpr(), descriptor.m_lengthOffset)); 1863 } 1864 1865 1851 if (speculationRequirements != NoTypedArraySpecCheck) 1852 outOfBounds = m_jit.branch32(MacroAssembler::AboveOrEqual, property, MacroAssembler::Address(base, descriptor.m_lengthOffset)); 1866 1853 1867 1854 switch (elementSize) { … … 1870 1857 m_jit.moveDouble(valueOp.fpr(), scratch.fpr()); 1871 1858 m_jit.convertDoubleToFloat(valueOp.fpr(), scratch.fpr()); 1872 m_jit.storeFloat(scratch.fpr(), MacroAssembler::BaseIndex(storageReg, property Reg, MacroAssembler::TimesFour));1859 m_jit.storeFloat(scratch.fpr(), MacroAssembler::BaseIndex(storageReg, property, MacroAssembler::TimesFour)); 1873 1860 break; 1874 1861 } 1875 1862 case 8: 1876 m_jit.storeDouble(valueOp.fpr(), MacroAssembler::BaseIndex(storageReg, property Reg, MacroAssembler::TimesEight));1863 m_jit.storeDouble(valueOp.fpr(), MacroAssembler::BaseIndex(storageReg, property, MacroAssembler::TimesEight)); 1877 1864 break; 1878 1865 default: -
trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.h
r103250 r103255 1971 1971 void compileUInt32ToNumber(Node&); 1972 1972 void compileGetByValOnByteArray(Node&); 1973 void compilePutByValForByteArray( Node&);1973 void compilePutByValForByteArray(GPRReg base, GPRReg property, Node&); 1974 1974 void compileArithMul(Node&); 1975 1975 void compileArithMod(Node&); … … 1987 1987 void compileGetIndexedPropertyStorage(Node&); 1988 1988 void compileGetByValOnIntTypedArray(const TypedArrayDescriptor&, Node&, size_t elementSize, TypedArraySpeculationRequirements, TypedArraySignedness); 1989 void compilePutByValForIntTypedArray(const TypedArrayDescriptor&, Node&, size_t elementSize, TypedArraySpeculationRequirements, TypedArraySignedness);1989 void compilePutByValForIntTypedArray(const TypedArrayDescriptor&, GPRReg base, GPRReg property, Node&, size_t elementSize, TypedArraySpeculationRequirements, TypedArraySignedness); 1990 1990 void compileGetByValOnFloatTypedArray(const TypedArrayDescriptor&, Node&, size_t elementSize, TypedArraySpeculationRequirements); 1991 void compilePutByValForFloatTypedArray(const TypedArrayDescriptor&, Node&, size_t elementSize, TypedArraySpeculationRequirements);1991 void compilePutByValForFloatTypedArray(const TypedArrayDescriptor&, GPRReg base, GPRReg property, Node&, size_t elementSize, TypedArraySpeculationRequirements); 1992 1992 1993 1993 // It is acceptable to have structure be equal to scratch, so long as you're fine -
trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT32_64.cpp
r103250 r103255 2694 2694 2695 2695 case PutByVal: { 2696 NodeIndex child1 = m_jit.graph().m_varArgChildren[node.firstChild()]; 2697 NodeIndex child2 = m_jit.graph().m_varArgChildren[node.firstChild() + 1]; 2698 NodeIndex child3 = m_jit.graph().m_varArgChildren[node.firstChild() + 2]; 2699 NodeIndex child4 = m_jit.graph().m_varArgChildren[node.firstChild() + 3]; 2700 2701 PredictedType basePrediction = at(child2).prediction(); 2696 PredictedType basePrediction = at(node.child2()).prediction(); 2702 2697 if (!(basePrediction & PredictInt32) && basePrediction) { 2703 SpeculateCellOperand base(this, child1); // Save a register, speculate cell. We'll probably be right.2704 JSValueOperand property(this, child2);2705 JSValueOperand value(this, child3);2698 SpeculateCellOperand base(this, node.child1()); // Save a register, speculate cell. We'll probably be right. 2699 JSValueOperand property(this, node.child2()); 2700 JSValueOperand value(this, node.child3()); 2706 2701 GPRReg baseGPR = base.gpr(); 2707 2702 GPRReg propertyTagGPR = property.tagGPR(); … … 2717 2712 } 2718 2713 2719 if (at(child1).shouldSpeculateByteArray()) { 2720 compilePutByValForByteArray(node); 2714 SpeculateCellOperand base(this, node.child1()); 2715 SpeculateStrictInt32Operand property(this, node.child2()); 2716 if (at(node.child1()).shouldSpeculateByteArray()) { 2717 compilePutByValForByteArray(base.gpr(), property.gpr(), node); 2721 2718 break; 2722 2719 } 2723 2724 if (at(child1).shouldSpeculateInt8Array()) { 2725 compilePutByValForIntTypedArray(m_jit.globalData()->int8ArrayDescriptor(), node, sizeof(int8_t), isInt8ArrayPrediction(m_state.forNode(child1).m_type) ? NoTypedArrayTypeSpecCheck : AllTypedArraySpecChecks, SignedTypedArray); 2720 if (at(node.child1()).shouldSpeculateByteArray()) { 2721 compilePutByValForByteArray(base.gpr(), property.gpr(), node); 2722 break; 2723 } 2724 2725 if (at(node.child1()).shouldSpeculateInt8Array()) { 2726 compilePutByValForIntTypedArray(m_jit.globalData()->int8ArrayDescriptor(), base.gpr(), property.gpr(), node, sizeof(int8_t), isInt8ArrayPrediction(m_state.forNode(node.child1()).m_type) ? NoTypedArrayTypeSpecCheck : AllTypedArraySpecChecks, SignedTypedArray); 2726 2727 if (!m_compileOkay) 2727 2728 return; … … 2729 2730 } 2730 2731 2731 if (at( child1).shouldSpeculateInt16Array()) {2732 compilePutByValForIntTypedArray(m_jit.globalData()->int16ArrayDescriptor(), node, sizeof(int16_t), isInt16ArrayPrediction(m_state.forNode(child1).m_type) ? NoTypedArrayTypeSpecCheck : AllTypedArraySpecChecks, SignedTypedArray);2732 if (at(node.child1()).shouldSpeculateInt16Array()) { 2733 compilePutByValForIntTypedArray(m_jit.globalData()->int16ArrayDescriptor(), base.gpr(), property.gpr(), node, sizeof(int16_t), isInt16ArrayPrediction(m_state.forNode(node.child1()).m_type) ? NoTypedArrayTypeSpecCheck : AllTypedArraySpecChecks, SignedTypedArray); 2733 2734 if (!m_compileOkay) 2734 2735 return; … … 2736 2737 } 2737 2738 2738 if (at( child1).shouldSpeculateInt32Array()) {2739 compilePutByValForIntTypedArray(m_jit.globalData()->int32ArrayDescriptor(), node, sizeof(int32_t), isInt32ArrayPrediction(m_state.forNode(child1).m_type) ? NoTypedArrayTypeSpecCheck : AllTypedArraySpecChecks, SignedTypedArray);2739 if (at(node.child1()).shouldSpeculateInt32Array()) { 2740 compilePutByValForIntTypedArray(m_jit.globalData()->int32ArrayDescriptor(), base.gpr(), property.gpr(), node, sizeof(int32_t), isInt32ArrayPrediction(m_state.forNode(node.child1()).m_type) ? NoTypedArrayTypeSpecCheck : AllTypedArraySpecChecks, SignedTypedArray); 2740 2741 if (!m_compileOkay) 2741 2742 return; … … 2743 2744 } 2744 2745 2745 if (at( child1).shouldSpeculateUint8Array()) {2746 compilePutByValForIntTypedArray(m_jit.globalData()->uint8ArrayDescriptor(), node, sizeof(uint8_t), isUint8ArrayPrediction(m_state.forNode(child1).m_type) ? NoTypedArrayTypeSpecCheck : AllTypedArraySpecChecks, UnsignedTypedArray);2746 if (at(node.child1()).shouldSpeculateUint8Array()) { 2747 compilePutByValForIntTypedArray(m_jit.globalData()->uint8ArrayDescriptor(), base.gpr(), property.gpr(), node, sizeof(uint8_t), isUint8ArrayPrediction(m_state.forNode(node.child1()).m_type) ? NoTypedArrayTypeSpecCheck : AllTypedArraySpecChecks, UnsignedTypedArray); 2747 2748 if (!m_compileOkay) 2748 2749 return; … … 2750 2751 } 2751 2752 2752 if (at( child1).shouldSpeculateUint16Array()) {2753 compilePutByValForIntTypedArray(m_jit.globalData()->uint16ArrayDescriptor(), node, sizeof(uint16_t), isUint16ArrayPrediction(m_state.forNode(child1).m_type) ? NoTypedArrayTypeSpecCheck : AllTypedArraySpecChecks, UnsignedTypedArray);2753 if (at(node.child1()).shouldSpeculateUint16Array()) { 2754 compilePutByValForIntTypedArray(m_jit.globalData()->uint16ArrayDescriptor(), base.gpr(), property.gpr(), node, sizeof(uint16_t), isUint16ArrayPrediction(m_state.forNode(node.child1()).m_type) ? NoTypedArrayTypeSpecCheck : AllTypedArraySpecChecks, UnsignedTypedArray); 2754 2755 if (!m_compileOkay) 2755 2756 return; … … 2757 2758 } 2758 2759 2759 if (at( child1).shouldSpeculateUint32Array()) {2760 compilePutByValForIntTypedArray(m_jit.globalData()->uint32ArrayDescriptor(), node, sizeof(uint32_t), isUint32ArrayPrediction(m_state.forNode(child1).m_type) ? NoTypedArrayTypeSpecCheck : AllTypedArraySpecChecks, UnsignedTypedArray);2760 if (at(node.child1()).shouldSpeculateUint32Array()) { 2761 compilePutByValForIntTypedArray(m_jit.globalData()->uint32ArrayDescriptor(), base.gpr(), property.gpr(), node, sizeof(uint32_t), isUint32ArrayPrediction(m_state.forNode(node.child1()).m_type) ? NoTypedArrayTypeSpecCheck : AllTypedArraySpecChecks, UnsignedTypedArray); 2761 2762 if (!m_compileOkay) 2762 2763 return; … … 2764 2765 } 2765 2766 2766 if (at( child1).shouldSpeculateFloat32Array()) {2767 compilePutByValForFloatTypedArray(m_jit.globalData()->float32ArrayDescriptor(), node, sizeof(float), isFloat32ArrayPrediction(m_state.forNode(child1).m_type) ? NoTypedArrayTypeSpecCheck : AllTypedArraySpecChecks);2767 if (at(node.child1()).shouldSpeculateFloat32Array()) { 2768 compilePutByValForFloatTypedArray(m_jit.globalData()->float32ArrayDescriptor(), base.gpr(), property.gpr(), node, sizeof(float), isFloat32ArrayPrediction(m_state.forNode(node.child1()).m_type) ? NoTypedArrayTypeSpecCheck : AllTypedArraySpecChecks); 2768 2769 if (!m_compileOkay) 2769 2770 return; … … 2771 2772 } 2772 2773 2773 if (at( child1).shouldSpeculateFloat64Array()) {2774 compilePutByValForFloatTypedArray(m_jit.globalData()->float64ArrayDescriptor(), node, sizeof(double), isFloat64ArrayPrediction(m_state.forNode(child1).m_type) ? NoTypedArrayTypeSpecCheck : AllTypedArraySpecChecks);2774 if (at(node.child1()).shouldSpeculateFloat64Array()) { 2775 compilePutByValForFloatTypedArray(m_jit.globalData()->float64ArrayDescriptor(), base.gpr(), property.gpr(), node, sizeof(double), isFloat64ArrayPrediction(m_state.forNode(node.child1()).m_type) ? NoTypedArrayTypeSpecCheck : AllTypedArraySpecChecks); 2775 2776 if (!m_compileOkay) 2776 2777 return; … … 2778 2779 } 2779 2780 2780 SpeculateCellOperand base(this, child1); 2781 SpeculateStrictInt32Operand property(this, child2); 2782 JSValueOperand value(this, child3); 2781 JSValueOperand value(this, node.child3()); 2782 GPRTemporary scratch(this); 2783 2783 2784 2784 // Map base, property & value into registers, allocate a scratch register. … … 2787 2787 GPRReg valueTagReg = value.tagGPR(); 2788 2788 GPRReg valuePayloadReg = value.payloadGPR(); 2789 GPRReg scratchReg = scratch.gpr(); 2789 2790 2790 2791 if (!m_compileOkay) 2791 2792 return; 2792 2793 { 2794 GPRTemporary scratch(this); 2795 writeBarrier(baseReg, valueTagReg, child3, WriteBarrierForPropertyAccess, scratch.gpr()); 2796 } 2793 2794 writeBarrier(baseReg, valueTagReg, node.child3(), WriteBarrierForPropertyAccess, scratchReg); 2797 2795 2798 2796 // Check that base is an array, and that property is contained within m_vector (< m_vectorLength). 2799 2797 // If we have predicted the base to be type array, we can skip the check. 2800 if (!isArrayPrediction(m_state.forNode(child1).m_type)) 2801 speculationCheck(BadType, JSValueSource::unboxedCell(baseReg), child1, m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(baseReg, JSCell::classInfoOffset()), MacroAssembler::TrustedImmPtr(&JSArray::s_info))); 2802 2803 StorageOperand storage(this, child4); 2804 GPRReg storageReg = storage.gpr(); 2798 if (!isArrayPrediction(m_state.forNode(node.child1()).m_type)) 2799 speculationCheck(BadType, JSValueSource::unboxedCell(baseReg), node.child1(), m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(baseReg, JSCell::classInfoOffset()), MacroAssembler::TrustedImmPtr(&JSArray::s_info))); 2805 2800 2806 2801 base.use(); 2807 2802 property.use(); 2808 2803 value.use(); 2809 storage.use();2810 2804 2811 2805 MacroAssembler::Jump withinArrayBounds = m_jit.branch32(MacroAssembler::Below, propertyReg, MacroAssembler::Address(baseReg, JSArray::vectorLengthOffset())); 2812 2806 2813 2807 // Code to handle put beyond array bounds. 2814 silentSpillAllRegisters( InvalidGPRReg);2808 silentSpillAllRegisters(scratchReg); 2815 2809 callOperation(operationPutByValBeyondArrayBounds, baseReg, propertyReg, valueTagReg, valuePayloadReg); 2816 silentFillAllRegisters( InvalidGPRReg);2810 silentFillAllRegisters(scratchReg); 2817 2811 JITCompiler::Jump wasBeyondArrayBounds = m_jit.jump(); 2818 2812 2819 2813 withinArrayBounds.link(&m_jit); 2814 2815 // Get the array storage. 2816 GPRReg storageReg = scratchReg; 2817 m_jit.loadPtr(MacroAssembler::Address(baseReg, JSArray::storageOffset()), storageReg); 2820 2818 2821 2819 // Check if we're writing to a hole; if so increment m_numValuesInVector. … … 2843 2841 2844 2842 case PutByValAlias: { 2845 NodeIndex child1 = m_jit.graph().m_varArgChildren[node.firstChild()]; 2846 NodeIndex child2 = m_jit.graph().m_varArgChildren[node.firstChild() + 1]; 2847 NodeIndex child3 = m_jit.graph().m_varArgChildren[node.firstChild() + 2]; 2848 NodeIndex child4 = m_jit.graph().m_varArgChildren[node.firstChild() + 3]; 2849 2850 if (at(child1).shouldSpeculateByteArray()) { 2851 compilePutByValForByteArray(node); 2843 SpeculateCellOperand base(this, node.child1()); 2844 SpeculateStrictInt32Operand property(this, node.child2()); 2845 2846 if (at(node.child1()).shouldSpeculateByteArray()) { 2847 compilePutByValForByteArray(base.gpr(), property.gpr(), node); 2852 2848 break; 2853 2849 } 2854 2850 2855 if (at( child1).shouldSpeculateInt8Array()) {2856 compilePutByValForIntTypedArray(m_jit.globalData()->int8ArrayDescriptor(), node, sizeof(int8_t), NoTypedArraySpecCheck, SignedTypedArray);2851 if (at(node.child1()).shouldSpeculateInt8Array()) { 2852 compilePutByValForIntTypedArray(m_jit.globalData()->int8ArrayDescriptor(), base.gpr(), property.gpr(), node, sizeof(int8_t), NoTypedArraySpecCheck, SignedTypedArray); 2857 2853 if (!m_compileOkay) 2858 2854 return; … … 2860 2856 } 2861 2857 2862 if (at( child1).shouldSpeculateInt16Array()) {2863 compilePutByValForIntTypedArray(m_jit.globalData()->int16ArrayDescriptor(), node, sizeof(int16_t), NoTypedArraySpecCheck, SignedTypedArray);2858 if (at(node.child1()).shouldSpeculateInt16Array()) { 2859 compilePutByValForIntTypedArray(m_jit.globalData()->int16ArrayDescriptor(), base.gpr(), property.gpr(), node, sizeof(int16_t), NoTypedArraySpecCheck, SignedTypedArray); 2864 2860 if (!m_compileOkay) 2865 2861 return; … … 2867 2863 } 2868 2864 2869 if (at( child1).shouldSpeculateInt32Array()) {2870 compilePutByValForIntTypedArray(m_jit.globalData()->int32ArrayDescriptor(), node, sizeof(int32_t), NoTypedArraySpecCheck, SignedTypedArray);2865 if (at(node.child1()).shouldSpeculateInt32Array()) { 2866 compilePutByValForIntTypedArray(m_jit.globalData()->int32ArrayDescriptor(), base.gpr(), property.gpr(), node, sizeof(int32_t), NoTypedArraySpecCheck, SignedTypedArray); 2871 2867 if (!m_compileOkay) 2872 2868 return; … … 2874 2870 } 2875 2871 2876 if (at( child1).shouldSpeculateUint8Array()) {2877 compilePutByValForIntTypedArray(m_jit.globalData()->uint8ArrayDescriptor(), node, sizeof(uint8_t), NoTypedArraySpecCheck, UnsignedTypedArray);2872 if (at(node.child1()).shouldSpeculateUint8Array()) { 2873 compilePutByValForIntTypedArray(m_jit.globalData()->uint8ArrayDescriptor(), base.gpr(), property.gpr(), node, sizeof(uint8_t), NoTypedArraySpecCheck, UnsignedTypedArray); 2878 2874 if (!m_compileOkay) 2879 2875 return; … … 2881 2877 } 2882 2878 2883 if (at( child1).shouldSpeculateUint16Array()) {2884 compilePutByValForIntTypedArray(m_jit.globalData()->uint16ArrayDescriptor(), node, sizeof(uint16_t), NoTypedArraySpecCheck, UnsignedTypedArray);2879 if (at(node.child1()).shouldSpeculateUint16Array()) { 2880 compilePutByValForIntTypedArray(m_jit.globalData()->uint16ArrayDescriptor(), base.gpr(), property.gpr(), node, sizeof(uint16_t), NoTypedArraySpecCheck, UnsignedTypedArray); 2885 2881 if (!m_compileOkay) 2886 2882 return; … … 2888 2884 } 2889 2885 2890 if (at( child1).shouldSpeculateUint32Array()) {2891 compilePutByValForIntTypedArray(m_jit.globalData()->uint32ArrayDescriptor(), node, sizeof(uint32_t), NoTypedArraySpecCheck, UnsignedTypedArray);2886 if (at(node.child1()).shouldSpeculateUint32Array()) { 2887 compilePutByValForIntTypedArray(m_jit.globalData()->uint32ArrayDescriptor(), base.gpr(), property.gpr(), node, sizeof(uint32_t), NoTypedArraySpecCheck, UnsignedTypedArray); 2892 2888 if (!m_compileOkay) 2893 2889 return; … … 2895 2891 } 2896 2892 2897 if (at( child1).shouldSpeculateFloat32Array()) {2898 compilePutByValForFloatTypedArray(m_jit.globalData()->float32ArrayDescriptor(), node, sizeof(float), NoTypedArraySpecCheck);2893 if (at(node.child1()).shouldSpeculateFloat32Array()) { 2894 compilePutByValForFloatTypedArray(m_jit.globalData()->float32ArrayDescriptor(), base.gpr(), property.gpr(), node, sizeof(float), NoTypedArraySpecCheck); 2899 2895 if (!m_compileOkay) 2900 2896 return; … … 2902 2898 } 2903 2899 2904 if (at( child1).shouldSpeculateFloat64Array()) {2905 compilePutByValForFloatTypedArray(m_jit.globalData()->float64ArrayDescriptor(), node, sizeof(double), NoTypedArraySpecCheck);2900 if (at(node.child1()).shouldSpeculateFloat64Array()) { 2901 compilePutByValForFloatTypedArray(m_jit.globalData()->float64ArrayDescriptor(), base.gpr(), property.gpr(), node, sizeof(double), NoTypedArraySpecCheck); 2906 2902 if (!m_compileOkay) 2907 2903 return; 2908 2904 break; 2909 2905 } 2910 2911 JSValueOperand value(this, child3); 2912 { 2913 SpeculateCellOperand base(this, child1); 2914 GPRTemporary scratch(this, base); 2915 GPRReg baseReg = base.gpr(); 2916 GPRReg scratchReg = scratch.gpr(); 2917 writeBarrier(baseReg, value.tagGPR(), child3, WriteBarrierForPropertyAccess, scratchReg); 2918 } 2919 2920 SpeculateStrictInt32Operand property(this, child2); 2921 StorageOperand storage(this, child4); 2906 2907 JSValueOperand value(this, node.child3()); 2908 GPRTemporary scratch(this, base); 2909 2910 GPRReg baseReg = base.gpr(); 2911 GPRReg scratchReg = scratch.gpr(); 2912 2913 writeBarrier(baseReg, value.tagGPR(), node.child3(), WriteBarrierForPropertyAccess, scratchReg); 2914 2915 // Get the array storage. 2916 GPRReg storageReg = scratchReg; 2917 m_jit.loadPtr(MacroAssembler::Address(baseReg, JSArray::storageOffset()), storageReg); 2918 2922 2919 // Store the value to the array. 2923 2920 GPRReg propertyReg = property.gpr(); 2924 m_jit.store32(value.tagGPR(), MacroAssembler::BaseIndex(storage .gpr(), propertyReg, MacroAssembler::TimesEight, OBJECT_OFFSETOF(ArrayStorage, m_vector[0]) + OBJECT_OFFSETOF(JSValue, u.asBits.tag)));2925 m_jit.store32(value.payloadGPR(), MacroAssembler::BaseIndex(storage .gpr(), propertyReg, MacroAssembler::TimesEight, OBJECT_OFFSETOF(ArrayStorage, m_vector[0]) + OBJECT_OFFSETOF(JSValue, u.asBits.payload)));2921 m_jit.store32(value.tagGPR(), MacroAssembler::BaseIndex(storageReg, propertyReg, MacroAssembler::TimesEight, OBJECT_OFFSETOF(ArrayStorage, m_vector[0]) + OBJECT_OFFSETOF(JSValue, u.asBits.tag))); 2922 m_jit.store32(value.payloadGPR(), MacroAssembler::BaseIndex(storageReg, propertyReg, MacroAssembler::TimesEight, OBJECT_OFFSETOF(ArrayStorage, m_vector[0]) + OBJECT_OFFSETOF(JSValue, u.asBits.payload))); 2926 2923 2927 2924 noResult(m_compileIndex); -
trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp
r103250 r103255 2598 2598 break; 2599 2599 } 2600 ASSERT(node.child3() != NoNode);2600 2601 2601 if (at(node.child1()).prediction() == PredictString) { 2602 2602 compileGetByValOnString(node); … … 2696 2696 2697 2697 case PutByVal: { 2698 NodeIndex child1 = m_jit.graph().m_varArgChildren[node.firstChild()]; 2699 NodeIndex child2 = m_jit.graph().m_varArgChildren[node.firstChild() + 1]; 2700 NodeIndex child3 = m_jit.graph().m_varArgChildren[node.firstChild() + 2]; 2701 2702 PredictedType basePrediction = at(child2).prediction(); 2698 PredictedType basePrediction = at(node.child2()).prediction(); 2703 2699 if (!(basePrediction & PredictInt32) && basePrediction) { 2704 JSValueOperand arg1(this, child1);2705 JSValueOperand arg2(this, child2);2706 JSValueOperand arg3(this, child3);2700 JSValueOperand arg1(this, node.child1()); 2701 JSValueOperand arg2(this, node.child2()); 2702 JSValueOperand arg3(this, node.child3()); 2707 2703 GPRReg arg1GPR = arg1.gpr(); 2708 2704 GPRReg arg2GPR = arg2.gpr(); … … 2716 2712 } 2717 2713 2718 if (at(child1).shouldSpeculateByteArray()) { 2719 compilePutByValForByteArray(node); 2714 SpeculateCellOperand base(this, node.child1()); 2715 SpeculateStrictInt32Operand property(this, node.child2()); 2716 if (at(node.child1()).shouldSpeculateByteArray()) { 2717 compilePutByValForByteArray(base.gpr(), property.gpr(), node); 2720 2718 break; 2721 2719 } 2722 2720 2723 if (at( child1).shouldSpeculateInt8Array()) {2724 compilePutByValForIntTypedArray(m_jit.globalData()->int8ArrayDescriptor(), node, sizeof(int8_t), isInt8ArrayPrediction(m_state.forNode(child1).m_type) ? NoTypedArrayTypeSpecCheck : AllTypedArraySpecChecks, SignedTypedArray);2721 if (at(node.child1()).shouldSpeculateInt8Array()) { 2722 compilePutByValForIntTypedArray(m_jit.globalData()->int8ArrayDescriptor(), base.gpr(), property.gpr(), node, sizeof(int8_t), isInt8ArrayPrediction(m_state.forNode(node.child1()).m_type) ? NoTypedArrayTypeSpecCheck : AllTypedArraySpecChecks, SignedTypedArray); 2725 2723 if (!m_compileOkay) 2726 2724 return; … … 2728 2726 } 2729 2727 2730 if (at( child1).shouldSpeculateInt16Array()) {2731 compilePutByValForIntTypedArray(m_jit.globalData()->int16ArrayDescriptor(), node, sizeof(int16_t), isInt16ArrayPrediction(m_state.forNode(child1).m_type) ? NoTypedArrayTypeSpecCheck : AllTypedArraySpecChecks, SignedTypedArray);2728 if (at(node.child1()).shouldSpeculateInt16Array()) { 2729 compilePutByValForIntTypedArray(m_jit.globalData()->int16ArrayDescriptor(), base.gpr(), property.gpr(), node, sizeof(int16_t), isInt16ArrayPrediction(m_state.forNode(node.child1()).m_type) ? NoTypedArrayTypeSpecCheck : AllTypedArraySpecChecks, SignedTypedArray); 2732 2730 if (!m_compileOkay) 2733 2731 return; … … 2735 2733 } 2736 2734 2737 if (at( child1).shouldSpeculateInt32Array()) {2738 compilePutByValForIntTypedArray(m_jit.globalData()->int32ArrayDescriptor(), node, sizeof(int32_t), isInt32ArrayPrediction(m_state.forNode(child1).m_type) ? NoTypedArrayTypeSpecCheck : AllTypedArraySpecChecks, SignedTypedArray);2735 if (at(node.child1()).shouldSpeculateInt32Array()) { 2736 compilePutByValForIntTypedArray(m_jit.globalData()->int32ArrayDescriptor(), base.gpr(), property.gpr(), node, sizeof(int32_t), isInt32ArrayPrediction(m_state.forNode(node.child1()).m_type) ? NoTypedArrayTypeSpecCheck : AllTypedArraySpecChecks, SignedTypedArray); 2739 2737 if (!m_compileOkay) 2740 2738 return; … … 2742 2740 } 2743 2741 2744 if (at( child1).shouldSpeculateUint8Array()) {2745 compilePutByValForIntTypedArray(m_jit.globalData()->uint8ArrayDescriptor(), node, sizeof(uint8_t), isUint8ArrayPrediction(m_state.forNode(child1).m_type) ? NoTypedArrayTypeSpecCheck : AllTypedArraySpecChecks, UnsignedTypedArray);2742 if (at(node.child1()).shouldSpeculateUint8Array()) { 2743 compilePutByValForIntTypedArray(m_jit.globalData()->uint8ArrayDescriptor(), base.gpr(), property.gpr(), node, sizeof(uint8_t), isUint8ArrayPrediction(m_state.forNode(node.child1()).m_type) ? NoTypedArrayTypeSpecCheck : AllTypedArraySpecChecks, UnsignedTypedArray); 2746 2744 if (!m_compileOkay) 2747 2745 return; … … 2749 2747 } 2750 2748 2751 if (at( child1).shouldSpeculateUint16Array()) {2752 compilePutByValForIntTypedArray(m_jit.globalData()->uint16ArrayDescriptor(), node, sizeof(uint16_t), isUint16ArrayPrediction(m_state.forNode(child1).m_type) ? NoTypedArrayTypeSpecCheck : AllTypedArraySpecChecks, UnsignedTypedArray);2749 if (at(node.child1()).shouldSpeculateUint16Array()) { 2750 compilePutByValForIntTypedArray(m_jit.globalData()->uint16ArrayDescriptor(), base.gpr(), property.gpr(), node, sizeof(uint16_t), isUint16ArrayPrediction(m_state.forNode(node.child1()).m_type) ? NoTypedArrayTypeSpecCheck : AllTypedArraySpecChecks, UnsignedTypedArray); 2753 2751 if (!m_compileOkay) 2754 2752 return; … … 2756 2754 } 2757 2755 2758 if (at( child1).shouldSpeculateUint32Array()) {2759 compilePutByValForIntTypedArray(m_jit.globalData()->uint32ArrayDescriptor(), node, sizeof(uint32_t), isUint32ArrayPrediction(m_state.forNode(child1).m_type) ? NoTypedArrayTypeSpecCheck : AllTypedArraySpecChecks, UnsignedTypedArray);2756 if (at(node.child1()).shouldSpeculateUint32Array()) { 2757 compilePutByValForIntTypedArray(m_jit.globalData()->uint32ArrayDescriptor(), base.gpr(), property.gpr(), node, sizeof(uint32_t), isUint32ArrayPrediction(m_state.forNode(node.child1()).m_type) ? NoTypedArrayTypeSpecCheck : AllTypedArraySpecChecks, UnsignedTypedArray); 2760 2758 if (!m_compileOkay) 2761 2759 return; … … 2763 2761 } 2764 2762 2765 if (at( child1).shouldSpeculateFloat32Array()) {2766 compilePutByValForFloatTypedArray(m_jit.globalData()->float32ArrayDescriptor(), node, sizeof(float), isFloat32ArrayPrediction(m_state.forNode(child1).m_type) ? NoTypedArrayTypeSpecCheck : AllTypedArraySpecChecks);2763 if (at(node.child1()).shouldSpeculateFloat32Array()) { 2764 compilePutByValForFloatTypedArray(m_jit.globalData()->float32ArrayDescriptor(), base.gpr(), property.gpr(), node, sizeof(float), isFloat32ArrayPrediction(m_state.forNode(node.child1()).m_type) ? NoTypedArrayTypeSpecCheck : AllTypedArraySpecChecks); 2767 2765 if (!m_compileOkay) 2768 2766 return; … … 2770 2768 } 2771 2769 2772 if (at( child1).shouldSpeculateFloat64Array()) {2773 compilePutByValForFloatTypedArray(m_jit.globalData()->float64ArrayDescriptor(), node, sizeof(double), isFloat64ArrayPrediction(m_state.forNode(child1).m_type) ? NoTypedArrayTypeSpecCheck : AllTypedArraySpecChecks);2770 if (at(node.child1()).shouldSpeculateFloat64Array()) { 2771 compilePutByValForFloatTypedArray(m_jit.globalData()->float64ArrayDescriptor(), base.gpr(), property.gpr(), node, sizeof(double), isFloat64ArrayPrediction(m_state.forNode(node.child1()).m_type) ? NoTypedArrayTypeSpecCheck : AllTypedArraySpecChecks); 2774 2772 if (!m_compileOkay) 2775 2773 return; 2776 2774 break; 2777 2775 } 2778 2779 SpeculateCellOperand base(this, child1); 2780 SpeculateStrictInt32Operand property(this, child2); 2781 JSValueOperand value(this, child3); 2782 NodeIndex child4 = m_jit.graph().m_varArgChildren[node.firstChild() + 3]; 2783 StorageOperand storage(this, child4); 2776 2777 JSValueOperand value(this, node.child3()); 2784 2778 GPRTemporary scratch(this); 2785 2779 2786 2780 // Map base, property & value into registers, allocate a scratch register. 2787 2781 GPRReg baseReg = base.gpr(); 2788 2782 GPRReg propertyReg = property.gpr(); 2789 2783 GPRReg valueReg = value.gpr(); 2790 GPRReg storageReg = storage.gpr();2791 2784 GPRReg scratchReg = scratch.gpr(); 2792 2785 … … 2794 2787 return; 2795 2788 2796 writeBarrier(baseReg, value.gpr(), child3, WriteBarrierForPropertyAccess, scratchReg);2789 writeBarrier(baseReg, value.gpr(), node.child3(), WriteBarrierForPropertyAccess, scratchReg); 2797 2790 2798 2791 // Check that base is an array, and that property is contained within m_vector (< m_vectorLength). 2799 2792 // If we have predicted the base to be type array, we can skip the check. 2800 if (!isArrayPrediction(m_state.forNode( child1).m_type))2801 speculationCheck(BadType, JSValueRegs(baseReg), child1, m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(baseReg, JSCell::classInfoOffset()), MacroAssembler::TrustedImmPtr(&JSArray::s_info)));2793 if (!isArrayPrediction(m_state.forNode(node.child1()).m_type)) 2794 speculationCheck(BadType, JSValueRegs(baseReg), node.child1(), m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(baseReg, JSCell::classInfoOffset()), MacroAssembler::TrustedImmPtr(&JSArray::s_info))); 2802 2795 2803 2796 base.use(); 2804 2797 property.use(); 2805 2798 value.use(); 2806 storage.use(); 2807 2799 2808 2800 MacroAssembler::Jump withinArrayBounds = m_jit.branch32(MacroAssembler::Below, propertyReg, MacroAssembler::Address(baseReg, JSArray::vectorLengthOffset())); 2809 2801 … … 2816 2808 withinArrayBounds.link(&m_jit); 2817 2809 2810 // Get the array storage. 2811 GPRReg storageReg = scratchReg; 2812 m_jit.loadPtr(MacroAssembler::Address(baseReg, JSArray::storageOffset()), storageReg); 2813 2818 2814 // Check if we're writing to a hole; if so increment m_numValuesInVector. 2819 2815 MacroAssembler::Jump notHoleValue = m_jit.branchTestPtr(MacroAssembler::NonZero, MacroAssembler::BaseIndex(storageReg, propertyReg, MacroAssembler::ScalePtr, OBJECT_OFFSETOF(ArrayStorage, m_vector[0]))); … … 2839 2835 2840 2836 case PutByValAlias: { 2841 NodeIndex child1 = m_jit.graph().m_varArgChildren[node.firstChild()]; 2842 NodeIndex child2 = m_jit.graph().m_varArgChildren[node.firstChild() + 1]; 2843 NodeIndex child3 = m_jit.graph().m_varArgChildren[node.firstChild() + 2]; 2844 NodeIndex child4 = m_jit.graph().m_varArgChildren[node.firstChild() + 3]; 2845 2846 PredictedType basePrediction = at(child2).prediction(); 2837 PredictedType basePrediction = at(node.child2()).prediction(); 2847 2838 ASSERT_UNUSED(basePrediction, (basePrediction & PredictInt32) || !basePrediction); 2848 2839 2849 if (at(child1).shouldSpeculateByteArray()) { 2850 compilePutByValForByteArray(node); 2840 SpeculateCellOperand base(this, node.child1()); 2841 SpeculateStrictInt32Operand property(this, node.child2()); 2842 if (at(node.child1()).shouldSpeculateByteArray()) { 2843 compilePutByValForByteArray(base.gpr(), property.gpr(), node); 2851 2844 break; 2852 2845 } 2853 2846 2854 if (at( child1).shouldSpeculateInt8Array()) {2855 compilePutByValForIntTypedArray(m_jit.globalData()->int8ArrayDescriptor(), node, sizeof(int8_t), NoTypedArraySpecCheck, SignedTypedArray);2847 if (at(node.child1()).shouldSpeculateInt8Array()) { 2848 compilePutByValForIntTypedArray(m_jit.globalData()->int8ArrayDescriptor(), base.gpr(), property.gpr(), node, sizeof(int8_t), NoTypedArraySpecCheck, SignedTypedArray); 2856 2849 if (!m_compileOkay) 2857 2850 return; 2858 2851 break; 2859 2852 } 2860 2861 if (at( child1).shouldSpeculateInt16Array()) {2862 compilePutByValForIntTypedArray(m_jit.globalData()->int16ArrayDescriptor(), node, sizeof(int16_t), NoTypedArraySpecCheck, SignedTypedArray);2853 2854 if (at(node.child1()).shouldSpeculateInt16Array()) { 2855 compilePutByValForIntTypedArray(m_jit.globalData()->int16ArrayDescriptor(), base.gpr(), property.gpr(), node, sizeof(int16_t), NoTypedArraySpecCheck, SignedTypedArray); 2863 2856 if (!m_compileOkay) 2864 2857 return; 2865 2858 break; 2866 2859 } 2867 2868 if (at( child1).shouldSpeculateInt32Array()) {2869 compilePutByValForIntTypedArray(m_jit.globalData()->int32ArrayDescriptor(), node, sizeof(int32_t), NoTypedArraySpecCheck, SignedTypedArray);2860 2861 if (at(node.child1()).shouldSpeculateInt32Array()) { 2862 compilePutByValForIntTypedArray(m_jit.globalData()->int32ArrayDescriptor(), base.gpr(), property.gpr(), node, sizeof(int32_t), NoTypedArraySpecCheck, SignedTypedArray); 2870 2863 if (!m_compileOkay) 2871 2864 return; 2872 2865 break; 2873 2866 } 2874 2875 if (at( child1).shouldSpeculateUint8Array()) {2876 compilePutByValForIntTypedArray(m_jit.globalData()->uint8ArrayDescriptor(), node, sizeof(uint8_t), NoTypedArraySpecCheck, UnsignedTypedArray);2867 2868 if (at(node.child1()).shouldSpeculateUint8Array()) { 2869 compilePutByValForIntTypedArray(m_jit.globalData()->uint8ArrayDescriptor(), base.gpr(), property.gpr(), node, sizeof(uint8_t), NoTypedArraySpecCheck, UnsignedTypedArray); 2877 2870 if (!m_compileOkay) 2878 2871 return; 2879 2872 break; 2880 2873 } 2881 2882 if (at( child1).shouldSpeculateUint16Array()) {2883 compilePutByValForIntTypedArray(m_jit.globalData()->uint16ArrayDescriptor(), node, sizeof(uint16_t), NoTypedArraySpecCheck, UnsignedTypedArray);2874 2875 if (at(node.child1()).shouldSpeculateUint16Array()) { 2876 compilePutByValForIntTypedArray(m_jit.globalData()->uint16ArrayDescriptor(), base.gpr(), property.gpr(), node, sizeof(uint16_t), NoTypedArraySpecCheck, UnsignedTypedArray); 2884 2877 if (!m_compileOkay) 2885 2878 return; 2886 2879 break; 2887 2880 } 2888 2889 if (at( child1).shouldSpeculateUint32Array()) {2890 compilePutByValForIntTypedArray(m_jit.globalData()->uint32ArrayDescriptor(), node, sizeof(uint32_t), NoTypedArraySpecCheck, UnsignedTypedArray);2881 2882 if (at(node.child1()).shouldSpeculateUint32Array()) { 2883 compilePutByValForIntTypedArray(m_jit.globalData()->uint32ArrayDescriptor(), base.gpr(), property.gpr(), node, sizeof(uint32_t), NoTypedArraySpecCheck, UnsignedTypedArray); 2891 2884 if (!m_compileOkay) 2892 2885 return; 2893 2886 break; 2894 2887 } 2895 2896 if (at( child1).shouldSpeculateFloat32Array()) {2897 compilePutByValForFloatTypedArray(m_jit.globalData()->float32ArrayDescriptor(), node, sizeof(float), NoTypedArraySpecCheck);2888 2889 if (at(node.child1()).shouldSpeculateFloat32Array()) { 2890 compilePutByValForFloatTypedArray(m_jit.globalData()->float32ArrayDescriptor(), base.gpr(), property.gpr(), node, sizeof(float), NoTypedArraySpecCheck); 2898 2891 if (!m_compileOkay) 2899 2892 return; 2900 2893 break; 2901 2894 } 2902 2903 if (at( child1).shouldSpeculateFloat64Array()) {2904 compilePutByValForFloatTypedArray(m_jit.globalData()->float64ArrayDescriptor(), node, sizeof(double), NoTypedArraySpecCheck);2895 2896 if (at(node.child1()).shouldSpeculateFloat64Array()) { 2897 compilePutByValForFloatTypedArray(m_jit.globalData()->float64ArrayDescriptor(), base.gpr(), property.gpr(), node, sizeof(double), NoTypedArraySpecCheck); 2905 2898 if (!m_compileOkay) 2906 2899 return; … … 2908 2901 } 2909 2902 2910 SpeculateCellOperand base(this, child1); 2911 SpeculateStrictInt32Operand property(this, child2); 2912 JSValueOperand value(this, child3); 2913 2914 { 2915 GPRTemporary scratch(this); 2916 GPRReg scratchReg = scratch.gpr(); 2917 writeBarrier(base.gpr(), value.gpr(), child3, WriteBarrierForPropertyAccess, scratchReg); 2918 } 2919 StorageOperand storage(this, child4); 2903 JSValueOperand value(this, node.child3()); 2904 GPRTemporary scratch(this); 2905 2906 GPRReg baseReg = base.gpr(); 2907 GPRReg scratchReg = scratch.gpr(); 2908 2909 writeBarrier(base.gpr(), value.gpr(), node.child3(), WriteBarrierForPropertyAccess, scratchReg); 2910 2920 2911 // Get the array storage. 2921 GPRReg storageReg = storage.gpr(); 2912 GPRReg storageReg = scratchReg; 2913 m_jit.loadPtr(MacroAssembler::Address(baseReg, JSArray::storageOffset()), storageReg); 2922 2914 2923 2915 // Store the value to the array.
Note:
See TracChangeset
for help on using the changeset viewer.