WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
work in progress
blah.patch (text/plain), 18.74 KB, created by
Filip Pizlo
on 2013-11-08 22:44:33 PST
(
hide
)
Description:
work in progress
Filename:
MIME Type:
Creator:
Filip Pizlo
Created:
2013-11-08 22:44:33 PST
Size:
18.74 KB
patch
obsolete
>Index: Source/JavaScriptCore/ftl/FTLAbbreviations.h >=================================================================== >--- Source/JavaScriptCore/ftl/FTLAbbreviations.h (revision 158984) >+++ Source/JavaScriptCore/ftl/FTLAbbreviations.h (working copy) >@@ -271,6 +271,7 @@ static inline LValue buildCall(LBuilder > } > enum TailCallMode { IsNotTailCall, IsTailCall }; > static inline void setTailCall(LValue call, TailCallMode mode) { llvm->SetTailCall(call, mode == IsTailCall); } >+static inline void setInstructionCallingConvention(LValue instruction, unsigned callingConvention) { llvm->SetInstructionCallConv(instruction, callingConvention); } > static inline LValue buildExtractValue(LBuilder builder, LValue aggVal, unsigned index) { return llvm->BuildExtractValue(builder, aggVal, index, ""); } > static inline LValue buildSelect(LBuilder builder, LValue condition, LValue taken, LValue notTaken) { return llvm->BuildSelect(builder, condition, taken, notTaken, ""); } > static inline LValue buildBr(LBuilder builder, LBasicBlock destination) { return llvm->BuildBr(builder, destination); } >Index: Source/JavaScriptCore/ftl/FTLCallingConventions.h >=================================================================== >--- Source/JavaScriptCore/ftl/FTLCallingConventions.h (revision 0) >+++ Source/JavaScriptCore/ftl/FTLCallingConventions.h (working copy) >@@ -0,0 +1,37 @@ >+/* >+ * Copyright (C) 2013 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY >+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE >+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR >+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, >+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, >+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR >+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY >+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT >+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE >+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#ifndef FTLCallingConventions_h >+#define FTLCallingConventions_h >+ >+namespace JSC { namespace FTL { namespace CallingConventions { >+ >+inline unsigned webKitJS() { return 12; } >+inline unsigned anyReg() { return 13; } >+ >+} } } // namespace JSC::FTL::CallingConventions >+ >+#endif // FTLCallingConventions_h >+ >Index: Source/JavaScriptCore/ftl/FTLCompile.cpp >=================================================================== >--- Source/JavaScriptCore/ftl/FTLCompile.cpp (revision 158984) >+++ Source/JavaScriptCore/ftl/FTLCompile.cpp (working copy) >@@ -188,14 +188,12 @@ static void fixFunctionBasedOnStackMaps( > > StackMaps::Record& record = iter->value; > >- UNUSED_PARAM(record); // FIXME: use AnyRegs. >- > // FIXME: LLVM should tell us which registers are live. > RegisterSet usedRegisters = RegisterSet::allRegisters(); > >- GPRReg callFrameRegister = GPRInfo::argumentGPR0; >- GPRReg base = GPRInfo::argumentGPR1; >- GPRReg result = GPRInfo::returnValueGPR; >+ GPRReg result = record.locations[0].directGPR(); >+ GPRReg callFrameRegister = record.locations[1].directGPR(); >+ GPRReg base = record.locations[2].directGPR(); > > JITGetByIdGenerator gen( > codeBlock, getById.codeOrigin(), usedRegisters, callFrameRegister, >@@ -224,14 +222,12 @@ static void fixFunctionBasedOnStackMaps( > > StackMaps::Record& record = iter->value; > >- UNUSED_PARAM(record); // FIXME: use AnyRegs. >- > // FIXME: LLVM should tell us which registers are live. > RegisterSet usedRegisters = RegisterSet::allRegisters(); > >- GPRReg callFrameRegister = GPRInfo::argumentGPR0; >- GPRReg base = GPRInfo::argumentGPR1; >- GPRReg value = GPRInfo::argumentGPR2; >+ GPRReg callFrameRegister = record.locations[0].directGPR(); >+ GPRReg base = record.locations[1].directGPR(); >+ GPRReg value = record.locations[2].directGPR(); > > JITPutByIdGenerator gen( > codeBlock, putById.codeOrigin(), usedRegisters, callFrameRegister, >Index: Source/JavaScriptCore/ftl/FTLInlineCacheSize.cpp >=================================================================== >--- Source/JavaScriptCore/ftl/FTLInlineCacheSize.cpp (revision 158984) >+++ Source/JavaScriptCore/ftl/FTLInlineCacheSize.cpp (working copy) >@@ -33,38 +33,14 @@ > > namespace JSC { namespace FTL { > >-static size_t s_sizeOfGetById; >-static size_t s_sizeOfPutById; >- > size_t sizeOfGetById() > { >- if (s_sizeOfGetById) >- return s_sizeOfGetById; >- >- MacroAssembler jit; >- >- JITGetByIdGenerator generator( >- 0, CodeOrigin(), RegisterSet(), GPRInfo::callFrameRegister, >- JSValueRegs(GPRInfo::regT6), JSValueRegs(GPRInfo::regT7), false); >- generator.generateFastPath(jit); >- >- return s_sizeOfGetById = jit.m_assembler.codeSize(); >+ return 28; > } > > size_t sizeOfPutById() > { >- if (s_sizeOfPutById) >- return s_sizeOfPutById; >- >- MacroAssembler jit; >- >- JITPutByIdGenerator generator( >- 0, CodeOrigin(), RegisterSet(), GPRInfo::callFrameRegister, >- JSValueRegs(GPRInfo::regT6), JSValueRegs(GPRInfo::regT7), GPRInfo::regT8, false, >- NotStrictMode, NotDirect); >- generator.generateFastPath(jit); >- >- return s_sizeOfPutById = jit.m_assembler.codeSize(); >+ return 32; > } > > } } // namespace JSC::FTL >Index: Source/JavaScriptCore/ftl/FTLJITFinalizer.cpp >=================================================================== >--- Source/JavaScriptCore/ftl/FTLJITFinalizer.cpp (revision 158984) >+++ Source/JavaScriptCore/ftl/FTLJITFinalizer.cpp (working copy) >@@ -75,7 +75,7 @@ bool JITFinalizer::finalizeFunction() > CodeLocationLabel( > m_plan.vm.ftlThunks->getOSRExitGenerationThunk( > m_plan.vm, Location::forStackmaps( >- jitCode->stackmaps, iter->value.locations[0])).code())); >+ &jitCode->stackmaps, iter->value.locations[0])).code())); > } > > jitCode->initializeExitThunks( >Index: Source/JavaScriptCore/ftl/FTLLocation.cpp >=================================================================== >--- Source/JavaScriptCore/ftl/FTLLocation.cpp (revision 158984) >+++ Source/JavaScriptCore/ftl/FTLLocation.cpp (working copy) >@@ -35,7 +35,7 @@ > > namespace JSC { namespace FTL { > >-Location Location::forStackmaps(const StackMaps& stackmaps, const StackMaps::Location& location) >+Location Location::forStackmaps(const StackMaps* stackmaps, const StackMaps::Location& location) > { > switch (location.kind) { > case StackMaps::Location::Unprocessed: >@@ -53,7 +53,8 @@ Location Location::forStackmaps(const St > return forConstant(location.offset); > > case StackMaps::Location::ConstantIndex: >- return forConstant(stackmaps.constants[location.offset].integer); >+ ASSERT(stackmaps); >+ return forConstant(stackmaps->constants[location.offset].integer); > } > > RELEASE_ASSERT_NOT_REACHED(); >Index: Source/JavaScriptCore/ftl/FTLLocation.h >=================================================================== >--- Source/JavaScriptCore/ftl/FTLLocation.h (revision 158984) >+++ Source/JavaScriptCore/ftl/FTLLocation.h (working copy) >@@ -84,7 +84,9 @@ public: > return result; > } > >- static Location forStackmaps(const StackMaps&, const StackMaps::Location&); >+ // You can pass a null StackMaps if you are confident that the location doesn't >+ // involve a wide constant. >+ static Location forStackmaps(const StackMaps*, const StackMaps::Location&); > > Kind kind() const { return m_kind; } > >Index: Source/JavaScriptCore/ftl/FTLLowerDFGToLLVM.cpp >=================================================================== >--- Source/JavaScriptCore/ftl/FTLLowerDFGToLLVM.cpp (revision 158984) >+++ Source/JavaScriptCore/ftl/FTLLowerDFGToLLVM.cpp (working copy) >@@ -32,6 +32,7 @@ > #include "DFGAbstractInterpreterInlines.h" > #include "DFGInPlaceAbstractState.h" > #include "FTLAbstractHeapRepository.h" >+#include "FTLCallingConventions.h" > #include "FTLForOSREntryJITCode.h" > #include "FTLFormattedValue.h" > #include "FTLInlineCacheSize.h" >@@ -1275,10 +1276,12 @@ private: > > // Arguments: id, bytes, target, numArgs, args... > unsigned stackmapID = m_stackmapIDs++; >- setJSValue(m_out.call( >+ LValue call = m_out.call( > m_out.patchpointInt64Intrinsic(), > m_out.constInt32(stackmapID), m_out.constInt32(sizeOfGetById()), >- constNull(m_out.ref8), m_out.constInt32(2), m_callFrame, base)); >+ constNull(m_out.ref8), m_out.constInt32(2), m_callFrame, base); >+ setInstructionCallingConvention(call, CallingConventions::anyReg()); >+ setJSValue(call); > > m_ftlState.getByIds.append(GetByIdDescriptor(stackmapID, m_node->codeOrigin, uid)); > } >@@ -1294,10 +1297,11 @@ private: > > // Arguments: id, bytes, target, numArgs, args... > unsigned stackmapID = m_stackmapIDs++; >- m_out.call( >+ LValue call = m_out.call( > m_out.patchpointVoidIntrinsic(), > m_out.constInt32(stackmapID), m_out.constInt32(sizeOfPutById()), > constNull(m_out.ref8), m_out.constInt32(3), m_callFrame, base, value); >+ setInstructionCallingConvention(call, CallingConventions::anyReg()); > > m_ftlState.putByIds.append(PutByIdDescriptor( > stackmapID, m_node->codeOrigin, uid, >Index: Source/JavaScriptCore/ftl/FTLSlowPathCall.cpp >=================================================================== >--- Source/JavaScriptCore/ftl/FTLSlowPathCall.cpp (revision 158984) >+++ Source/JavaScriptCore/ftl/FTLSlowPathCall.cpp (working copy) >@@ -64,20 +64,23 @@ public: > m_offsetToSavingArea = > (std::max(m_numArgs, NUMBER_OF_ARGUMENT_REGISTERS) - NUMBER_OF_ARGUMENT_REGISTERS) * wordSize; > >- unsigned numArgumentRegistersThatNeedSaving = 0; >- for (unsigned i = std::min(NUMBER_OF_ARGUMENT_REGISTERS, numArgs); i--;) { >- if (m_usedRegisters.get(GPRInfo::toArgumentRegister(i))) >- numArgumentRegistersThatNeedSaving++; >- } >+ for (unsigned i = std::min(NUMBER_OF_ARGUMENT_REGISTERS, numArgs); i--;) >+ m_callingConventionRegisters.set(GPRInfo::toArgumentRegister(i)); >+ if (returnRegister != InvalidGPRReg) >+ m_callingConventionRegisters.set(GPRInfo::returnValueGPR); >+ m_callingConventionRegisters.filter(m_usedRegisters); >+ >+ unsigned numberOfCallingConventionRegisters = >+ m_callingConventionRegisters.numberOfSetRegisters(); > > size_t offsetToThunkSavingArea = > m_offsetToSavingArea + >- numArgumentRegistersThatNeedSaving * wordSize; >+ numberOfCallingConventionRegisters * wordSize; > > m_stackBytesNeeded = > offsetToThunkSavingArea + > stackBytesNeededForReturnAddress + >- (m_usedRegisters.numberOfSetRegisters() - numArgumentRegistersThatNeedSaving) * wordSize; >+ (m_usedRegisters.numberOfSetRegisters() - numberOfCallingConventionRegisters) * wordSize; > > size_t stackAlignment = 16; > >@@ -87,11 +90,13 @@ public: > > m_thunkSaveSet = m_usedRegisters; > >- for (unsigned i = std::min(NUMBER_OF_ARGUMENT_REGISTERS, numArgs); i--;) { >- if (!m_usedRegisters.get(GPRInfo::toArgumentRegister(i))) >+ // This relies on all calling convention registers also being temp registers. >+ unsigned stackIndex = 0; >+ for (unsigned i = GPRInfo::numberOfRegisters; i--;) { >+ GPRReg reg = GPRInfo::toRegister(i); >+ if (!m_callingConventionRegisters.get(reg)) > continue; >- GPRReg reg = GPRInfo::toArgumentRegister(i); >- m_jit.storePtr(reg, CCallHelpers::Address(CCallHelpers::stackPointerRegister, m_offsetToSavingArea + i * wordSize)); >+ m_jit.storePtr(reg, CCallHelpers::Address(CCallHelpers::stackPointerRegister, m_offsetToSavingArea + (stackIndex++) * wordSize)); > m_thunkSaveSet.clear(reg); > } > >@@ -103,11 +108,12 @@ public: > if (m_returnRegister != InvalidGPRReg) > m_jit.move(GPRInfo::returnValueGPR, m_returnRegister); > >- for (unsigned i = std::min(NUMBER_OF_ARGUMENT_REGISTERS, m_numArgs); i--;) { >- if (!m_usedRegisters.get(GPRInfo::toArgumentRegister(i))) >+ unsigned stackIndex = 0; >+ for (unsigned i = GPRInfo::numberOfRegisters; i--;) { >+ GPRReg reg = GPRInfo::toRegister(i); >+ if (!m_callingConventionRegisters.get(reg)) > continue; >- GPRReg reg = GPRInfo::toArgumentRegister(i); >- m_jit.loadPtr(CCallHelpers::Address(CCallHelpers::stackPointerRegister, m_offsetToSavingArea + i * wordSize), reg); >+ m_jit.loadPtr(CCallHelpers::Address(CCallHelpers::stackPointerRegister, m_offsetToSavingArea + (stackIndex++) * wordSize), reg); > } > > m_jit.addPtr(CCallHelpers::TrustedImm32(m_stackBytesNeeded), CCallHelpers::stackPointerRegister); >@@ -139,6 +145,7 @@ public: > private: > State& m_state; > RegisterSet m_usedRegisters; >+ RegisterSet m_callingConventionRegisters; > CCallHelpers& m_jit; > unsigned m_numArgs; > GPRReg m_returnRegister; >Index: Source/JavaScriptCore/ftl/FTLStackMaps.cpp >=================================================================== >--- Source/JavaScriptCore/ftl/FTLStackMaps.cpp (revision 158984) >+++ Source/JavaScriptCore/ftl/FTLStackMaps.cpp (working copy) >@@ -66,15 +66,15 @@ void StackMaps::Location::dump(PrintStre > out.print("(", kind, ", reg", dwarfRegNum, ", ", offset, ")"); > } > >-GPRReg StackMaps::Location::directGPR(StackMaps& stackmaps) const >+GPRReg StackMaps::Location::directGPR() const > { >- return FTL::Location::forStackmaps(stackmaps, *this).directGPR(); >+ return FTL::Location::forStackmaps(0, *this).directGPR(); > } > > void StackMaps::Location::restoreInto( > MacroAssembler& jit, StackMaps& stackmaps, char* savedRegisters, GPRReg result) const > { >- FTL::Location::forStackmaps(stackmaps, *this).restoreInto(jit, savedRegisters, result); >+ FTL::Location::forStackmaps(&stackmaps, *this).restoreInto(jit, savedRegisters, result); > } > > bool StackMaps::Record::parse(DataView* view, unsigned& offset) >Index: Source/JavaScriptCore/ftl/FTLStackMaps.h >=================================================================== >--- Source/JavaScriptCore/ftl/FTLStackMaps.h (revision 158984) >+++ Source/JavaScriptCore/ftl/FTLStackMaps.h (working copy) >@@ -65,7 +65,7 @@ struct StackMaps { > void parse(DataView*, unsigned& offset); > void dump(PrintStream& out) const; > >- GPRReg directGPR(StackMaps&) const; >+ GPRReg directGPR() const; > void restoreInto(MacroAssembler&, StackMaps&, char* savedRegisters, GPRReg result) const; > }; > >Index: Source/JavaScriptCore/jit/FPRInfo.h >=================================================================== >--- Source/JavaScriptCore/jit/FPRInfo.h (revision 158984) >+++ Source/JavaScriptCore/jit/FPRInfo.h (working copy) >@@ -74,7 +74,10 @@ public: > } > static unsigned toIndex(FPRReg reg) > { >- return (unsigned)reg; >+ unsigned result = (unsigned)reg; >+ if (result >= numberOfRegisters) >+ return InvalidIndex; >+ return result; > } > > static FPRReg toArgumentRegister(unsigned index) >@@ -102,6 +105,8 @@ public: > #endif > return nameForRegister[reg]; > } >+ >+ static const unsigned InvalidIndex = 0xffffffff; > }; > > #endif >Index: Source/JavaScriptCore/jit/GPRInfo.h >=================================================================== >--- Source/JavaScriptCore/jit/GPRInfo.h (revision 158984) >+++ Source/JavaScriptCore/jit/GPRInfo.h (working copy) >@@ -421,9 +421,7 @@ public: > ASSERT(reg != InvalidGPRReg); > ASSERT(static_cast<int>(reg) < 16); > static const unsigned indexForRegister[16] = { 0, 2, 1, 3, InvalidIndex, InvalidIndex, 5, 4, 6, 7, 8, InvalidIndex, InvalidIndex, 9, InvalidIndex, InvalidIndex }; >- unsigned result = indexForRegister[reg]; >- ASSERT(result != InvalidIndex); >- return result; >+ return indexForRegister[reg]; > } > > static const char* debugName(GPRReg reg) >@@ -438,7 +436,6 @@ public: > }; > return nameForRegister[reg]; > } >-private: > > static const unsigned InvalidIndex = 0xffffffff; > }; >Index: Source/JavaScriptCore/jit/RegisterSet.h >=================================================================== >--- Source/JavaScriptCore/jit/RegisterSet.h (revision 158984) >+++ Source/JavaScriptCore/jit/RegisterSet.h (working copy) >@@ -81,6 +81,7 @@ public: > bool get(FPRReg reg) const { return m_vector.get(MacroAssembler::registerIndex(reg)); } > > void merge(const RegisterSet& other) { m_vector.merge(other.m_vector); } >+ void filter(const RegisterSet& other) { m_vector.filter(other.m_vector); } > void exclude(const RegisterSet& other) { m_vector.exclude(other.m_vector); } > > size_t numberOfSetRegisters() const { return m_vector.bitCount(); } >Index: Source/JavaScriptCore/jit/ScratchRegisterAllocator.h >=================================================================== >--- Source/JavaScriptCore/jit/ScratchRegisterAllocator.h (revision 158984) >+++ Source/JavaScriptCore/jit/ScratchRegisterAllocator.h (working copy) >@@ -44,9 +44,21 @@ public: > , m_didReuseRegisters(false) > { > } >- >- template<typename T> >- void lock(T reg) { m_lockedRegisters.set(reg); } >+ >+ void lock(GPRReg reg) >+ { >+ unsigned index = GPRInfo::toIndex(reg); >+ if (index == GPRInfo::InvalidIndex) >+ return; >+ m_lockedRegisters.setGPRByIndex(index); >+ } >+ void lock(FPRReg reg) >+ { >+ unsigned index = FPRInfo::toIndex(reg); >+ if (index == FPRInfo::InvalidIndex) >+ return; >+ m_lockedRegisters.setFPRByIndex(index); >+ } > > template<typename BankInfo> > typename BankInfo::RegisterType allocateScratch()
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 124094
:
216475
|
216483
|
216495
|
216497
|
216499
|
216500
|
216501
|
216502