/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- * vim: set ts=8 sts=2 et sw=2 tw=80:
*/ // Copyright 2007-2008 the V8 project authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file.
# include "mozilla/Assertions.h" # include "mozilla/Types.h"
# include <stdio.h>
namespace js { namespace jit { namespace disasm {
typedefunsignedchar byte;
// A reasonable (ie, safe) buffer size for the disassembly of a single // instruction. constint ReasonableBufferSize = 256;
// Vector as used by the original code to allow for minimal modification. // Functions exactly like a character array with helper methods. template <typename T> class V8Vector { public:
V8Vector() : start_(nullptr), length_(0) {}
V8Vector(T* data, int length) : start_(data), length_(length) {
MOZ_ASSERT(length == 0 || (length > 0 && data != nullptr));
}
// Returns the length of the vector. int length() const { return length_; }
// Returns the pointer to the start of the data in the vector.
T* start() const { return start_; }
// Access individual vector elements - checks bounds in debug mode.
T& operator[](int index) const {
MOZ_ASSERT(0 <= index && index < length_); return start_[index];
}
// A generic Disassembler interface class Disassembler { public: // Caller deallocates converter. explicit Disassembler(const NameConverter& converter);
virtual ~Disassembler();
// Writes one disassembled instruction into 'buffer' (0-terminated). // Returns the length of the disassembled machine instruction in bytes. int InstructionDecode(V8Vector<char> buffer, uint8_t* instruction);
// Returns -1 if instruction does not mark the beginning of a constant pool, // or the number of entries in the constant pool beginning here. int ConstantPoolSizeAt(byte* instruction);
// Write disassembly into specified file 'f' using specified NameConverter // (see constructor). staticvoid Disassemble(FILE* f, uint8_t* begin, uint8_t* end);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.