Changeset 94629 in webkit for trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp
- Timestamp:
- Sep 6, 2011, 7:47:51 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp
r93934 r94629 129 129 case DataFormatDouble: 130 130 case DataFormatCell: 131 case DataFormatBoolean: 131 132 case DataFormatJSDouble: 132 case DataFormatJSCell: { 133 case DataFormatJSCell: 134 case DataFormatJSBoolean: { 133 135 terminateSpeculativeExecution(); 134 136 returnFormat = DataFormatInteger; … … 224 226 225 227 switch (info.registerFormat()) { 226 case DataFormatNone: 227 // Should have filled, above.228 case DataFormatNone: // Should have filled, above. 229 case DataFormatBoolean: // This type never occurs. 228 230 ASSERT_NOT_REACHED(); 229 231 230 232 case DataFormatCell: 231 233 case DataFormatJSCell: 232 case DataFormatJS: { 234 case DataFormatJS: 235 case DataFormatJSBoolean: { 233 236 GPRReg jsValueGpr = info.gpr(); 234 237 m_gprs.lock(jsValueGpr); … … 350 353 case DataFormatInteger: 351 354 case DataFormatJSDouble: 352 case DataFormatDouble: { 355 case DataFormatDouble: 356 case DataFormatJSBoolean: 357 case DataFormatBoolean: { 358 terminateSpeculativeExecution(); 359 return allocate(); 360 } 361 } 362 363 ASSERT_NOT_REACHED(); 364 return InvalidGPRReg; 365 } 366 367 GPRReg SpeculativeJIT::fillSpeculateBoolean(NodeIndex nodeIndex) 368 { 369 Node& node = m_jit.graph()[nodeIndex]; 370 VirtualRegister virtualRegister = node.virtualRegister(); 371 GenerationInfo& info = m_generationInfo[virtualRegister]; 372 373 switch (info.registerFormat()) { 374 case DataFormatNone: { 375 GPRReg gpr = allocate(); 376 377 if (node.isConstant()) { 378 JSValue jsValue = valueOfJSConstant(nodeIndex); 379 if (jsValue.isBoolean()) { 380 m_gprs.retain(gpr, virtualRegister, SpillOrderConstant); 381 m_jit.move(MacroAssembler::TrustedImmPtr(JSValue::encode(jsValue)), gpr); 382 info.fillJSValue(gpr, DataFormatJSBoolean); 383 return gpr; 384 } 385 terminateSpeculativeExecution(); 386 return gpr; 387 } 388 ASSERT(info.spillFormat() & DataFormatJS); 389 m_gprs.retain(gpr, virtualRegister, SpillOrderSpilled); 390 m_jit.loadPtr(JITCompiler::addressFor(virtualRegister), gpr); 391 392 info.fillJSValue(gpr, DataFormatJS); 393 if (info.spillFormat() != DataFormatJSBoolean) { 394 m_jit.xorPtr(TrustedImm32(static_cast<int32_t>(ValueFalse)), gpr); 395 speculationCheck(m_jit.branchTestPtr(MacroAssembler::NonZero, gpr, TrustedImm32(static_cast<int32_t>(~1))), SpeculationRecovery(BooleanSpeculationCheck, gpr, InvalidGPRReg)); 396 m_jit.xorPtr(TrustedImm32(static_cast<int32_t>(ValueFalse)), gpr); 397 } 398 info.fillJSValue(gpr, DataFormatJSBoolean); 399 return gpr; 400 } 401 402 case DataFormatBoolean: 403 case DataFormatJSBoolean: { 404 GPRReg gpr = info.gpr(); 405 m_gprs.lock(gpr); 406 return gpr; 407 } 408 409 case DataFormatJS: { 410 GPRReg gpr = info.gpr(); 411 m_gprs.lock(gpr); 412 m_jit.xorPtr(TrustedImm32(static_cast<int32_t>(ValueFalse)), gpr); 413 speculationCheck(m_jit.branchTestPtr(MacroAssembler::NonZero, gpr, TrustedImm32(static_cast<int32_t>(~1))), SpeculationRecovery(BooleanSpeculationCheck, gpr, InvalidGPRReg)); 414 m_jit.xorPtr(TrustedImm32(static_cast<int32_t>(ValueFalse)), gpr); 415 info.fillJSValue(gpr, DataFormatJSBoolean); 416 return gpr; 417 } 418 419 case DataFormatJSInteger: 420 case DataFormatInteger: 421 case DataFormatJSDouble: 422 case DataFormatDouble: 423 case DataFormatJSCell: 424 case DataFormatCell: { 353 425 terminateSpeculativeExecution(); 354 426 return allocate(); … … 529 601 // If we add a DataFormatBool, we should use it here. 530 602 m_jit.or32(TrustedImm32(ValueFalse), result.gpr()); 531 jsValueResult(result.gpr(), m_compileIndex );603 jsValueResult(result.gpr(), m_compileIndex, DataFormatJSBoolean); 532 604 } 533 605 … … 562 634 VirtualRegister virtualRegister = node.virtualRegister(); 563 635 m_gprs.retain(result.gpr(), virtualRegister, SpillOrderJS); 564 m_generationInfo[virtualRegister].initJSValue(m_compileIndex, node.refCount(), result.gpr(), isArrayPrediction(prediction) ? DataFormatJSCell : DataFormatJS); 636 637 DataFormat format; 638 if (isArrayPrediction(prediction)) 639 format = DataFormatJSCell; 640 else if (isBooleanPrediction(prediction)) 641 format = DataFormatJSBoolean; 642 else 643 format = DataFormatJS; 644 645 m_generationInfo[virtualRegister].initJSValue(m_compileIndex, node.refCount(), result.gpr(), format); 565 646 } 566 647 break; … … 579 660 m_jit.storePtr(cellGPR, JITCompiler::addressFor(node.local())); 580 661 noResult(m_compileIndex); 662 } else if (isBooleanPrediction(predictedType)) { 663 SpeculateBooleanOperand boolean(this, node.child1()); 664 m_jit.storePtr(boolean.gpr(), JITCompiler::addressFor(node.local())); 665 noResult(m_compileIndex); 581 666 } else { 582 667 JSValueOperand value(this, node.child1()); … … 842 927 843 928 case LogicalNot: { 929 if (isKnownBoolean(node.child1())) { 930 SpeculateBooleanOperand value(this, node.child1()); 931 GPRTemporary result(this, value); 932 933 m_jit.move(value.gpr(), result.gpr()); 934 m_jit.xorPtr(TrustedImm32(true), result.gpr()); 935 936 jsValueResult(result.gpr(), m_compileIndex, DataFormatJSBoolean); 937 break; 938 } 939 844 940 JSValueOperand value(this, node.child1()); 845 941 GPRTemporary result(this); // FIXME: We could reuse, but on speculation fail would need recovery to restore tag (akin to add). … … 851 947 852 948 // If we add a DataFormatBool, we should use it here. 853 jsValueResult(result.gpr(), m_compileIndex );949 jsValueResult(result.gpr(), m_compileIndex, DataFormatJSBoolean); 854 950 break; 855 951 } … … 1228 1324 1229 1325 putResult.link(&m_jit); 1230 jsValueResult(scratchReg, m_compileIndex );1326 jsValueResult(scratchReg, m_compileIndex, DataFormatJSBoolean); 1231 1327 break; 1232 1328 }
Note:
See TracChangeset
for help on using the changeset viewer.