diff options
| author | Lorry Tar Creator <lorry-tar-importer@lorry> | 2015-05-20 09:56:07 +0000 |
|---|---|---|
| committer | Lorry Tar Creator <lorry-tar-importer@lorry> | 2015-05-20 09:56:07 +0000 |
| commit | 41386e9cb918eed93b3f13648cbef387e371e451 (patch) | |
| tree | a97f9d7bd1d9d091833286085f72da9d83fd0606 /Source/JavaScriptCore/bytecode/CallLinkInfo.h | |
| parent | e15dd966d523731101f70ccf768bba12435a0208 (diff) | |
| download | WebKitGtk-tarball-41386e9cb918eed93b3f13648cbef387e371e451.tar.gz | |
webkitgtk-2.4.9webkitgtk-2.4.9
Diffstat (limited to 'Source/JavaScriptCore/bytecode/CallLinkInfo.h')
| -rw-r--r-- | Source/JavaScriptCore/bytecode/CallLinkInfo.h | 267 |
1 files changed, 33 insertions, 234 deletions
diff --git a/Source/JavaScriptCore/bytecode/CallLinkInfo.h b/Source/JavaScriptCore/bytecode/CallLinkInfo.h index 061c6f83e..0244497df 100644 --- a/Source/JavaScriptCore/bytecode/CallLinkInfo.h +++ b/Source/JavaScriptCore/bytecode/CallLinkInfo.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2012, 2014, 2015 Apple Inc. All rights reserved. + * Copyright (C) 2012 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -26,13 +26,14 @@ #ifndef CallLinkInfo_h #define CallLinkInfo_h +#include "ClosureCallStubRoutine.h" #include "CodeLocation.h" #include "CodeSpecializationKind.h" #include "JITWriteBarrier.h" #include "JSFunction.h" #include "Opcode.h" -#include "PolymorphicCallStubRoutine.h" #include "WriteBarrier.h" +#include <wtf/Platform.h> #include <wtf/SentinelLinkedList.h> namespace JSC { @@ -41,275 +42,73 @@ namespace JSC { class RepatchBuffer; -class CallLinkInfo : public BasicRawSentinelNode<CallLinkInfo> { -public: - enum CallType { None, Call, CallVarargs, Construct, ConstructVarargs }; +struct CallLinkInfo : public BasicRawSentinelNode<CallLinkInfo> { + enum CallType { None, Call, CallVarargs, Construct }; static CallType callTypeFor(OpcodeID opcodeID) { if (opcodeID == op_call || opcodeID == op_call_eval) return Call; if (opcodeID == op_construct) return Construct; - if (opcodeID == op_construct_varargs) - return ConstructVarargs; ASSERT(opcodeID == op_call_varargs); return CallVarargs; } - + CallLinkInfo() - : m_registerPreservationMode(static_cast<unsigned>(RegisterPreservationNotRequired)) - , m_hasSeenShouldRepatch(false) - , m_hasSeenClosure(false) - , m_clearedByGC(false) - , m_callType(None) - , m_maxNumArguments(0) - , m_slowPathCount(0) + : hasSeenShouldRepatch(false) + , isDFG(false) + , hasSeenClosure(false) + , callType(None) { } ~CallLinkInfo() { - clearStub(); - if (isOnList()) remove(); } - static CodeSpecializationKind specializationKindFor(CallType callType) - { - return specializationFromIsConstruct(callType == Construct || callType == ConstructVarargs); - } CodeSpecializationKind specializationKind() const { - return specializationKindFor(static_cast<CallType>(m_callType)); - } - - RegisterPreservationMode registerPreservationMode() const - { - return static_cast<RegisterPreservationMode>(m_registerPreservationMode); - } - - bool isLinked() { return m_stub || m_callee; } - void unlink(RepatchBuffer&); - - void setUpCall(CallType callType, CodeOrigin codeOrigin, unsigned calleeGPR) - { - m_callType = callType; - m_codeOrigin = codeOrigin; - m_calleeGPR = calleeGPR; - } - - void setCallLocations(CodeLocationNearCall callReturnLocation, CodeLocationDataLabelPtr hotPathBegin, - CodeLocationNearCall hotPathOther) - { - m_callReturnLocation = callReturnLocation; - m_hotPathBegin = hotPathBegin; - m_hotPathOther = hotPathOther; - } - - void setUpCallFromFTL(CallType callType, CodeOrigin codeOrigin, - CodeLocationNearCall callReturnLocation, CodeLocationDataLabelPtr hotPathBegin, - CodeLocationNearCall hotPathOther, unsigned calleeGPR) - { - m_registerPreservationMode = static_cast<unsigned>(MustPreserveRegisters); - m_callType = callType; - m_codeOrigin = codeOrigin; - m_callReturnLocation = callReturnLocation; - m_hotPathBegin = hotPathBegin; - m_hotPathOther = hotPathOther; - m_calleeGPR = calleeGPR; - } - - CodeLocationNearCall callReturnLocation() - { - return m_callReturnLocation; - } - - CodeLocationDataLabelPtr hotPathBegin() - { - return m_hotPathBegin; - } - - CodeLocationNearCall hotPathOther() - { - return m_hotPathOther; - } - - void setCallee(VM& vm, CodeLocationDataLabelPtr location, JSCell* owner, JSFunction* callee) - { - m_callee.set(vm, location, owner, callee); - } - - void clearCallee() - { - m_callee.clear(); - } - - JSFunction* callee() - { - return m_callee.get(); - } - - void setLastSeenCallee(VM& vm, const JSCell* owner, JSFunction* callee) - { - m_lastSeenCallee.set(vm, owner, callee); - } - - void clearLastSeenCallee() - { - m_lastSeenCallee.clear(); + return specializationFromIsConstruct(callType == Construct); } - JSFunction* lastSeenCallee() - { - return m_lastSeenCallee.get(); - } - - bool haveLastSeenCallee() - { - return !!m_lastSeenCallee; - } - - void setStub(PassRefPtr<PolymorphicCallStubRoutine> newStub) - { - clearStub(); - m_stub = newStub; - } - - void clearStub(); + CodeLocationNearCall callReturnLocation; + CodeLocationDataLabelPtr hotPathBegin; + CodeLocationNearCall hotPathOther; + JITWriteBarrier<JSFunction> callee; + WriteBarrier<JSFunction> lastSeenCallee; + RefPtr<ClosureCallStubRoutine> stub; + bool hasSeenShouldRepatch : 1; + bool isDFG : 1; + bool hasSeenClosure : 1; + unsigned callType : 5; // CallType + unsigned calleeGPR : 8; + CodeOrigin codeOrigin; - PolymorphicCallStubRoutine* stub() - { - return m_stub.get(); - } - - void setSlowStub(PassRefPtr<JITStubRoutine> newSlowStub) - { - m_slowStub = newSlowStub; - } - - void clearSlowStub() - { - m_slowStub = nullptr; - } - - JITStubRoutine* slowStub() - { - return m_slowStub.get(); - } + bool isLinked() { return stub || callee; } + void unlink(VM&, RepatchBuffer&); bool seenOnce() { - return m_hasSeenShouldRepatch; - } - - void clearSeen() - { - m_hasSeenShouldRepatch = false; + return hasSeenShouldRepatch; } void setSeen() { - m_hasSeenShouldRepatch = true; - } - - bool hasSeenClosure() - { - return m_hasSeenClosure; - } - - void setHasSeenClosure() - { - m_hasSeenClosure = true; - } - - bool clearedByGC() - { - return m_clearedByGC; - } - - void setCallType(CallType callType) - { - m_callType = callType; + hasSeenShouldRepatch = true; } - - CallType callType() - { - return static_cast<CallType>(m_callType); - } - - uint8_t* addressOfMaxNumArguments() - { - return &m_maxNumArguments; - } - - uint8_t maxNumArguments() - { - return m_maxNumArguments; - } - - static ptrdiff_t offsetOfSlowPathCount() - { - return OBJECT_OFFSETOF(CallLinkInfo, m_slowPathCount); - } - - void setCalleeGPR(unsigned calleeGPR) - { - m_calleeGPR = calleeGPR; - } - - unsigned calleeGPR() - { - return m_calleeGPR; - } - - uint32_t slowPathCount() - { - return m_slowPathCount; - } - - void setCodeOrigin(CodeOrigin codeOrigin) - { - m_codeOrigin = codeOrigin; - } - - CodeOrigin codeOrigin() - { - return m_codeOrigin; - } - - void visitWeak(RepatchBuffer&); - -private: - CodeLocationNearCall m_callReturnLocation; - CodeLocationDataLabelPtr m_hotPathBegin; - CodeLocationNearCall m_hotPathOther; - JITWriteBarrier<JSFunction> m_callee; - WriteBarrier<JSFunction> m_lastSeenCallee; - RefPtr<PolymorphicCallStubRoutine> m_stub; - RefPtr<JITStubRoutine> m_slowStub; - unsigned m_registerPreservationMode : 1; // Real type is RegisterPreservationMode - bool m_hasSeenShouldRepatch : 1; - bool m_hasSeenClosure : 1; - bool m_clearedByGC : 1; - unsigned m_callType : 4; // CallType - unsigned m_calleeGPR : 8; - uint8_t m_maxNumArguments; // Only used for varargs calls. - uint32_t m_slowPathCount; - CodeOrigin m_codeOrigin; }; -inline CodeOrigin getCallLinkInfoCodeOrigin(CallLinkInfo& callLinkInfo) +inline void* getCallLinkInfoReturnLocation(CallLinkInfo* callLinkInfo) { - return callLinkInfo.codeOrigin(); + return callLinkInfo->callReturnLocation.executableAddress(); } -typedef HashMap<CodeOrigin, CallLinkInfo*, CodeOriginApproximateHash> CallLinkInfoMap; - -#else // ENABLE(JIT) - -typedef HashMap<int, void*> CallLinkInfoMap; - +inline unsigned getCallLinkInfoBytecodeIndex(CallLinkInfo* callLinkInfo) +{ + return callLinkInfo->codeOrigin.bytecodeIndex; +} #endif // ENABLE(JIT) } // namespace JSC |
