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

Side by Side Diff: src/register-allocator-ia32.h

Issue 20218: A bunch of changes to get the ARM port compiling again. (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/toiger/
Patch Set: Created 11 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 | « src/register-allocator.h ('k') | src/virtual-frame.h » ('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 2008 the V8 project authors. All rights reserved. 1 // Copyright 2008 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 10 matching lines...) Expand all
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 27
28 #ifndef V8_REGISTER_ALLOCATOR_IA32_H_ 28 #ifndef V8_REGISTER_ALLOCATOR_IA32_H_
29 #define V8_REGISTER_ALLOCATOR_IA32_H_ 29 #define V8_REGISTER_ALLOCATOR_IA32_H_
30 30
31 #include "macro-assembler.h"
32
33 namespace v8 { namespace internal { 31 namespace v8 { namespace internal {
34 32
35 33
36 // ------------------------------------------------------------------------- 34 // -------------------------------------------------------------------------
37 // Results
38 //
39 // Results encapsulate the compile-time values manipulated by the code
40 // generator. They can represent registers or constants.
41
42 class Result BASE_EMBEDDED {
43 public:
44 enum Type {
45 INVALID,
46 REGISTER,
47 CONSTANT
48 };
49
50 // Construct an invalid result.
51 explicit Result(CodeGenerator* cgen) : type_(INVALID), cgen_(cgen) {}
52
53 // Construct a register Result.
54 Result(Register reg, CodeGenerator* cgen);
55
56 // Construct a Result whose value is a compile-time constant.
57 Result(Handle<Object> value, CodeGenerator * cgen)
58 : type_(CONSTANT),
59 cgen_(cgen) {
60 data_.handle_ = value.location();
61 }
62
63 // The copy constructor and assignment operators could each create a new
64 // register reference.
65 Result(const Result& other) {
66 other.CopyTo(this);
67 }
68
69 Result& operator=(const Result& other) {
70 if (this != &other) {
71 Unuse();
72 other.CopyTo(this);
73 }
74 return *this;
75 }
76
77 ~Result() { Unuse(); }
78
79 void Unuse();
80
81 Type type() const { return type_; }
82
83 bool is_valid() const { return type() != INVALID; }
84 bool is_register() const { return type() == REGISTER; }
85 bool is_constant() const { return type() == CONSTANT; }
86
87 Register reg() const {
88 ASSERT(type() == REGISTER);
89 return data_.reg_;
90 }
91
92 Handle<Object> handle() const {
93 ASSERT(type() == CONSTANT);
94 return Handle<Object>(data_.handle_);
95 }
96
97 // Move this result to an arbitrary register. The register is not
98 // necessarily spilled from the frame or even singly-referenced outside
99 // it.
100 void ToRegister();
101
102 // Move this result to a specified register. The register is spilled from
103 // the frame, and the register is singly-referenced (by this result)
104 // outside the frame.
105 void ToRegister(Register reg);
106
107 private:
108 Type type_;
109
110 union {
111 Register reg_;
112 Object** handle_;
113 } data_;
114
115 CodeGenerator* cgen_;
116
117 void CopyTo(Result* destination) const;
118 };
119
120
121 // -------------------------------------------------------------------------
122 // Register file 35 // Register file
123 // 36 //
124 // The register file tracks reference counts for the processor registers. 37 // The register file tracks reference counts for the processor registers.
125 // It is used by both the register allocator and the virtual frame. 38 // It is used by both the register allocator and the virtual frame.
126 39
127 class RegisterFile BASE_EMBEDDED { 40 class RegisterFile BASE_EMBEDDED {
128 public: 41 public:
129 RegisterFile() { Reset(); } 42 RegisterFile() { Reset(); }
130 43
131 void Reset() { 44 void Reset() {
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 } 146 }
234 147
235 private: 148 private:
236 CodeGenerator* cgen_; 149 CodeGenerator* cgen_;
237 RegisterFile registers_; 150 RegisterFile registers_;
238 }; 151 };
239 152
240 } } // namespace v8::internal 153 } } // namespace v8::internal
241 154
242 #endif // V8_REGISTER_ALLOCATOR_IA32_H_ 155 #endif // V8_REGISTER_ALLOCATOR_IA32_H_
OLDNEW
« no previous file with comments | « src/register-allocator.h ('k') | src/virtual-frame.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698