Changeset 230626 in webkit
- Timestamp:
- Apr 13, 2018, 2:05:52 AM (8 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 6 edited
-
ChangeLog (modified) (1 diff)
-
dfg/DFGSpeculativeJIT.cpp (modified) (2 diffs)
-
dfg/DFGSpeculativeJIT.h (modified) (1 diff)
-
dfg/DFGSpeculativeJIT32_64.cpp (modified) (2 diffs)
-
dfg/DFGSpeculativeJIT64.cpp (modified) (2 diffs)
-
jit/AssemblyHelpers.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r230592 r230626 1 2018-04-13 Yusuke Suzuki <utatane.tea@gmail.com> 2 3 [DFG] Remove duplicate 32bit ProfileType implementation 4 https://bugs.webkit.org/show_bug.cgi?id=184536 5 6 Reviewed by Saam Barati. 7 8 This patch removes duplicate 32bit ProfileType implementation by unifying 32/64 implementations. 9 10 * dfg/DFGSpeculativeJIT.cpp: 11 (JSC::DFG::SpeculativeJIT::compileProfileType): 12 * dfg/DFGSpeculativeJIT.h: 13 * dfg/DFGSpeculativeJIT32_64.cpp: 14 (JSC::DFG::SpeculativeJIT::compile): 15 * dfg/DFGSpeculativeJIT64.cpp: 16 (JSC::DFG::SpeculativeJIT::compile): 17 * jit/AssemblyHelpers.h: 18 (JSC::AssemblyHelpers::branchIfUndefined): 19 (JSC::AssemblyHelpers::branchIfNull): 20 1 21 2018-04-12 Mark Lam <mark.lam@apple.com> 2 22 -
trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp
r230577 r230626 62 62 #include "ScratchRegisterAllocator.h" 63 63 #include "SuperSampler.h" 64 #include "TypeProfilerLog.h" 64 65 #include "WeakMapImpl.h" 65 66 #include <wtf/BitVector.h> … … 12797 12798 } 12798 12799 12800 void SpeculativeJIT::compileProfileType(Node* node) 12801 { 12802 JSValueOperand value(this, node->child1()); 12803 GPRTemporary scratch1(this); 12804 GPRTemporary scratch2(this); 12805 GPRTemporary scratch3(this); 12806 12807 JSValueRegs valueRegs = value.jsValueRegs(); 12808 GPRReg scratch1GPR = scratch1.gpr(); 12809 GPRReg scratch2GPR = scratch2.gpr(); 12810 GPRReg scratch3GPR = scratch3.gpr(); 12811 12812 MacroAssembler::JumpList jumpToEnd; 12813 12814 jumpToEnd.append(m_jit.branchIfEmpty(valueRegs)); 12815 12816 TypeLocation* cachedTypeLocation = node->typeLocation(); 12817 // Compile in a predictive type check, if possible, to see if we can skip writing to the log. 12818 // These typechecks are inlined to match those of the 64-bit JSValue type checks. 12819 if (cachedTypeLocation->m_lastSeenType == TypeUndefined) 12820 jumpToEnd.append(m_jit.branchIfUndefined(valueRegs)); 12821 else if (cachedTypeLocation->m_lastSeenType == TypeNull) 12822 jumpToEnd.append(m_jit.branchIfNull(valueRegs)); 12823 else if (cachedTypeLocation->m_lastSeenType == TypeBoolean) 12824 jumpToEnd.append(m_jit.branchIfBoolean(valueRegs, scratch1GPR)); 12825 else if (cachedTypeLocation->m_lastSeenType == TypeAnyInt) 12826 jumpToEnd.append(m_jit.branchIfInt32(valueRegs)); 12827 else if (cachedTypeLocation->m_lastSeenType == TypeNumber) 12828 jumpToEnd.append(m_jit.branchIfNumber(valueRegs, scratch1GPR)); 12829 else if (cachedTypeLocation->m_lastSeenType == TypeString) { 12830 MacroAssembler::Jump isNotCell = m_jit.branchIfNotCell(valueRegs); 12831 jumpToEnd.append(m_jit.branchIfString(valueRegs.payloadGPR())); 12832 isNotCell.link(&m_jit); 12833 } 12834 12835 // Load the TypeProfilerLog into Scratch2. 12836 TypeProfilerLog* cachedTypeProfilerLog = m_jit.vm()->typeProfilerLog(); 12837 m_jit.move(TrustedImmPtr(cachedTypeProfilerLog), scratch2GPR); 12838 12839 // Load the next LogEntry into Scratch1. 12840 m_jit.loadPtr(MacroAssembler::Address(scratch2GPR, TypeProfilerLog::currentLogEntryOffset()), scratch1GPR); 12841 12842 // Store the JSValue onto the log entry. 12843 m_jit.storeValue(valueRegs, MacroAssembler::Address(scratch1GPR, TypeProfilerLog::LogEntry::valueOffset())); 12844 12845 // Store the structureID of the cell if valueRegs is a cell, otherwise, store 0 on the log entry. 12846 MacroAssembler::Jump isNotCell = m_jit.branchIfNotCell(valueRegs); 12847 m_jit.load32(MacroAssembler::Address(valueRegs.payloadGPR(), JSCell::structureIDOffset()), scratch3GPR); 12848 m_jit.store32(scratch3GPR, MacroAssembler::Address(scratch1GPR, TypeProfilerLog::LogEntry::structureIDOffset())); 12849 MacroAssembler::Jump skipIsCell = m_jit.jump(); 12850 isNotCell.link(&m_jit); 12851 m_jit.store32(TrustedImm32(0), MacroAssembler::Address(scratch1GPR, TypeProfilerLog::LogEntry::structureIDOffset())); 12852 skipIsCell.link(&m_jit); 12853 12854 // Store the typeLocation on the log entry. 12855 m_jit.move(TrustedImmPtr(cachedTypeLocation), scratch3GPR); 12856 m_jit.storePtr(scratch3GPR, MacroAssembler::Address(scratch1GPR, TypeProfilerLog::LogEntry::locationOffset())); 12857 12858 // Increment the current log entry. 12859 m_jit.addPtr(TrustedImm32(sizeof(TypeProfilerLog::LogEntry)), scratch1GPR); 12860 m_jit.storePtr(scratch1GPR, MacroAssembler::Address(scratch2GPR, TypeProfilerLog::currentLogEntryOffset())); 12861 MacroAssembler::Jump clearLog = m_jit.branchPtr(MacroAssembler::Equal, scratch1GPR, TrustedImmPtr(cachedTypeProfilerLog->logEndPtr())); 12862 addSlowPathGenerator( 12863 slowPathCall(clearLog, this, operationProcessTypeProfilerLogDFG, NoResult)); 12864 12865 jumpToEnd.link(&m_jit); 12866 12867 noResult(node); 12868 } 12869 12799 12870 void SpeculativeJIT::cachedPutById(CodeOrigin codeOrigin, GPRReg baseGPR, JSValueRegs valueRegs, GPRReg scratchGPR, unsigned identifierNumber, PutKind putKind, JITCompiler::Jump slowPathTarget, SpillRegistersMode spillMode) 12800 12871 { -
trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.h
r230543 r230626 1521 1521 void compileHasIndexedProperty(Node*); 1522 1522 void compileExtractCatchLocal(Node*); 1523 void compileProfileType(Node*); 1523 1524 1524 1525 void moveTrueTo(GPRReg); -
trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT32_64.cpp
r230577 r230626 45 45 #include "JSCInlines.h" 46 46 #include "SetupVarargsFrame.h" 47 #include "TypeProfilerLog.h"48 47 #include "Watchdog.h" 49 48 … … 4024 4023 } 4025 4024 case ProfileType: { 4026 JSValueOperand value(this, node->child1()); 4027 GPRTemporary scratch1(this); 4028 GPRTemporary scratch2(this); 4029 GPRTemporary scratch3(this); 4030 4031 GPRReg scratch1GPR = scratch1.gpr(); 4032 GPRReg scratch2GPR = scratch2.gpr(); 4033 GPRReg scratch3GPR = scratch3.gpr(); 4034 4035 JITCompiler::Jump isTDZValue = m_jit.branch32(JITCompiler::Equal, value.tagGPR(), TrustedImm32(JSValue::EmptyValueTag)); 4036 4037 // Load the TypeProfilerLog into Scratch2. 4038 TypeProfilerLog* cachedTypeProfilerLog = m_jit.vm()->typeProfilerLog(); 4039 m_jit.move(TrustedImmPtr(cachedTypeProfilerLog), scratch2GPR); 4040 4041 // Load the next LogEntry into Scratch1. 4042 m_jit.loadPtr(MacroAssembler::Address(scratch2GPR, TypeProfilerLog::currentLogEntryOffset()), scratch1GPR); 4043 4044 // Store the JSValue onto the log entry. 4045 m_jit.store32(value.tagGPR(), MacroAssembler::Address(scratch1GPR, TypeProfilerLog::LogEntry::valueOffset() + OBJECT_OFFSETOF(JSValue, u.asBits.tag))); 4046 m_jit.store32(value.payloadGPR(), MacroAssembler::Address(scratch1GPR, TypeProfilerLog::LogEntry::valueOffset() + OBJECT_OFFSETOF(JSValue, u.asBits.payload))); 4047 4048 // Store the structureID of the cell if valueGPR is a cell, otherwise, store 0 on the log entry. 4049 MacroAssembler::Jump isNotCell = m_jit.branchIfNotCell(value.jsValueRegs()); 4050 m_jit.load32(MacroAssembler::Address(value.payloadGPR(), JSCell::structureIDOffset()), scratch3GPR); 4051 m_jit.store32(scratch3GPR, MacroAssembler::Address(scratch1GPR, TypeProfilerLog::LogEntry::structureIDOffset())); 4052 MacroAssembler::Jump skipIsCell = m_jit.jump(); 4053 isNotCell.link(&m_jit); 4054 m_jit.store32(TrustedImm32(0), MacroAssembler::Address(scratch1GPR, TypeProfilerLog::LogEntry::structureIDOffset())); 4055 skipIsCell.link(&m_jit); 4056 4057 // Store the typeLocation on the log entry. 4058 TypeLocation* cachedTypeLocation = node->typeLocation(); 4059 m_jit.move(TrustedImmPtr(cachedTypeLocation), scratch3GPR); 4060 m_jit.storePtr(scratch3GPR, MacroAssembler::Address(scratch1GPR, TypeProfilerLog::LogEntry::locationOffset())); 4061 4062 // Increment the current log entry. 4063 m_jit.addPtr(TrustedImm32(sizeof(TypeProfilerLog::LogEntry)), scratch1GPR); 4064 m_jit.storePtr(scratch1GPR, MacroAssembler::Address(scratch2GPR, TypeProfilerLog::currentLogEntryOffset())); 4065 MacroAssembler::Jump clearLog = m_jit.branchPtr(MacroAssembler::Equal, scratch1GPR, TrustedImmPtr(cachedTypeProfilerLog->logEndPtr())); 4066 addSlowPathGenerator( 4067 slowPathCall(clearLog, this, operationProcessTypeProfilerLogDFG, NoResult)); 4068 4069 isTDZValue.link(&m_jit); 4070 4071 noResult(node); 4025 compileProfileType(node); 4072 4026 break; 4073 4027 } -
trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp
r230577 r230626 48 48 #include "SpillRegistersMode.h" 49 49 #include "StringPrototype.h" 50 #include "TypeProfilerLog.h"51 50 #include "Watchdog.h" 52 51 … … 4576 4575 } 4577 4576 case ProfileType: { 4578 JSValueOperand value(this, node->child1()); 4579 GPRTemporary scratch1(this); 4580 GPRTemporary scratch2(this); 4581 GPRTemporary scratch3(this); 4582 4583 GPRReg scratch1GPR = scratch1.gpr(); 4584 GPRReg scratch2GPR = scratch2.gpr(); 4585 GPRReg scratch3GPR = scratch3.gpr(); 4586 GPRReg valueGPR = value.gpr(); 4587 4588 MacroAssembler::JumpList jumpToEnd; 4589 4590 jumpToEnd.append(m_jit.branchTest64(JITCompiler::Zero, valueGPR)); 4591 4592 TypeLocation* cachedTypeLocation = node->typeLocation(); 4593 // Compile in a predictive type check, if possible, to see if we can skip writing to the log. 4594 // These typechecks are inlined to match those of the 64-bit JSValue type checks. 4595 if (cachedTypeLocation->m_lastSeenType == TypeUndefined) 4596 jumpToEnd.append(m_jit.branch64(MacroAssembler::Equal, valueGPR, MacroAssembler::TrustedImm64(JSValue::encode(jsUndefined())))); 4597 else if (cachedTypeLocation->m_lastSeenType == TypeNull) 4598 jumpToEnd.append(m_jit.branch64(MacroAssembler::Equal, valueGPR, MacroAssembler::TrustedImm64(JSValue::encode(jsNull())))); 4599 else if (cachedTypeLocation->m_lastSeenType == TypeBoolean) { 4600 m_jit.move(valueGPR, scratch2GPR); 4601 m_jit.and64(TrustedImm32(~1), scratch2GPR); 4602 jumpToEnd.append(m_jit.branch64(MacroAssembler::Equal, scratch2GPR, MacroAssembler::TrustedImm64(ValueFalse))); 4603 } else if (cachedTypeLocation->m_lastSeenType == TypeAnyInt) 4604 jumpToEnd.append(m_jit.branch64(MacroAssembler::AboveOrEqual, valueGPR, GPRInfo::tagTypeNumberRegister)); 4605 else if (cachedTypeLocation->m_lastSeenType == TypeNumber) 4606 jumpToEnd.append(m_jit.branchTest64(MacroAssembler::NonZero, valueGPR, GPRInfo::tagTypeNumberRegister)); 4607 else if (cachedTypeLocation->m_lastSeenType == TypeString) { 4608 MacroAssembler::Jump isNotCell = m_jit.branchIfNotCell(JSValueRegs(valueGPR)); 4609 jumpToEnd.append(m_jit.branchIfString(valueGPR)); 4610 isNotCell.link(&m_jit); 4611 } 4612 4613 // Load the TypeProfilerLog into Scratch2. 4614 TypeProfilerLog* cachedTypeProfilerLog = m_jit.vm()->typeProfilerLog(); 4615 m_jit.move(TrustedImmPtr(cachedTypeProfilerLog), scratch2GPR); 4616 4617 // Load the next LogEntry into Scratch1. 4618 m_jit.loadPtr(MacroAssembler::Address(scratch2GPR, TypeProfilerLog::currentLogEntryOffset()), scratch1GPR); 4619 4620 // Store the JSValue onto the log entry. 4621 m_jit.store64(valueGPR, MacroAssembler::Address(scratch1GPR, TypeProfilerLog::LogEntry::valueOffset())); 4622 4623 // Store the structureID of the cell if valueGPR is a cell, otherwise, store 0 on the log entry. 4624 MacroAssembler::Jump isNotCell = m_jit.branchIfNotCell(JSValueRegs(valueGPR)); 4625 m_jit.load32(MacroAssembler::Address(valueGPR, JSCell::structureIDOffset()), scratch3GPR); 4626 m_jit.store32(scratch3GPR, MacroAssembler::Address(scratch1GPR, TypeProfilerLog::LogEntry::structureIDOffset())); 4627 MacroAssembler::Jump skipIsCell = m_jit.jump(); 4628 isNotCell.link(&m_jit); 4629 m_jit.store32(TrustedImm32(0), MacroAssembler::Address(scratch1GPR, TypeProfilerLog::LogEntry::structureIDOffset())); 4630 skipIsCell.link(&m_jit); 4631 4632 // Store the typeLocation on the log entry. 4633 m_jit.move(TrustedImmPtr(cachedTypeLocation), scratch3GPR); 4634 m_jit.storePtr(scratch3GPR, MacroAssembler::Address(scratch1GPR, TypeProfilerLog::LogEntry::locationOffset())); 4635 4636 // Increment the current log entry. 4637 m_jit.addPtr(TrustedImm32(sizeof(TypeProfilerLog::LogEntry)), scratch1GPR); 4638 m_jit.storePtr(scratch1GPR, MacroAssembler::Address(scratch2GPR, TypeProfilerLog::currentLogEntryOffset())); 4639 MacroAssembler::Jump clearLog = m_jit.branchPtr(MacroAssembler::Equal, scratch1GPR, TrustedImmPtr(cachedTypeProfilerLog->logEndPtr())); 4640 addSlowPathGenerator( 4641 slowPathCall(clearLog, this, operationProcessTypeProfilerLogDFG, NoResult)); 4642 4643 jumpToEnd.link(&m_jit); 4644 4645 noResult(node); 4577 compileProfileType(node); 4646 4578 break; 4647 4579 } -
trunk/Source/JavaScriptCore/jit/AssemblyHelpers.h
r230549 r230626 911 911 #else 912 912 return branch32(Equal, regs.tagGPR(), TrustedImm32(JSValue::EmptyValueTag)); 913 #endif 914 } 915 916 // Note that this function does not respect MasqueradesAsUndefined. 917 Jump branchIfUndefined(JSValueRegs regs) 918 { 919 #if USE(JSVALUE64) 920 return branch64(Equal, regs.gpr(), TrustedImm64(JSValue::encode(jsUndefined()))); 921 #else 922 return branch32(Equal, regs.tagGPR(), TrustedImm32(JSValue::UndefinedTag)); 923 #endif 924 } 925 926 Jump branchIfNull(JSValueRegs regs) 927 { 928 #if USE(JSVALUE64) 929 return branch64(Equal, regs.gpr(), TrustedImm64(JSValue::encode(jsNull()))); 930 #else 931 return branch32(Equal, regs.tagGPR(), TrustedImm32(JSValue::NullTag)); 913 932 #endif 914 933 }
Note:
See TracChangeset
for help on using the changeset viewer.