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

Side by Side Diff: runtime/vm/instructions_ia32.h

Issue 9414003: Initial implementation of a flow-graph builder for Dart's AST. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Rely on assumption that code can reach both branches of a condition. Created 8 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/vm/handles_impl.h ('k') | runtime/vm/instructions_ia32.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 // Classes that describe assembly patterns as used by inline caches. 4 // Classes that describe assembly patterns as used by inline caches.
5 5
6 #ifndef VM_INSTRUCTIONS_IA32_H_ 6 #ifndef VM_INSTRUCTIONS_IA32_H_
7 #define VM_INSTRUCTIONS_IA32_H_ 7 #define VM_INSTRUCTIONS_IA32_H_
8 8
9 #ifndef VM_INSTRUCTIONS_H_ 9 #ifndef VM_INSTRUCTIONS_H_
10 #error Do not include instructions_ia32.h directly; use instructions.h instead. 10 #error Do not include instructions_ia32.h directly; use instructions.h instead.
11 #endif 11 #endif
12 12
13 #include "vm/allocation.h" 13 #include "vm/allocation.h"
14 14
15 namespace dart { 15 namespace dart {
16 16
17 // Forward declarations. 17 // Forward declarations.
18 class RawClass; 18 class RawClass;
19 class Immediate; 19 class Immediate;
20 class RawObject; 20 class RawObject;
21 21
22 // Abstract class for all instruction pattern classes. 22 // Abstract class for all instruction pattern classes.
23 class Instruction : public ValueObject { 23 class InstructionPattern : public ValueObject {
24 public: 24 public:
25 explicit Instruction(uword pc) : start_(pc) { 25 explicit InstructionPattern(uword pc) : start_(pc) {
26 ASSERT(pc != 0); 26 ASSERT(pc != 0);
27 } 27 }
28 virtual ~Instruction() {} 28 virtual ~InstructionPattern() {}
29 29
30 // Call to check if the instruction pattern at 'pc' match the instruction. 30 // Call to check if the instruction pattern at 'pc' match the instruction.
31 virtual bool IsValid() const { 31 virtual bool IsValid() const {
32 return TestBytesWith(pattern(), pattern_length_in_bytes()); 32 return TestBytesWith(pattern(), pattern_length_in_bytes());
33 } 33 }
34 34
35 // 'pattern' returns the expected byte pattern in form of an integer array 35 // 'pattern' returns the expected byte pattern in form of an integer array
36 // with length of 'pattern_length_in_bytes'. A '-1' element means 'any byte'. 36 // with length of 'pattern_length_in_bytes'. A '-1' element means 'any byte'.
37 virtual const int* pattern() const = 0; 37 virtual const int* pattern() const = 0;
38 virtual int pattern_length_in_bytes() const = 0; 38 virtual int pattern_length_in_bytes() const = 0;
39 39
40 protected: 40 protected:
41 uword start() const { return start_; } 41 uword start() const { return start_; }
42 42
43 private: 43 private:
44 // Returns true if the 'num_bytes' bytes at 'start_' correspond to 44 // Returns true if the 'num_bytes' bytes at 'start_' correspond to
45 // array of integers 'data'. 'data' elements are either a byte or -1, which 45 // array of integers 'data'. 'data' elements are either a byte or -1, which
46 // represents any byte. 46 // represents any byte.
47 bool TestBytesWith(const int* data, int num_bytes) const; 47 bool TestBytesWith(const int* data, int num_bytes) const;
48 48
49 const uword start_; 49 const uword start_;
50 50
51 DISALLOW_COPY_AND_ASSIGN(Instruction); 51 DISALLOW_COPY_AND_ASSIGN(InstructionPattern);
52 }; 52 };
53 53
54 54
55 class CallOrJump : public Instruction { 55 class CallOrJumpPattern : public InstructionPattern {
56 public: 56 public:
57 virtual int pattern_length_in_bytes() const { 57 virtual int pattern_length_in_bytes() const {
58 return kLengthInBytes; 58 return kLengthInBytes;
59 } 59 }
60 uword TargetAddress() const; 60 uword TargetAddress() const;
61 void SetTargetAddress(uword new_target) const; 61 void SetTargetAddress(uword new_target) const;
62 62
63 protected: 63 protected:
64 explicit CallOrJump(uword pc) : Instruction(pc) {} 64 explicit CallOrJumpPattern(uword pc) : InstructionPattern(pc) {}
65 static const int kLengthInBytes = 5; 65 static const int kLengthInBytes = 5;
66 66
67 private: 67 private:
68 DISALLOW_COPY_AND_ASSIGN(CallOrJump); 68 DISALLOW_COPY_AND_ASSIGN(CallOrJumpPattern);
69 }; 69 };
70 70
71 71
72 class Call : public CallOrJump { 72 class CallPattern : public CallOrJumpPattern {
73 public: 73 public:
74 explicit Call(uword pc) : CallOrJump(pc) {} 74 explicit CallPattern(uword pc) : CallOrJumpPattern(pc) {}
75 static int InstructionLength() { 75 static int InstructionLength() {
76 return kLengthInBytes; 76 return kLengthInBytes;
77 } 77 }
78 78
79 private: 79 private:
80 virtual const int* pattern() const; 80 virtual const int* pattern() const;
81 81
82 DISALLOW_COPY_AND_ASSIGN(Call); 82 DISALLOW_COPY_AND_ASSIGN(CallPattern);
83 }; 83 };
84 84
85 85
86 class Jump : public CallOrJump { 86 class JumpPattern : public CallOrJumpPattern {
87 public: 87 public:
88 explicit Jump(uword pc) : CallOrJump(pc) {} 88 explicit JumpPattern(uword pc) : CallOrJumpPattern(pc) {}
89 89
90 private: 90 private:
91 virtual const int* pattern() const; 91 virtual const int* pattern() const;
92 92
93 DISALLOW_COPY_AND_ASSIGN(Jump); 93 DISALLOW_COPY_AND_ASSIGN(JumpPattern);
94 }; 94 };
95 95
96 96
97 } // namespace dart 97 } // namespace dart
98 98
99 #endif // VM_INSTRUCTIONS_IA32_H_ 99 #endif // VM_INSTRUCTIONS_IA32_H_
OLDNEW
« no previous file with comments | « runtime/vm/handles_impl.h ('k') | runtime/vm/instructions_ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698