Refactor CallLinkInfo from a struct to a class
https://bugs.webkit.org/show_bug.cgi?id=146292

Rubber stamped by Filip Pizlo.

Refactored CallLinkInfo from a struct to a class with proper accessors and made all the
data elements private.

Done in preparation for fixing https://bugs.webkit.org/show_bug.cgi?id=146285.

* bytecode/CallLinkInfo.cpp:
(JSC::CallLinkInfo::clearStub):
(JSC::CallLinkInfo::unlink):
(JSC::CallLinkInfo::visitWeak):
* bytecode/CallLinkInfo.h:
(JSC::CallLinkInfo::callTypeFor):
(JSC::CallLinkInfo::CallLinkInfo):
(JSC::CallLinkInfo::~CallLinkInfo):
(JSC::CallLinkInfo::specializationKindFor):
(JSC::CallLinkInfo::specializationKind):
(JSC::CallLinkInfo::isLinked):
(JSC::CallLinkInfo::setUpCall):
(JSC::CallLinkInfo::setCallLocations):
(JSC::CallLinkInfo::setUpCallFromFTL):
(JSC::CallLinkInfo::callReturnLocation):
(JSC::CallLinkInfo::hotPathBegin):
(JSC::CallLinkInfo::hotPathOther):
(JSC::CallLinkInfo::setCallee):
(JSC::CallLinkInfo::clearCallee):
(JSC::CallLinkInfo::callee):
(JSC::CallLinkInfo::setLastSeenCallee):
(JSC::CallLinkInfo::clearLastSeenCallee):
(JSC::CallLinkInfo::lastSeenCallee):
(JSC::CallLinkInfo::haveLastSeenCallee):
(JSC::CallLinkInfo::setStub):
(JSC::CallLinkInfo::stub):
(JSC::CallLinkInfo::seenOnce):
(JSC::CallLinkInfo::clearSeen):
(JSC::CallLinkInfo::setSeen):
(JSC::CallLinkInfo::hasSeenClosure):
(JSC::CallLinkInfo::setHasSeenClosure):
(JSC::CallLinkInfo::clearedByGC):
(JSC::CallLinkInfo::setCallType):
(JSC::CallLinkInfo::callType):
(JSC::CallLinkInfo::addressOfMaxNumArguments):
(JSC::CallLinkInfo::maxNumArguments):
(JSC::CallLinkInfo::offsetOfSlowPathCount):
(JSC::CallLinkInfo::setCalleeGPR):
(JSC::CallLinkInfo::calleeGPR):
(JSC::CallLinkInfo::slowPathCount):
(JSC::CallLinkInfo::setCodeOrigin):
(JSC::CallLinkInfo::codeOrigin):
(JSC::getCallLinkInfoCodeOrigin):
* bytecode/CallLinkStatus.cpp:
(JSC::CallLinkStatus::computeFor):
(JSC::CallLinkStatus::computeFromCallLinkInfo):
(JSC::CallLinkStatus::computeDFGStatuses):
* bytecode/CallLinkStatus.h:
* bytecode/CodeBlock.cpp:
(JSC::CodeBlock::printCallOp):
(JSC::CodeBlock::getCallLinkInfoForBytecodeIndex):
* dfg/DFGJITCompiler.cpp:
(JSC::DFG::JITCompiler::link):
* dfg/DFGOSRExitCompilerCommon.cpp:
(JSC::DFG::reifyInlinedCallFrames):
* dfg/DFGSpeculativeJIT32_64.cpp:
(JSC::DFG::SpeculativeJIT::emitCall):
* dfg/DFGSpeculativeJIT64.cpp:
(JSC::DFG::SpeculativeJIT::emitCall):
* ftl/FTLJSCallBase.cpp:
(JSC::FTL::JSCallBase::link):
* jit/AccessorCallJITStubRoutine.h:
* jit/JIT.cpp:
(JSC::JIT::privateCompile):
* jit/JIT.h:
* jit/JITCall.cpp:
(JSC::JIT::compileSetupVarargsFrame):
(JSC::JIT::compileOpCall):
* jit/JITCall32_64.cpp:
(JSC::JIT::compileSetupVarargsFrame):
(JSC::JIT::compileOpCall):
* jit/JITOperations.cpp:
* jit/PolymorphicCallStubRoutine.cpp:
(JSC::PolymorphicCallNode::unlink):
(JSC::PolymorphicCallNode::clearCallLinkInfo):
* jit/PolymorphicCallStubRoutine.h:
* jit/Repatch.cpp:
(JSC::generateByIdStub):
(JSC::linkSlowFor):
(JSC::linkFor):
(JSC::revertCall):
(JSC::unlinkFor):
(JSC::linkPolymorphicCall):
* jit/ThunkGenerators.cpp:
(JSC::virtualForThunkGenerator):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@185930 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/JavaScriptCore/bytecode/CallLinkStatus.cpp b/Source/JavaScriptCore/bytecode/CallLinkStatus.cpp
index 815ee657..103a7f2 100644
--- a/Source/JavaScriptCore/bytecode/CallLinkStatus.cpp
+++ b/Source/JavaScriptCore/bytecode/CallLinkStatus.cpp
@@ -128,14 +128,14 @@
     UNUSED_PARAM(profiledBlock);
     
     CallLinkStatus result = computeFromCallLinkInfo(locker, callLinkInfo);
-    result.m_maxNumArguments = callLinkInfo.maxNumArguments;
+    result.m_maxNumArguments = callLinkInfo.maxNumArguments();
     return result;
 }
 
 CallLinkStatus CallLinkStatus::computeFromCallLinkInfo(
     const ConcurrentJITLocker&, CallLinkInfo& callLinkInfo)
 {
-    if (callLinkInfo.clearedByGC)
+    if (callLinkInfo.clearedByGC())
         return takesSlowPath();
     
     // Note that despite requiring that the locker is held, this code is racy with respect
@@ -155,7 +155,7 @@
     // until next GC even if the CallLinkInfo is concurrently cleared. Also, the variants list is
     // never mutated after the PolymorphicCallStubRoutine is instantiated. We have some conservative
     // fencing in place to make sure that we see the variants list after construction.
-    if (PolymorphicCallStubRoutine* stub = callLinkInfo.stub.get()) {
+    if (PolymorphicCallStubRoutine* stub = callLinkInfo.stub()) {
         WTF::loadLoadFence();
         
         CallEdgeList edges = stub->edges();
@@ -174,7 +174,7 @@
         RELEASE_ASSERT(edges.first().count() >= edges.last().count());
         
         double totalCallsToKnown = 0;
-        double totalCallsToUnknown = callLinkInfo.slowPathCount;
+        double totalCallsToUnknown = callLinkInfo.slowPathCount();
         CallVariantList variants;
         for (size_t i = 0; i < edges.size(); ++i) {
             CallEdge edge = edges[i];
@@ -212,14 +212,14 @@
     
     CallLinkStatus result;
     
-    if (JSFunction* target = callLinkInfo.lastSeenCallee.get()) {
+    if (JSFunction* target = callLinkInfo.lastSeenCallee()) {
         CallVariant variant(target);
-        if (callLinkInfo.hasSeenClosure)
+        if (callLinkInfo.hasSeenClosure())
             variant = variant.despecifiedClosure();
         result.m_variants.append(variant);
     }
     
-    result.m_couldTakeSlowPath = !!callLinkInfo.slowPathCount;
+    result.m_couldTakeSlowPath = !!callLinkInfo.slowPathCount();
 
     return result;
 }
@@ -246,7 +246,7 @@
     CodeBlock* baselineCodeBlock = dfgCodeBlock->alternative();
     for (auto iter = dfgCodeBlock->callLinkInfosBegin(); !!iter; ++iter) {
         CallLinkInfo& info = **iter;
-        CodeOrigin codeOrigin = info.codeOrigin;
+        CodeOrigin codeOrigin = info.codeOrigin();
         
         // Check if we had already previously made a terrible mistake in the FTL for this
         // code origin. Note that this is approximate because we could have a monovariant
@@ -266,7 +266,7 @@
         
         {
             ConcurrentJITLocker locker(dfgCodeBlock->m_lock);
-            map.add(info.codeOrigin, computeFor(locker, dfgCodeBlock, info, exitSiteData));
+            map.add(info.codeOrigin(), computeFor(locker, dfgCodeBlock, info, exitSiteData));
         }
     }
 #else