From 9e776b5f015e7dc3d680421ef3e1b1db76c9a2ad Mon Sep 17 00:00:00 2001 From: "Nicolas B. Pierron" Date: Thu, 28 May 2015 19:26:56 +0200 Subject: [PATCH] Bug 1147403 part 6 - Remove GetJitContext from serializing functions. r=h4writer --- js/src/jit/JSONSpewer.cpp | 26 +++++++++++++++++++------- js/src/jit/JSONSpewer.h | 2 ++ js/src/jit/MIR.cpp | 6 ++---- 3 files changed, 23 insertions(+), 11 deletions(-) diff --git a/js/src/jit/JSONSpewer.cpp b/js/src/jit/JSONSpewer.cpp index 9501bacaea4..8478e1eb71a 100644 --- a/js/src/jit/JSONSpewer.cpp +++ b/js/src/jit/JSONSpewer.cpp @@ -65,16 +65,28 @@ JSONSpewer::beginListProperty(const char* name) first_ = true; } +void +JSONSpewer::beginStringProperty(const char* name) +{ + property(name); + out_.printf("\""); +} + +void +JSONSpewer::endStringProperty() +{ + out_.printf("\""); +} + void JSONSpewer::stringProperty(const char* name, const char* format, ...) { va_list ap; va_start(ap, format); - property(name); - out_.printf("\""); + beginStringProperty(name); out_.vprintf(format, ap); - out_.printf("\""); + endStringProperty(); va_end(ap); } @@ -221,10 +233,10 @@ JSONSpewer::spewMDef(MDefinition* def) isTruncated = static_cast(def)->isTruncated(); if (def->type() != MIRType_None && def->range()) { - Sprinter sp(GetJitContext()->cx); - sp.init(); - def->range()->dump(sp); - stringProperty("type", "%s : %s%s", sp.string(), StringFromMIRType(def->type()), (isTruncated ? " (t)" : "")); + beginStringProperty("type"); + def->range()->dump(out_); + out_.printf(" : %s%s", StringFromMIRType(def->type()), (isTruncated ? " (t)" : "")); + endStringProperty(); } else { stringProperty("type", "%s%s", StringFromMIRType(def->type()), (isTruncated ? " (t)" : "")); } diff --git a/js/src/jit/JSONSpewer.h b/js/src/jit/JSONSpewer.h index 311f3ddf96c..d034729be5b 100644 --- a/js/src/jit/JSONSpewer.h +++ b/js/src/jit/JSONSpewer.h @@ -36,6 +36,8 @@ class JSONSpewer void beginListProperty(const char* name); void stringValue(const char* format, ...); void stringProperty(const char* name, const char* format, ...); + void beginStringProperty(const char* name); + void endStringProperty(); void integerValue(int value); void integerProperty(const char* name, int value); void endObject(); diff --git a/js/src/jit/MIR.cpp b/js/src/jit/MIR.cpp index 0a6e6866306..42c3c603cc1 100644 --- a/js/src/jit/MIR.cpp +++ b/js/src/jit/MIR.cpp @@ -1083,10 +1083,8 @@ void MAssertRange::printOpcode(GenericPrinter& out) const { MDefinition::printOpcode(out); - Sprinter sp(GetJitContext()->cx); - sp.init(); - assertedRange()->dump(sp); - out.printf(" %s", sp.string()); + out.put(" "); + assertedRange()->dump(out); } const char*