summaryrefslogtreecommitdiff
path: root/Source/JavaScriptCore/bytecode/GetByIdStatus.h
diff options
context:
space:
mode:
authorLorry Tar Creator <lorry-tar-importer@lorry>2017-06-27 06:07:23 +0000
committerLorry Tar Creator <lorry-tar-importer@lorry>2017-06-27 06:07:23 +0000
commit1bf1084f2b10c3b47fd1a588d85d21ed0eb41d0c (patch)
tree46dcd36c86e7fbc6e5df36deb463b33e9967a6f7 /Source/JavaScriptCore/bytecode/GetByIdStatus.h
parent32761a6cee1d0dee366b885b7b9c777e67885688 (diff)
downloadWebKitGtk-tarball-master.tar.gz
Diffstat (limited to 'Source/JavaScriptCore/bytecode/GetByIdStatus.h')
-rw-r--r--Source/JavaScriptCore/bytecode/GetByIdStatus.h114
1 files changed, 75 insertions, 39 deletions
diff --git a/Source/JavaScriptCore/bytecode/GetByIdStatus.h b/Source/JavaScriptCore/bytecode/GetByIdStatus.h
index a1e801cca..de47bf5cc 100644
--- a/Source/JavaScriptCore/bytecode/GetByIdStatus.h
+++ b/Source/JavaScriptCore/bytecode/GetByIdStatus.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2012, 2013 Apple Inc. All rights reserved.
+ * Copyright (C) 2012, 2013, 2014 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -23,85 +23,121 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef GetByIdStatus_h
-#define GetByIdStatus_h
+#pragma once
-#include "IntendedStructureChain.h"
-#include "PropertyOffset.h"
-#include "StructureSet.h"
-#include "StructureStubInfo.h"
+#include "CallLinkStatus.h"
+#include "CodeOrigin.h"
+#include "ConcurrentJSLock.h"
+#include "ExitingJITType.h"
+#include "GetByIdVariant.h"
+#include "ScopeOffset.h"
namespace JSC {
+class AccessCase;
class CodeBlock;
+class JSModuleEnvironment;
+class JSModuleNamespaceObject;
+class ModuleNamespaceAccessCase;
+class StructureStubInfo;
+
+typedef HashMap<CodeOrigin, StructureStubInfo*, CodeOriginApproximateHash> StubInfoMap;
class GetByIdStatus {
public:
enum State {
- NoInformation, // It's uncached so we have no information.
- Simple, // It's cached for a simple access to a known object property with
- // a possible structure chain and a possible specific value.
- TakesSlowPath, // It's known to often take slow path.
- MakesCalls // It's known to take paths that make calls.
+ // It's uncached so we have no information.
+ NoInformation,
+ // It's cached for a simple access to a known object property with
+ // a possible structure chain and a possible specific value.
+ Simple,
+ // It's cached for a custom accessor with a possible structure chain.
+ Custom,
+ // It's cached for an access to a module namespace object's binding.
+ ModuleNamespace,
+ // It's known to often take slow path.
+ TakesSlowPath,
+ // It's known to take paths that make calls.
+ MakesCalls,
};
GetByIdStatus()
: m_state(NoInformation)
- , m_offset(invalidOffset)
{
}
explicit GetByIdStatus(State state)
: m_state(state)
- , m_offset(invalidOffset)
{
ASSERT(state == NoInformation || state == TakesSlowPath || state == MakesCalls);
}
+
GetByIdStatus(
- State state, bool wasSeenInJIT, const StructureSet& structureSet = StructureSet(),
- PropertyOffset offset = invalidOffset, JSValue specificValue = JSValue(), PassRefPtr<IntendedStructureChain> chain = nullptr)
+ State state, bool wasSeenInJIT, const GetByIdVariant& variant = GetByIdVariant())
: m_state(state)
- , m_structureSet(structureSet)
- , m_chain(chain)
- , m_specificValue(specificValue)
- , m_offset(offset)
, m_wasSeenInJIT(wasSeenInJIT)
{
- ASSERT((state == Simple) == (offset != invalidOffset));
+ ASSERT((state == Simple || state == Custom) == variant.isSet());
+ m_variants.append(variant);
}
- static GetByIdStatus computeFor(CodeBlock*, StubInfoMap&, unsigned bytecodeIndex, StringImpl* uid);
- static GetByIdStatus computeFor(VM&, Structure*, StringImpl* uid);
+ static GetByIdStatus computeFor(CodeBlock*, StubInfoMap&, unsigned bytecodeIndex, UniquedStringImpl* uid);
+ static GetByIdStatus computeFor(const StructureSet&, UniquedStringImpl* uid);
+ static GetByIdStatus computeFor(CodeBlock* baselineBlock, CodeBlock* dfgBlock, StubInfoMap& baselineMap, StubInfoMap& dfgMap, CodeOrigin, UniquedStringImpl* uid);
+
+#if ENABLE(DFG_JIT)
+ static GetByIdStatus computeForStubInfo(const ConcurrentJSLocker&, CodeBlock* baselineBlock, StructureStubInfo*, CodeOrigin, UniquedStringImpl* uid);
+#endif
+
State state() const { return m_state; }
bool isSet() const { return m_state != NoInformation; }
bool operator!() const { return !isSet(); }
bool isSimple() const { return m_state == Simple; }
- bool takesSlowPath() const { return m_state == TakesSlowPath || m_state == MakesCalls; }
- bool makesCalls() const { return m_state == MakesCalls; }
-
- const StructureSet& structureSet() const { return m_structureSet; }
- IntendedStructureChain* chain() const { return const_cast<IntendedStructureChain*>(m_chain.get()); } // Returns null if this is a direct access.
- JSValue specificValue() const { return m_specificValue; } // Returns JSValue() if there is no specific value.
- PropertyOffset offset() const { return m_offset; }
+ bool isCustom() const { return m_state == Custom; }
+ bool isModuleNamespace() const { return m_state == ModuleNamespace; }
+
+ size_t numVariants() const { return m_variants.size(); }
+ const Vector<GetByIdVariant, 1>& variants() const { return m_variants; }
+ const GetByIdVariant& at(size_t index) const { return m_variants[index]; }
+ const GetByIdVariant& operator[](size_t index) const { return at(index); }
+
+ bool takesSlowPath() const { return m_state == TakesSlowPath || m_state == MakesCalls || m_state == Custom || m_state == ModuleNamespace; }
+ bool makesCalls() const;
bool wasSeenInJIT() const { return m_wasSeenInJIT; }
+ // Attempts to reduce the set of variants to fit the given structure set. This may be approximate.
+ void filter(const StructureSet&);
+
+ JSModuleNamespaceObject* moduleNamespaceObject() const { return m_moduleNamespaceObject; }
+ JSModuleEnvironment* moduleEnvironment() const { return m_moduleEnvironment; }
+ ScopeOffset scopeOffset() const { return m_scopeOffset; }
+
+ void dump(PrintStream&) const;
+
private:
- static void computeForChain(GetByIdStatus& result, CodeBlock*, StringImpl* uid);
- static GetByIdStatus computeFromLLInt(CodeBlock*, unsigned bytecodeIndex, StringImpl* uid);
+#if ENABLE(DFG_JIT)
+ static bool hasExitSite(const ConcurrentJSLocker&, CodeBlock*, unsigned bytecodeIndex);
+#endif
+#if ENABLE(JIT)
+ GetByIdStatus(const ModuleNamespaceAccessCase&);
+ static GetByIdStatus computeForStubInfoWithoutExitSiteFeedback(
+ const ConcurrentJSLocker&, CodeBlock* profiledBlock, StructureStubInfo*,
+ UniquedStringImpl* uid, CallLinkStatus::ExitSiteData);
+#endif
+ static GetByIdStatus computeFromLLInt(CodeBlock*, unsigned bytecodeIndex, UniquedStringImpl* uid);
+
+ bool appendVariant(const GetByIdVariant&);
State m_state;
- StructureSet m_structureSet;
- RefPtr<IntendedStructureChain> m_chain;
- JSValue m_specificValue;
- PropertyOffset m_offset;
+ Vector<GetByIdVariant, 1> m_variants;
bool m_wasSeenInJIT;
+ JSModuleNamespaceObject* m_moduleNamespaceObject { nullptr };
+ JSModuleEnvironment* m_moduleEnvironment { nullptr };
+ ScopeOffset m_scopeOffset { };
};
} // namespace JSC
-
-#endif // PropertyAccessStatus_h
-