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.

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

mercurial