X-Git-Url: https://git.saurik.com/apple/javascriptcore.git/blobdiff_plain/6fe7ccc865dc7d7541b93c5bcaf6368d2c98a174..refs/heads/master:/bytecode/SamplingTool.h?ds=inline diff --git a/bytecode/SamplingTool.h b/bytecode/SamplingTool.h index 52a6e35..7d9c54f 100644 --- a/bytecode/SamplingTool.h +++ b/bytecode/SamplingTool.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2008 Apple Inc. All rights reserved. + * Copyright (C) 2008, 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 @@ -10,7 +10,7 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of + * 3. Neither the name of Apple Inc. ("Apple") nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * @@ -30,13 +30,13 @@ #define SamplingTool_h #include "Strong.h" -#include "Nodes.h" #include "Opcode.h" #include "SamplingCounter.h" #include #include #include #include +#include #include namespace JSC { @@ -185,8 +185,8 @@ namespace JSC { struct Instruction; struct ScriptSampleRecord { - ScriptSampleRecord(JSGlobalData& globalData, ScriptExecutable* executable) - : m_executable(globalData, executable) + ScriptSampleRecord(VM& vm, ScriptExecutable* executable) + : m_executable(vm, executable) , m_codeBlock(0) , m_sampleCount(0) , m_opcodeSampleCount(0) @@ -211,7 +211,7 @@ namespace JSC { unsigned m_size; }; - typedef HashMap > ScriptSampleRecordMap; + typedef HashMap> ScriptSampleRecordMap; class SamplingThread { public: @@ -229,17 +229,18 @@ namespace JSC { class SamplingTool { public: friend struct CallRecord; - friend class HostCallRecord; #if ENABLE(OPCODE_SAMPLING) class CallRecord { WTF_MAKE_NONCOPYABLE(CallRecord); public: - CallRecord(SamplingTool* samplingTool) + CallRecord(SamplingTool* samplingTool, bool isHostCall = false) : m_samplingTool(samplingTool) , m_savedSample(samplingTool->m_sample) , m_savedCodeBlock(samplingTool->m_codeBlock) { + if (isHostcall) + samplingTool->m_sample |= 0x1; } ~CallRecord() @@ -253,32 +254,15 @@ namespace JSC { intptr_t m_savedSample; CodeBlock* m_savedCodeBlock; }; - - class HostCallRecord : public CallRecord { - public: - HostCallRecord(SamplingTool* samplingTool) - : CallRecord(samplingTool) - { - samplingTool->m_sample |= 0x1; - } - }; #else class CallRecord { WTF_MAKE_NONCOPYABLE(CallRecord); public: - CallRecord(SamplingTool*) + CallRecord(SamplingTool*, bool = false) { } }; - - class HostCallRecord : public CallRecord { - public: - HostCallRecord(SamplingTool* samplingTool) - : CallRecord(samplingTool) - { - } - }; -#endif +#endif SamplingTool(Interpreter* interpreter) : m_interpreter(interpreter) @@ -287,7 +271,7 @@ namespace JSC { , m_sampleCount(0) , m_opcodeSampleCount(0) #if ENABLE(CODEBLOCK_SAMPLING) - , m_scopeSampleMap(adoptPtr(new ScriptSampleRecordMap)) + , m_scopeSampleMap(std::make_unique) #endif { memset(m_opcodeSamples, 0, sizeof(m_opcodeSamples)); @@ -297,7 +281,7 @@ namespace JSC { JS_EXPORT_PRIVATE void setup(); void dump(ExecState*); - void notifyOfScope(JSGlobalData&, ScriptExecutable* scope); + void notifyOfScope(VM&, ScriptExecutable* scope); void sample(CodeBlock* codeBlock, Instruction* vPC) { @@ -354,7 +338,7 @@ namespace JSC { #if ENABLE(CODEBLOCK_SAMPLING) Mutex m_scriptSampleMapMutex; - OwnPtr m_scopeSampleMap; + std::unique_ptr m_scopeSampleMap; #endif };