diff options
author | Lorry Tar Creator <lorry-tar-importer@lorry> | 2016-04-10 09:28:39 +0000 |
---|---|---|
committer | Lorry Tar Creator <lorry-tar-importer@lorry> | 2016-04-10 09:28:39 +0000 |
commit | 32761a6cee1d0dee366b885b7b9c777e67885688 (patch) | |
tree | d6bec92bebfb216f4126356e55518842c2f476a1 /Source/JavaScriptCore/bytecode/CallLinkStatus.h | |
parent | a4e969f4965059196ca948db781e52f7cfebf19e (diff) | |
download | WebKitGtk-tarball-32761a6cee1d0dee366b885b7b9c777e67885688.tar.gz |
webkitgtk-2.4.11webkitgtk-2.4.11
Diffstat (limited to 'Source/JavaScriptCore/bytecode/CallLinkStatus.h')
-rw-r--r-- | Source/JavaScriptCore/bytecode/CallLinkStatus.h | 115 |
1 files changed, 56 insertions, 59 deletions
diff --git a/Source/JavaScriptCore/bytecode/CallLinkStatus.h b/Source/JavaScriptCore/bytecode/CallLinkStatus.h index d3c1eee0c..51965fe4a 100644 --- a/Source/JavaScriptCore/bytecode/CallLinkStatus.h +++ b/Source/JavaScriptCore/bytecode/CallLinkStatus.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2012-2016 Apple Inc. All rights reserved. + * Copyright (C) 2012, 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 @@ -26,12 +26,7 @@ #ifndef CallLinkStatus_h #define CallLinkStatus_h -#include "CallLinkInfo.h" -#include "CallVariant.h" -#include "CodeOrigin.h" #include "CodeSpecializationKind.h" -#include "ConcurrentJITLock.h" -#include "ExitingJITType.h" #include "Intrinsic.h" #include "JSCJSValue.h" @@ -42,12 +37,14 @@ class ExecutableBase; class InternalFunction; class JSFunction; class Structure; -class CallLinkInfo; class CallLinkStatus { - WTF_MAKE_FAST_ALLOCATED; public: CallLinkStatus() + : m_executable(0) + , m_structure(0) + , m_couldTakeSlowPath(false) + , m_isProved(false) { } @@ -60,75 +57,75 @@ public: explicit CallLinkStatus(JSValue); - CallLinkStatus(CallVariant variant) - : m_variants(1, variant) + CallLinkStatus(ExecutableBase* executable, Structure* structure) + : m_executable(executable) + , m_structure(structure) + , m_couldTakeSlowPath(false) + , m_isProved(false) { + ASSERT(!!executable == !!structure); } - static CallLinkStatus computeFor( - CodeBlock*, unsigned bytecodeIndex, const CallLinkInfoMap&); - - struct ExitSiteData { - bool takesSlowPath { false }; - bool badFunction { false }; - }; - static ExitSiteData computeExitSiteData(const ConcurrentJITLocker&, CodeBlock*, unsigned bytecodeIndex); - -#if ENABLE(JIT) - // Computes the status assuming that we never took slow path and never previously - // exited. - static CallLinkStatus computeFor(const ConcurrentJITLocker&, CodeBlock*, CallLinkInfo&); - static CallLinkStatus computeFor( - const ConcurrentJITLocker&, CodeBlock*, CallLinkInfo&, ExitSiteData); -#endif + CallLinkStatus& setIsProved(bool isProved) + { + m_isProved = isProved; + return *this; + } - typedef HashMap<CodeOrigin, CallLinkStatus, CodeOriginApproximateHash> ContextMap; + static CallLinkStatus computeFor(CodeBlock*, unsigned bytecodeIndex); - // Computes all of the statuses of the DFG code block. Doesn't include statuses that had - // no information. Currently we use this when compiling FTL code, to enable polyvariant - // inlining. - static void computeDFGStatuses(CodeBlock* dfgCodeBlock, ContextMap&); + CallLinkStatus& setHasBadFunctionExitSite(bool didHaveExitSite) + { + ASSERT(!m_isProved); + if (didHaveExitSite) { + // Turn this into a closure call. + m_callTarget = JSValue(); + } + return *this; + } - // Helper that first consults the ContextMap and then does computeFor(). - static CallLinkStatus computeFor( - CodeBlock*, CodeOrigin, const CallLinkInfoMap&, const ContextMap&); + CallLinkStatus& setHasBadCacheExitSite(bool didHaveExitSite) + { + ASSERT(!m_isProved); + if (didHaveExitSite) + *this = takesSlowPath(); + return *this; + } - void setProvenConstantCallee(CallVariant); + CallLinkStatus& setHasBadExecutableExitSite(bool didHaveExitSite) + { + ASSERT(!m_isProved); + if (didHaveExitSite) + *this = takesSlowPath(); + return *this; + } - bool isSet() const { return !m_variants.isEmpty() || m_couldTakeSlowPath; } + bool isSet() const { return m_callTarget || m_executable || m_couldTakeSlowPath; } bool operator!() const { return !isSet(); } bool couldTakeSlowPath() const { return m_couldTakeSlowPath; } - - CallVariantList variants() const { return m_variants; } - unsigned size() const { return m_variants.size(); } - CallVariant at(unsigned i) const { return m_variants[i]; } - CallVariant operator[](unsigned i) const { return at(i); } + bool isClosureCall() const { return m_executable && !m_callTarget; } + + JSValue callTarget() const { return m_callTarget; } + JSFunction* function() const; + InternalFunction* internalFunction() const; + Intrinsic intrinsicFor(CodeSpecializationKind) const; + ExecutableBase* executable() const { return m_executable; } + Structure* structure() const { return m_structure; } bool isProved() const { return m_isProved; } - bool isBasedOnStub() const { return m_isBasedOnStub; } - bool canOptimize() const { return !m_variants.isEmpty(); } - - bool isClosureCall() const; // Returns true if any callee is a closure call. - - unsigned maxNumArguments() const { return m_maxNumArguments; } + bool canOptimize() const { return (m_callTarget || m_executable) && !m_couldTakeSlowPath; } void dump(PrintStream&) const; private: - void makeClosureCall(); - - static CallLinkStatus computeFromLLInt(const ConcurrentJITLocker&, CodeBlock*, unsigned bytecodeIndex); -#if ENABLE(JIT) - static CallLinkStatus computeFromCallLinkInfo( - const ConcurrentJITLocker&, CallLinkInfo&); -#endif + static CallLinkStatus computeFromLLInt(CodeBlock*, unsigned bytecodeIndex); - CallVariantList m_variants; - bool m_couldTakeSlowPath { false }; - bool m_isProved { false }; - bool m_isBasedOnStub { false }; - unsigned m_maxNumArguments { 0 }; + JSValue m_callTarget; + ExecutableBase* m_executable; + Structure* m_structure; + bool m_couldTakeSlowPath; + bool m_isProved; }; } // namespace JSC |