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

Side by Side Diff: src/lithium-allocator-inl.h

Issue 6352006: Remove instruction summaries and provide a LIR-interface for the register all... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: addressed comments, rebased and ported to ARM and x64 Created 9 years, 11 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/lithium-allocator.cc ('k') | src/x64/lithium-x64.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2010 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are
4 // met:
5 //
6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided
11 // with the distribution.
12 // * Neither the name of Google Inc. nor the names of its
13 // contributors may be used to endorse or promote products derived
14 // from this software without specific prior written permission.
15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
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.
27
28 #ifndef V8_LITHIUM_ALLOCATOR_INL_H_
29 #define V8_LITHIUM_ALLOCATOR_INL_H_
30
31 #include "lithium-allocator.h"
32
33 #if V8_TARGET_ARCH_IA32
34 #include "ia32/lithium-ia32.h"
35 #elif V8_TARGET_ARCH_X64
36 #include "x64/lithium-x64.h"
37 #elif V8_TARGET_ARCH_ARM
38 #include "arm/lithium-arm.h"
39 #else
40 #error "Unknown architecture."
41 #endif
42
43 namespace v8 {
44 namespace internal {
45
46 bool LAllocator::IsGapAt(int index) { return chunk_->IsGapAt(index); }
47
48
49 LInstruction* LAllocator::InstructionAt(int index) {
50 return chunk_->instructions()->at(index);
51 }
52
53
54 LGap* LAllocator::GapAt(int index) {
55 return chunk_->GetGapAt(index);
56 }
57
58
59 TempIterator::TempIterator(LInstruction* instr)
60 : instr_(instr),
61 limit_(instr->TempCount()),
62 current_(0) {
63 current_ = AdvanceToNext(0);
64 }
65
66
67 bool TempIterator::HasNext() { return current_ < limit_; }
68
69
70 LOperand* TempIterator::Next() {
71 ASSERT(HasNext());
72 return instr_->TempAt(current_);
73 }
74
75
76 int TempIterator::AdvanceToNext(int start) {
77 while (start < limit_ && instr_->TempAt(start) == NULL) start++;
78 return start;
79 }
80
81
82 void TempIterator::Advance() {
83 current_ = AdvanceToNext(current_ + 1);
84 }
85
86
87 InputIterator::InputIterator(LInstruction* instr)
88 : instr_(instr),
89 limit_(instr->InputCount()),
90 current_(0) {
91 current_ = AdvanceToNext(0);
92 }
93
94
95 bool InputIterator::HasNext() { return current_ < limit_; }
96
97
98 LOperand* InputIterator::Next() {
99 ASSERT(HasNext());
100 return instr_->InputAt(current_);
101 }
102
103
104 void InputIterator::Advance() {
105 current_ = AdvanceToNext(current_ + 1);
106 }
107
108
109 int InputIterator::AdvanceToNext(int start) {
110 while (start < limit_ && instr_->InputAt(start)->IsConstantOperand()) start++;
111 return start;
112 }
113
114
115 UseIterator::UseIterator(LInstruction* instr)
116 : input_iterator_(instr), env_iterator_(instr->environment()) { }
117
118
119 bool UseIterator::HasNext() {
120 return input_iterator_.HasNext() || env_iterator_.HasNext();
121 }
122
123
124 LOperand* UseIterator::Next() {
125 ASSERT(HasNext());
126 return input_iterator_.HasNext()
127 ? input_iterator_.Next()
128 : env_iterator_.Next();
129 }
130
131
132 void UseIterator::Advance() {
133 input_iterator_.HasNext()
134 ? input_iterator_.Advance()
135 : env_iterator_.Advance();
136 }
137
138 } } // namespace v8::internal
139
140 #endif // V8_LITHIUM_ALLOCATOR_INL_H_
OLDNEW
« no previous file with comments | « src/lithium-allocator.cc ('k') | src/x64/lithium-x64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698