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

Side by Side Diff: src/register-allocator.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/jump-target-arm.cc ('k') | src/register-allocator-ia32.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_H_ 28 #ifndef V8_REGISTER_ALLOCATOR_H_
29 #define V8_REGISTER_ALLOCATOR_H_ 29 #define V8_REGISTER_ALLOCATOR_H_
30 30
31 #if defined(ARM) || defined(__arm__) || defined(__thumb__) 31 #include "macro-assembler.h"
32
33 namespace v8 { namespace internal {
34
35 // -------------------------------------------------------------------------
36 // Results
37 //
38 // Results encapsulate the compile-time values manipulated by the code
39 // generator. They can represent registers or constants.
40
41 class Result BASE_EMBEDDED {
42 public:
43 enum Type {
44 INVALID,
45 REGISTER,
46 CONSTANT
47 };
48
49 // Construct an invalid result.
50 explicit Result(CodeGenerator* cgen) : type_(INVALID), cgen_(cgen) {}
51
52 // Construct a register Result.
53 Result(Register reg, CodeGenerator* cgen);
54
55 // Construct a Result whose value is a compile-time constant.
56 Result(Handle<Object> value, CodeGenerator * cgen)
57 : type_(CONSTANT),
58 cgen_(cgen) {
59 data_.handle_ = value.location();
60 }
61
62 // The copy constructor and assignment operators could each create a new
63 // register reference.
64 Result(const Result& other) {
65 other.CopyTo(this);
66 }
67
68 Result& operator=(const Result& other) {
69 if (this != &other) {
70 Unuse();
71 other.CopyTo(this);
72 }
73 return *this;
74 }
75
76 ~Result() { Unuse(); }
77
78 void Unuse();
79
80 Type type() const { return type_; }
81
82 bool is_valid() const { return type() != INVALID; }
83 bool is_register() const { return type() == REGISTER; }
84 bool is_constant() const { return type() == CONSTANT; }
85
86 Register reg() const {
87 ASSERT(type() == REGISTER);
88 return data_.reg_;
89 }
90
91 Handle<Object> handle() const {
92 ASSERT(type() == CONSTANT);
93 return Handle<Object>(data_.handle_);
94 }
95
96 // Move this result to an arbitrary register. The register is not
97 // necessarily spilled from the frame or even singly-referenced outside
98 // it.
99 void ToRegister();
100
101 // Move this result to a specified register. The register is spilled from
102 // the frame, and the register is singly-referenced (by this result)
103 // outside the frame.
104 void ToRegister(Register reg);
105
106 private:
107 Type type_;
108
109 union {
110 Register reg_;
111 Object** handle_;
112 } data_;
113
114 CodeGenerator* cgen_;
115
116 void CopyTo(Result* destination) const;
117 };
118
119 } } // namespace v8::internal
120
121
122 #ifdef ARM
32 #else // ia32 123 #else // ia32
33 #include "register-allocator-ia32.h" 124 #include "register-allocator-ia32.h"
34 #endif 125 #endif
35 126
36 #endif // V8_REGISTER_ALLOCATOR_H_ 127 #endif // V8_REGISTER_ALLOCATOR_H_
OLDNEW
« no previous file with comments | « src/jump-target-arm.cc ('k') | src/register-allocator-ia32.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698