js/src/jit/JSONSpewer.h

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
michael@0 2 * vim: set ts=8 sts=4 et sw=4 tw=99:
michael@0 3 * This Source Code Form is subject to the terms of the Mozilla Public
michael@0 4 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 6
michael@0 7 #ifndef jit_JSONSpewer_h
michael@0 8 #define jit_JSONSpewer_h
michael@0 9
michael@0 10 #include "mozilla/NullPtr.h"
michael@0 11
michael@0 12 #include <stdio.h>
michael@0 13
michael@0 14 #include "js/TypeDecls.h"
michael@0 15
michael@0 16 namespace js {
michael@0 17 namespace jit {
michael@0 18
michael@0 19 class MDefinition;
michael@0 20 class MInstruction;
michael@0 21 class MBasicBlock;
michael@0 22 class MIRGraph;
michael@0 23 class MResumePoint;
michael@0 24 class LinearScanAllocator;
michael@0 25 class LInstruction;
michael@0 26
michael@0 27 class JSONSpewer
michael@0 28 {
michael@0 29 private:
michael@0 30 // Set by beginFunction(); unset by endFunction().
michael@0 31 // Used to correctly format output in case of abort during compilation.
michael@0 32 bool inFunction_;
michael@0 33
michael@0 34 int indentLevel_;
michael@0 35 bool first_;
michael@0 36 FILE *fp_;
michael@0 37
michael@0 38 void indent();
michael@0 39
michael@0 40 void property(const char *name);
michael@0 41 void beginObject();
michael@0 42 void beginObjectProperty(const char *name);
michael@0 43 void beginListProperty(const char *name);
michael@0 44 void stringValue(const char *format, ...);
michael@0 45 void stringProperty(const char *name, const char *format, ...);
michael@0 46 void integerValue(int value);
michael@0 47 void integerProperty(const char *name, int value);
michael@0 48 void endObject();
michael@0 49 void endList();
michael@0 50
michael@0 51 public:
michael@0 52 JSONSpewer()
michael@0 53 : inFunction_(false),
michael@0 54 indentLevel_(0),
michael@0 55 first_(true),
michael@0 56 fp_(nullptr)
michael@0 57 { }
michael@0 58 ~JSONSpewer();
michael@0 59
michael@0 60 bool init(const char *path);
michael@0 61 void beginFunction(JSScript *script);
michael@0 62 void beginPass(const char * pass);
michael@0 63 void spewMDef(MDefinition *def);
michael@0 64 void spewMResumePoint(MResumePoint *rp);
michael@0 65 void spewMIR(MIRGraph *mir);
michael@0 66 void spewLIns(LInstruction *ins);
michael@0 67 void spewLIR(MIRGraph *mir);
michael@0 68 void spewIntervals(LinearScanAllocator *regalloc);
michael@0 69 void endPass();
michael@0 70 void endFunction();
michael@0 71 void finish();
michael@0 72 };
michael@0 73
michael@0 74 } // namespace jit
michael@0 75 } // namespace js
michael@0 76
michael@0 77 #endif /* jit_JSONSpewer_h */

mercurial