зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1125202 - SpiderMonkey: Move AssemberBuffer spew code out of line r=h4writer
This commit is contained in:
Родитель
c11d950189
Коммит
facf8f7052
|
@ -0,0 +1,24 @@
|
|||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
* vim: set ts=8 sts=4 et sw=4 tw=99:
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "jit/shared/AssemblerBuffer-x86-shared.h"
|
||||
|
||||
#include "jsopcode.h"
|
||||
|
||||
void js::jit::GenericAssembler::spew(const char *fmt, va_list va)
|
||||
{
|
||||
// Buffer to hold the formatted string. Note that this may contain
|
||||
// '%' characters, so do not pass it directly to printf functions.
|
||||
char buf[200];
|
||||
|
||||
int i = vsnprintf(buf, sizeof(buf), fmt, va);
|
||||
|
||||
if (i > -1) {
|
||||
if (printer)
|
||||
printer->printf("%s\n", buf);
|
||||
js::jit::JitSpew(js::jit::JitSpew_Codegen, "%s", buf);
|
||||
}
|
||||
}
|
|
@ -30,17 +30,11 @@
|
|||
#ifndef jit_shared_AssemblerBuffer_x86_shared_h
|
||||
#define jit_shared_AssemblerBuffer_x86_shared_h
|
||||
|
||||
#include <limits.h>
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "jsfriendapi.h"
|
||||
#include "jsopcode.h"
|
||||
#include "jsutil.h"
|
||||
|
||||
#include "jit/ExecutableAllocator.h"
|
||||
#include "jit/JitSpewer.h"
|
||||
#include "js/RootingAPI.h"
|
||||
|
||||
// Spew formatting helpers.
|
||||
#define PRETTYHEX(x) (((x)<0)?"-":""),(((x)<0)?-(x):(x))
|
||||
|
@ -66,6 +60,9 @@
|
|||
#define ADDR_o32bs(offset, base, index, scale) ADDR_obs(offset, base, index, scale)
|
||||
|
||||
namespace js {
|
||||
|
||||
class Sprinter;
|
||||
|
||||
namespace jit {
|
||||
|
||||
class AssemblerBuffer {
|
||||
|
@ -179,18 +176,15 @@ namespace jit {
|
|||
|
||||
class GenericAssembler
|
||||
{
|
||||
js::Sprinter *printer;
|
||||
Sprinter *printer;
|
||||
|
||||
public:
|
||||
|
||||
bool isOOLPath;
|
||||
|
||||
GenericAssembler()
|
||||
: printer(NULL)
|
||||
, isOOLPath(false)
|
||||
{}
|
||||
|
||||
void setPrinter(js::Sprinter *sp) {
|
||||
void setPrinter(Sprinter *sp) {
|
||||
printer = sp;
|
||||
}
|
||||
|
||||
|
@ -199,23 +193,15 @@ namespace jit {
|
|||
__attribute__ ((format (printf, 2, 3)))
|
||||
#endif
|
||||
{
|
||||
if (printer || js::jit::JitSpewEnabled(js::jit::JitSpew_Codegen)) {
|
||||
// Buffer to hold the formatted string. Note that this may contain
|
||||
// '%' characters, so do not pass it directly to printf functions.
|
||||
char buf[200];
|
||||
|
||||
if (MOZ_UNLIKELY(printer || JitSpewEnabled(JitSpew_Codegen))) {
|
||||
va_list va;
|
||||
va_start(va, fmt);
|
||||
int i = vsnprintf(buf, sizeof(buf), fmt, va);
|
||||
spew(fmt, va);
|
||||
va_end(va);
|
||||
|
||||
if (i > -1) {
|
||||
if (printer)
|
||||
printer->printf("%s\n", buf);
|
||||
js::jit::JitSpew(js::jit::JitSpew_Codegen, "%s", buf);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
MOZ_COLD void spew(const char *fmt, va_list va);
|
||||
};
|
||||
|
||||
} // namespace jit
|
||||
|
|
|
@ -322,6 +322,7 @@ if not CONFIG['ENABLE_ION']:
|
|||
elif CONFIG['JS_CODEGEN_X86'] or CONFIG['JS_CODEGEN_X64']:
|
||||
UNIFIED_SOURCES += [
|
||||
'jit/shared/Assembler-x86-shared.cpp',
|
||||
'jit/shared/AssemblerBuffer-x86-shared.cpp',
|
||||
'jit/shared/BaselineCompiler-x86-shared.cpp',
|
||||
'jit/shared/BaselineIC-x86-shared.cpp',
|
||||
'jit/shared/CodeGenerator-x86-shared.cpp',
|
||||
|
|
Загрузка…
Ссылка в новой задаче