Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1366)

Unified Diff: runtime/vm/instructions_arm.h

Issue 12301042: Implement ARM disassembler. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/disassembler_test.cc ('k') | runtime/vm/instructions_arm.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/instructions_arm.h
===================================================================
--- runtime/vm/instructions_arm.h (revision 18767)
+++ runtime/vm/instructions_arm.h (working copy)
@@ -10,67 +10,40 @@
#error Do not include instructions_arm.h directly; use instructions.h instead.
#endif
-#include "vm/allocation.h"
#include "vm/object.h"
namespace dart {
-// Forward declarations.
-class RawClass;
-class Immediate;
-class RawObject;
-
// Abstract class for all instruction pattern classes.
class InstructionPattern : public ValueObject {
public:
- explicit InstructionPattern(uword pc) : end_(pc) {
+ explicit InstructionPattern(uword pc) : end_(reinterpret_cast<uword*>(pc)) {
ASSERT(pc != 0);
}
virtual ~InstructionPattern() { }
- // Check if the instruction ending at 'end_' matches the expected pattern.
- virtual bool IsValid() const {
- return TestBytesWith(pattern(), pattern_length_in_bytes());
- }
-
- // 'pattern' returns the expected byte pattern in form of an integer array
- // with length of 'pattern_length_in_bytes'. A '-1' element means 'any byte'.
- virtual const int* pattern() const = 0;
- virtual int pattern_length_in_bytes() const = 0;
-
protected:
- uword end() const { return end_; }
+ uword Back(int n) const;
private:
- // Returns true if the 'num_bytes' bytes at 'num_bytes' before 'end_'
- // correspond to array of integers 'data'. 'data' elements are either a byte
- // or -1, which represents any byte.
- bool TestBytesWith(const int* data, int num_bytes) const;
+ const uword* end_;
- const uword end_;
-
DISALLOW_COPY_AND_ASSIGN(InstructionPattern);
};
class CallPattern : public InstructionPattern {
public:
- CallPattern(uword pc, const Code& code)
- : InstructionPattern(pc), code_(code) { }
+ CallPattern(uword pc, const Code& code);
- static const int kLengthInBytes = 1*kWordSize; // We can only match 'blx lr'.
-
- virtual int pattern_length_in_bytes() const {
- return kLengthInBytes;
- }
uword TargetAddress() const;
- void SetTargetAddress(uword new_target) const;
+ void SetTargetAddress(uword target_address) const;
private:
- virtual const int* pattern() const;
+ int DecodePoolIndex();
+ const int pool_index_;
+ const Array& object_pool_;
- const Code& code_;
-
DISALLOW_COPY_AND_ASSIGN(CallPattern);
};
@@ -81,15 +54,14 @@
static const int kLengthInBytes = 3*kWordSize;
- virtual int pattern_length_in_bytes() const {
+ int pattern_length_in_bytes() const {
return kLengthInBytes;
}
+ bool IsValid() const;
uword TargetAddress() const;
- void SetTargetAddress(uword new_target) const;
+ void SetTargetAddress(uword target_address) const;
private:
- virtual const int* pattern() const;
-
DISALLOW_COPY_AND_ASSIGN(JumpPattern);
};
« no previous file with comments | « runtime/vm/disassembler_test.cc ('k') | runtime/vm/instructions_arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698