Value Profiles for arguments should be more easily accessible to the interpreter
https://bugs.webkit.org/show_bug.cgi?id=74984
<rdar://problem/10611364>

Reviewed by Gavin Barraclough.

* bytecode/CodeBlock.cpp:
(JSC::CodeBlock::stronglyVisitStrongReferences):
(JSC::CodeBlock::shouldOptimizeNow):
(JSC::CodeBlock::dumpValueProfiles):
* bytecode/CodeBlock.h:
(JSC::CodeBlock::setArgumentValueProfileSize):
(JSC::CodeBlock::numberOfArgumentValueProfiles):
(JSC::CodeBlock::valueProfileForArgument):
(JSC::CodeBlock::addValueProfile):
(JSC::CodeBlock::valueProfile):
(JSC::CodeBlock::valueProfileForBytecodeOffset):
(JSC::CodeBlock::totalNumberOfValueProfiles):
(JSC::CodeBlock::getFromAllValueProfiles):
* bytecode/ValueProfile.h:
(JSC::ValueProfile::ValueProfile):
* jit/JIT.cpp:
(JSC::JIT::privateCompile):
* jit/JIT.h:
* jit/JITInlineMethods.h:
(JSC::JIT::emitValueProfilingSite):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@103384 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/JavaScriptCore/jit/JITInlineMethods.h b/Source/JavaScriptCore/jit/JITInlineMethods.h
index f485157..5540ffa 100644
--- a/Source/JavaScriptCore/jit/JITInlineMethods.h
+++ b/Source/JavaScriptCore/jit/JITInlineMethods.h
@@ -448,27 +448,17 @@
 }
 
 #if ENABLE(VALUE_PROFILER)
-inline void JIT::emitValueProfilingSite(ValueProfilingSiteKind siteKind)
+inline void JIT::emitValueProfilingSite(ValueProfile* valueProfile)
 {
-    if (!shouldEmitProfiling())
-        return;
-    
+    ASSERT(shouldEmitProfiling());
+    ASSERT(valueProfile);
+
     const RegisterID value = regT0;
 #if USE(JSVALUE32_64)
     const RegisterID valueTag = regT1;
 #endif
     const RegisterID scratch = regT3;
     
-    ValueProfile* valueProfile;
-    if (siteKind == FirstProfilingSite)
-        valueProfile = m_codeBlock->addValueProfile(m_bytecodeOffset);
-    else {
-        ASSERT(siteKind == SubsequentProfilingSite);
-        valueProfile = m_codeBlock->valueProfileForBytecodeOffset(m_bytecodeOffset);
-    }
-    
-    ASSERT(valueProfile);
-    
     if (ValueProfile::numberOfBuckets == 1) {
         // We're in a simple configuration: only one bucket, so we can just do a direct
         // store.
@@ -495,6 +485,22 @@
     store32(valueTag, BaseIndex(scratch, bucketCounterRegister, TimesEight, OBJECT_OFFSETOF(JSValue, u.asBits.tag)));
 #endif
 }
+
+inline void JIT::emitValueProfilingSite(ValueProfilingSiteKind siteKind)
+{
+    if (!shouldEmitProfiling())
+        return;
+    
+    ValueProfile* valueProfile;
+    if (siteKind == FirstProfilingSite)
+        valueProfile = m_codeBlock->addValueProfile(m_bytecodeOffset);
+    else {
+        ASSERT(siteKind == SubsequentProfilingSite);
+        valueProfile = m_codeBlock->valueProfileForBytecodeOffset(m_bytecodeOffset);
+    }
+    
+    emitValueProfilingSite(valueProfile);
+}
 #endif
 
 #if USE(JSVALUE32_64)