disassembler.h revision b8a8cc1952d61a2f3a2568848933943a543b5d3e
1a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block// Copyright 2006-2008 the V8 project authors. All rights reserved. 2b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch// Use of this source code is governed by a BSD-style license that can be 3b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch// found in the LICENSE file. 4a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block 5a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block#ifndef V8_DISASSEMBLER_H_ 6a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block#define V8_DISASSEMBLER_H_ 7a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block 8b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch#include "src/allocation.h" 9257744e915dfc84d6d07a6b2accf8402d9ffc708Ben Murdoch 10a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Blocknamespace v8 { 11a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Blocknamespace internal { 12a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block 13a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Blockclass Disassembler : public AllStatic { 14a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block public: 15a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block // Print the bytes in the interval [begin, end) into f. 16a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block static void Dump(FILE* f, byte* begin, byte* end); 17a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block 18a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block // Decode instructions in the the interval [begin, end) and print the 19a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block // code into f. Returns the number of bytes disassembled or 1 if no 20a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block // instruction could be decoded. 21b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch static int Decode(Isolate* isolate, FILE* f, byte* begin, byte* end); 22a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block 23a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block // Decode instructions in code. 24a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block static void Decode(FILE* f, Code* code); 25a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block private: 26a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block // Decode instruction at pc and print disassembled instruction into f. 27a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block // Returns the instruction length in bytes, or 1 if the instruction could 28a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block // not be decoded. The number of characters written is written into 29a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block // the out parameter char_count. 30a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block static int Decode(FILE* f, byte* pc, int* char_count); 31a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block}; 32a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block 33a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block} } // namespace v8::internal 34a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block 35a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block#endif // V8_DISASSEMBLER_H_ 36