2014-04-24 11:32:48 +00:00
|
|
|
// Copyright 2014 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.
|
2008-07-03 15:10:15 +00:00
|
|
|
|
|
|
|
#ifndef V8_DISASSEMBLER_H_
|
|
|
|
#define V8_DISASSEMBLER_H_
|
|
|
|
|
2014-04-24 11:32:48 +00:00
|
|
|
#include <cstdio>
|
|
|
|
|
2011-05-06 06:50:20 +00:00
|
|
|
#include "allocation.h"
|
|
|
|
|
2009-05-25 10:05:56 +00:00
|
|
|
namespace v8 {
|
|
|
|
namespace internal {
|
2008-07-03 15:10:15 +00:00
|
|
|
|
2014-04-24 11:32:48 +00:00
|
|
|
// Forward declarations.
|
|
|
|
class Code;
|
|
|
|
class Isolate;
|
|
|
|
|
2008-07-03 15:10:15 +00:00
|
|
|
class Disassembler : public AllStatic {
|
|
|
|
public:
|
|
|
|
// Print the bytes in the interval [begin, end) into f.
|
|
|
|
static void Dump(FILE* f, byte* begin, byte* end);
|
|
|
|
|
|
|
|
// Decode instructions in the the interval [begin, end) and print the
|
|
|
|
// code into f. Returns the number of bytes disassembled or 1 if no
|
|
|
|
// instruction could be decoded.
|
2013-02-25 14:46:09 +00:00
|
|
|
static int Decode(Isolate* isolate, FILE* f, byte* begin, byte* end);
|
2008-07-03 15:10:15 +00:00
|
|
|
|
|
|
|
// Decode instructions in code.
|
|
|
|
static void Decode(FILE* f, Code* code);
|
|
|
|
private:
|
|
|
|
// Decode instruction at pc and print disassembled instruction into f.
|
|
|
|
// Returns the instruction length in bytes, or 1 if the instruction could
|
|
|
|
// not be decoded. The number of characters written is written into
|
|
|
|
// the out parameter char_count.
|
|
|
|
static int Decode(FILE* f, byte* pc, int* char_count);
|
|
|
|
};
|
|
|
|
|
|
|
|
} } // namespace v8::internal
|
|
|
|
|
|
|
|
#endif // V8_DISASSEMBLER_H_
|