/*
- * 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
#define SamplingTool_h
#include "Strong.h"
-#include "Nodes.h"
#include "Opcode.h"
#include "SamplingCounter.h"
#include <wtf/Assertions.h>
#include <wtf/Atomics.h>
#include <wtf/HashMap.h>
#include <wtf/MainThread.h>
+#include <wtf/Spectrum.h>
#include <wtf/Threading.h>
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)
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()
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)
JS_EXPORT_PRIVATE void setup();
void dump(ExecState*);
- void notifyOfScope(JSGlobalData&, ScriptExecutable* scope);
+ void notifyOfScope(VM&, ScriptExecutable* scope);
void sample(CodeBlock* codeBlock, Instruction* vPC)
{