| Index: src/a64/instrument-a64.h
|
| diff --git a/src/hydrogen-mark-deoptimize.h b/src/a64/instrument-a64.h
|
| similarity index 51%
|
| copy from src/hydrogen-mark-deoptimize.h
|
| copy to src/a64/instrument-a64.h
|
| index 30f35b3dec59046c0893e55981b064fe15c37726..08dc1b2ad17308ccb5cbd4ff8042ead090c06746 100644
|
| --- a/src/hydrogen-mark-deoptimize.h
|
| +++ b/src/a64/instrument-a64.h
|
| @@ -25,51 +25,84 @@
|
| // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
| // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
| -#ifndef V8_HYDROGEN_MARK_DEOPTIMIZE_H_
|
| -#define V8_HYDROGEN_MARK_DEOPTIMIZE_H_
|
| +#ifndef V8_A64_INSTRUMENT_A64_H_
|
| +#define V8_A64_INSTRUMENT_A64_H_
|
|
|
| -#include "hydrogen.h"
|
| +#include "globals.h"
|
| +#include "utils.h"
|
| +#include "a64/decoder-a64.h"
|
| +#include "a64/constants-a64.h"
|
| +#include "a64/instrument-a64.h"
|
|
|
| namespace v8 {
|
| namespace internal {
|
|
|
| +const int kCounterNameMaxLength = 256;
|
| +const uint64_t kDefaultInstrumentationSamplingPeriod = 1 << 22;
|
|
|
| -// Compute DeoptimizeOnUndefined flag for phis. Any phi that can reach a use
|
| -// with DeoptimizeOnUndefined set must have DeoptimizeOnUndefined set.
|
| -// Currently only HCompareNumericAndBranch, with double input representation,
|
| -// has this flag set. The flag is used by HChange tagged->double, which must
|
| -// deoptimize if one of its uses has this flag set.
|
| -class HMarkDeoptimizeOnUndefinedPhase : public HPhase {
|
| - public:
|
| - explicit HMarkDeoptimizeOnUndefinedPhase(HGraph* graph)
|
| - : HPhase("H_Mark deoptimize on undefined", graph),
|
| - worklist_(16, zone()) {}
|
| -
|
| - void Run();
|
|
|
| - private:
|
| - void ProcessPhi(HPhi* phi);
|
| +enum InstrumentState {
|
| + InstrumentStateDisable = 0,
|
| + InstrumentStateEnable = 1
|
| +};
|
|
|
| - // Preallocated worklist used as an optimization so we don't have
|
| - // to allocate a new ZoneList for every ProcessPhi() invocation.
|
| - ZoneList<HPhi*> worklist_;
|
|
|
| - DISALLOW_COPY_AND_ASSIGN(HMarkDeoptimizeOnUndefinedPhase);
|
| +enum CounterType {
|
| + Gauge = 0, // Gauge counters reset themselves after reading.
|
| + Cumulative = 1 // Cumulative counters keep their value after reading.
|
| };
|
|
|
|
|
| -class HComputeChangeUndefinedToNaN : public HPhase {
|
| +class Counter {
|
| public:
|
| - explicit HComputeChangeUndefinedToNaN(HGraph* graph)
|
| - : HPhase("H_Compute change undefined to nan", graph) {}
|
| + Counter(const char* name, CounterType type = Gauge);
|
|
|
| - void Run();
|
| + void Increment();
|
| + void Enable();
|
| + void Disable();
|
| + bool IsEnabled();
|
| + uint64_t count();
|
| + const char* name();
|
| + CounterType type();
|
|
|
| private:
|
| - DISALLOW_COPY_AND_ASSIGN(HComputeChangeUndefinedToNaN);
|
| + char name_[kCounterNameMaxLength];
|
| + uint64_t count_;
|
| + bool enabled_;
|
| + CounterType type_;
|
| };
|
|
|
|
|
| +class Instrument: public DecoderVisitor {
|
| + public:
|
| + explicit Instrument(const char* datafile = NULL,
|
| + uint64_t sample_period = kDefaultInstrumentationSamplingPeriod);
|
| + ~Instrument();
|
| +
|
| + // Declare all Visitor functions.
|
| + #define DECLARE(A) void Visit##A(Instruction* instr);
|
| + VISITOR_LIST(DECLARE)
|
| + #undef DECLARE
|
| +
|
| + private:
|
| + void Update();
|
| + void Enable();
|
| + void Disable();
|
| + void DumpCounters();
|
| + void DumpCounterNames();
|
| + void DumpEventMarker(unsigned marker);
|
| + void HandleInstrumentationEvent(unsigned event);
|
| + Counter* GetCounter(const char* name);
|
| +
|
| + void InstrumentLoadStore(Instruction* instr);
|
| + void InstrumentLoadStorePair(Instruction* instr);
|
| +
|
| + std::list<Counter*> counters_;
|
| +
|
| + FILE *output_stream_;
|
| + uint64_t sample_period_;
|
| +};
|
| +
|
| } } // namespace v8::internal
|
|
|
| -#endif // V8_HYDROGEN_MARK_DEOPTIMIZE_H_
|
| +#endif // V8_A64_INSTRUMENT_A64_H_
|
|
|