OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_COMPILER_GENERIC_NODE_INL_H_ | 5 #ifndef V8_COMPILER_GENERIC_NODE_INL_H_ |
6 #define V8_COMPILER_GENERIC_NODE_INL_H_ | 6 #define V8_COMPILER_GENERIC_NODE_INL_H_ |
7 | 7 |
8 #include "src/v8.h" | 8 #include "src/v8.h" |
9 | 9 |
10 #include "src/compiler/generic-graph.h" | 10 #include "src/compiler/generic-graph.h" |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 GenericNode<B, S>::Uses::end() { | 55 GenericNode<B, S>::Uses::end() { |
56 return typename GenericNode<B, S>::Uses::iterator(); | 56 return typename GenericNode<B, S>::Uses::iterator(); |
57 } | 57 } |
58 | 58 |
59 template <class B, class S> | 59 template <class B, class S> |
60 void GenericNode<B, S>::ReplaceUses(GenericNode* replace_to) { | 60 void GenericNode<B, S>::ReplaceUses(GenericNode* replace_to) { |
61 for (Use* use = first_use_; use != NULL; use = use->next) { | 61 for (Use* use = first_use_; use != NULL; use = use->next) { |
62 use->from->GetInputRecordPtr(use->input_index)->to = replace_to; | 62 use->from->GetInputRecordPtr(use->input_index)->to = replace_to; |
63 } | 63 } |
64 if (replace_to->last_use_ == NULL) { | 64 if (replace_to->last_use_ == NULL) { |
65 ASSERT_EQ(NULL, replace_to->first_use_); | 65 DCHECK_EQ(NULL, replace_to->first_use_); |
66 replace_to->first_use_ = first_use_; | 66 replace_to->first_use_ = first_use_; |
67 } else { | 67 } else { |
68 ASSERT_NE(NULL, replace_to->first_use_); | 68 DCHECK_NE(NULL, replace_to->first_use_); |
69 replace_to->last_use_->next = first_use_; | 69 replace_to->last_use_->next = first_use_; |
70 first_use_->prev = replace_to->last_use_; | 70 first_use_->prev = replace_to->last_use_; |
71 } | 71 } |
72 replace_to->last_use_ = last_use_; | 72 replace_to->last_use_ = last_use_; |
73 replace_to->use_count_ += use_count_; | 73 replace_to->use_count_ += use_count_; |
74 use_count_ = 0; | 74 use_count_ = 0; |
75 first_use_ = NULL; | 75 first_use_ = NULL; |
76 last_use_ = NULL; | 76 last_use_ = NULL; |
77 } | 77 } |
78 | 78 |
(...skipping 17 matching lines...) Expand all Loading... |
96 for (typename Inputs::iterator iter(inputs().begin()); iter != inputs().end(); | 96 for (typename Inputs::iterator iter(inputs().begin()); iter != inputs().end(); |
97 ++iter) { | 97 ++iter) { |
98 iter.GetInput()->Update(NULL); | 98 iter.GetInput()->Update(NULL); |
99 } | 99 } |
100 } | 100 } |
101 | 101 |
102 template <class B, class S> | 102 template <class B, class S> |
103 void GenericNode<B, S>::TrimInputCount(int new_input_count) { | 103 void GenericNode<B, S>::TrimInputCount(int new_input_count) { |
104 if (new_input_count == input_count_) return; // Nothing to do. | 104 if (new_input_count == input_count_) return; // Nothing to do. |
105 | 105 |
106 ASSERT(new_input_count < input_count_); | 106 DCHECK(new_input_count < input_count_); |
107 | 107 |
108 // Update inline inputs. | 108 // Update inline inputs. |
109 for (int i = new_input_count; i < input_count_; i++) { | 109 for (int i = new_input_count; i < input_count_; i++) { |
110 typename GenericNode<B, S>::Input* input = GetInputRecordPtr(i); | 110 typename GenericNode<B, S>::Input* input = GetInputRecordPtr(i); |
111 input->Update(NULL); | 111 input->Update(NULL); |
112 } | 112 } |
113 input_count_ = new_input_count; | 113 input_count_ = new_input_count; |
114 } | 114 } |
115 | 115 |
116 template <class B, class S> | 116 template <class B, class S> |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 inputs_.appendable_->push_back(new_input); | 160 inputs_.appendable_->push_back(new_input); |
161 new_use->input_index = input_count_; | 161 new_use->input_index = input_count_; |
162 new_use->from = this; | 162 new_use->from = this; |
163 to_append->AppendUse(new_use); | 163 to_append->AppendUse(new_use); |
164 input_count_++; | 164 input_count_++; |
165 } | 165 } |
166 | 166 |
167 template <class B, class S> | 167 template <class B, class S> |
168 void GenericNode<B, S>::InsertInput(Zone* zone, int index, | 168 void GenericNode<B, S>::InsertInput(Zone* zone, int index, |
169 GenericNode<B, S>* to_insert) { | 169 GenericNode<B, S>* to_insert) { |
170 ASSERT(index >= 0 && index < InputCount()); | 170 DCHECK(index >= 0 && index < InputCount()); |
171 // TODO(turbofan): Optimize this implementation! | 171 // TODO(turbofan): Optimize this implementation! |
172 AppendInput(zone, InputAt(InputCount() - 1)); | 172 AppendInput(zone, InputAt(InputCount() - 1)); |
173 for (int i = InputCount() - 1; i > index; --i) { | 173 for (int i = InputCount() - 1; i > index; --i) { |
174 ReplaceInput(i, InputAt(i - 1)); | 174 ReplaceInput(i, InputAt(i - 1)); |
175 } | 175 } |
176 ReplaceInput(index, to_insert); | 176 ReplaceInput(index, to_insert); |
177 } | 177 } |
178 | 178 |
179 template <class B, class S> | 179 template <class B, class S> |
180 void GenericNode<B, S>::AppendUse(Use* use) { | 180 void GenericNode<B, S>::AppendUse(Use* use) { |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 ++use; | 236 ++use; |
237 ++input; | 237 ++input; |
238 } | 238 } |
239 return result; | 239 return result; |
240 } | 240 } |
241 } | 241 } |
242 } | 242 } |
243 } // namespace v8::internal::compiler | 243 } // namespace v8::internal::compiler |
244 | 244 |
245 #endif // V8_COMPILER_GENERIC_NODE_INL_H_ | 245 #endif // V8_COMPILER_GENERIC_NODE_INL_H_ |
OLD | NEW |