X-Git-Url: https://git.saurik.com/apple/javascriptcore.git/blobdiff_plain/ba379fdc102753d6be2c4d937058fe40257329fe..14957cd040308e3eeec43d26bae5d76da13fcd85:/bytecode/SamplingTool.h diff --git a/bytecode/SamplingTool.h b/bytecode/SamplingTool.h index 7d7dc9c..1d77b31 100644 --- a/bytecode/SamplingTool.h +++ b/bytecode/SamplingTool.h @@ -29,17 +29,18 @@ #ifndef SamplingTool_h #define SamplingTool_h +#include "Strong.h" +#include "Nodes.h" +#include "Opcode.h" #include #include #include -#include "Nodes.h" -#include "Opcode.h" - namespace JSC { + class ScriptExecutable; + class SamplingFlags { - friend class JIT; public: static void start(); static void stop(); @@ -78,6 +79,11 @@ namespace JSC { int m_flag; }; + static const void* addressOfFlags() + { + return &s_flags; + } + #endif private: static uint32_t s_flags; @@ -92,9 +98,9 @@ namespace JSC { class ScopeNode; struct Instruction; - struct ScopeSampleRecord { - ScopeSampleRecord(ScopeNode* scope) - : m_scope(scope) + struct ScriptSampleRecord { + ScriptSampleRecord(JSGlobalData& globalData, ScriptExecutable* executable) + : m_executable(globalData, executable) , m_codeBlock(0) , m_sampleCount(0) , m_opcodeSampleCount(0) @@ -103,7 +109,7 @@ namespace JSC { { } - ~ScopeSampleRecord() + ~ScriptSampleRecord() { if (m_samples) free(m_samples); @@ -111,7 +117,7 @@ namespace JSC { void sample(CodeBlock*, Instruction*); - RefPtr m_scope; + Strong m_executable; CodeBlock* m_codeBlock; int m_sampleCount; int m_opcodeSampleCount; @@ -119,7 +125,7 @@ namespace JSC { unsigned m_size; }; - typedef WTF::HashMap ScopeSampleRecordMap; + typedef WTF::HashMap ScriptSampleRecordMap; class SamplingThread { public: @@ -136,11 +142,12 @@ namespace JSC { class SamplingTool { public: - friend class CallRecord; + friend struct CallRecord; friend class HostCallRecord; #if ENABLE(OPCODE_SAMPLING) - class CallRecord : Noncopyable { + class CallRecord { + WTF_MAKE_NONCOPYABLE(CallRecord); public: CallRecord(SamplingTool* samplingTool) : m_samplingTool(samplingTool) @@ -170,7 +177,8 @@ namespace JSC { } }; #else - class CallRecord : Noncopyable { + class CallRecord { + WTF_MAKE_NONCOPYABLE(CallRecord); public: CallRecord(SamplingTool*) { @@ -193,7 +201,7 @@ namespace JSC { , m_sampleCount(0) , m_opcodeSampleCount(0) #if ENABLE(CODEBLOCK_SAMPLING) - , m_scopeSampleMap(new ScopeSampleRecordMap()) + , m_scopeSampleMap(new ScriptSampleRecordMap()) #endif { memset(m_opcodeSamples, 0, sizeof(m_opcodeSamples)); @@ -210,7 +218,7 @@ namespace JSC { void setup(); void dump(ExecState*); - void notifyOfScope(ScopeNode* scope); + void notifyOfScope(ScriptExecutable* scope); void sample(CodeBlock* codeBlock, Instruction* vPC) { @@ -266,8 +274,8 @@ namespace JSC { unsigned m_opcodeSamplesInCTIFunctions[numOpcodeIDs]; #if ENABLE(CODEBLOCK_SAMPLING) - Mutex m_scopeSampleMapMutex; - OwnPtr m_scopeSampleMap; + Mutex m_scriptSampleMapMutex; + OwnPtr m_scopeSampleMap; #endif }; @@ -276,7 +284,6 @@ namespace JSC { // Implements a named set of counters, printed on exit if ENABLE(SAMPLING_COUNTERS). // See subclasses below, SamplingCounter, GlobalSamplingCounter and DeletableSamplingCounter. class AbstractSamplingCounter { - friend class JIT; friend class DeletableSamplingCounter; public: void count(uint32_t count = 1) @@ -286,6 +293,8 @@ namespace JSC { static void dump(); + int64_t* addressOfCounter() { return &m_counter; } + protected: // Effectively the contructor, however called lazily in the case of GlobalSamplingCounter. void init(const char* name)