| Index: runtime/vm/instructions_mips.h
|
| ===================================================================
|
| --- runtime/vm/instructions_mips.h (revision 18603)
|
| +++ runtime/vm/instructions_mips.h (working copy)
|
| @@ -11,6 +11,7 @@
|
| #endif
|
|
|
| #include "vm/allocation.h"
|
| +#include "vm/object.h"
|
|
|
| namespace dart {
|
|
|
| @@ -22,12 +23,12 @@
|
| // Abstract class for all instruction pattern classes.
|
| class InstructionPattern : public ValueObject {
|
| public:
|
| - explicit InstructionPattern(uword pc) : start_(pc) {
|
| + explicit InstructionPattern(uword pc) : end_(pc) {
|
| ASSERT(pc != 0);
|
| }
|
| - virtual ~InstructionPattern() {}
|
| + virtual ~InstructionPattern() { }
|
|
|
| - // Call to check if the instruction pattern at 'pc' match the instruction.
|
| + // Check if the instruction ending at 'end_' matches the expected pattern.
|
| virtual bool IsValid() const {
|
| return TestBytesWith(pattern(), pattern_length_in_bytes());
|
| }
|
| @@ -38,55 +39,54 @@
|
| virtual int pattern_length_in_bytes() const = 0;
|
|
|
| protected:
|
| - uword start() const { return start_; }
|
| + uword end() const { return end_; }
|
|
|
| private:
|
| - // Returns true if the 'num_bytes' bytes at 'start_' correspond to
|
| - // array of integers 'data'. 'data' elements are either a byte or -1, which
|
| - // represents any byte.
|
| + // 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 start_;
|
| + const uword end_;
|
|
|
| DISALLOW_COPY_AND_ASSIGN(InstructionPattern);
|
| };
|
|
|
|
|
| -class CallOrJumpPattern : public InstructionPattern {
|
| +class CallPattern : public InstructionPattern {
|
| public:
|
| + CallPattern(uword pc, const Code& code)
|
| + : InstructionPattern(pc), code_(code) { }
|
| +
|
| + static const int kLengthInBytes = 1*kWordSize;
|
| +
|
| virtual int pattern_length_in_bytes() const {
|
| return kLengthInBytes;
|
| }
|
| uword TargetAddress() const;
|
| void SetTargetAddress(uword new_target) const;
|
|
|
| - protected:
|
| - explicit CallOrJumpPattern(uword pc) : InstructionPattern(pc) {}
|
| - static const int kLengthInBytes = 0;
|
| -
|
| private:
|
| - DISALLOW_COPY_AND_ASSIGN(CallOrJumpPattern);
|
| -};
|
| + virtual const int* pattern() const;
|
|
|
| + const Code& code_;
|
|
|
| -class CallPattern : public CallOrJumpPattern {
|
| - public:
|
| - explicit CallPattern(uword pc) : CallOrJumpPattern(pc) {}
|
| - static int InstructionLength() {
|
| - return kLengthInBytes;
|
| - }
|
| -
|
| - private:
|
| - virtual const int* pattern() const;
|
| -
|
| DISALLOW_COPY_AND_ASSIGN(CallPattern);
|
| };
|
|
|
|
|
| -class JumpPattern : public CallOrJumpPattern {
|
| +class JumpPattern : public InstructionPattern {
|
| public:
|
| - explicit JumpPattern(uword pc) : CallOrJumpPattern(pc) {}
|
| + explicit JumpPattern(uword pc) : InstructionPattern(pc) { }
|
|
|
| + static const int kLengthInBytes = 3*kWordSize;
|
| +
|
| + virtual int pattern_length_in_bytes() const {
|
| + return kLengthInBytes;
|
| + }
|
| + uword TargetAddress() const;
|
| + void SetTargetAddress(uword new_target) const;
|
| +
|
| private:
|
| virtual const int* pattern() const;
|
|
|
|
|