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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 DCHECK_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 replace_to->last_use_ = last_use_; |
| 68 } else if (first_use_ != NULL) { |
68 DCHECK_NE(NULL, replace_to->first_use_); | 69 DCHECK_NE(NULL, replace_to->first_use_); |
69 replace_to->last_use_->next = first_use_; | 70 replace_to->last_use_->next = first_use_; |
70 first_use_->prev = replace_to->last_use_; | 71 first_use_->prev = replace_to->last_use_; |
| 72 replace_to->last_use_ = last_use_; |
71 } | 73 } |
72 replace_to->last_use_ = last_use_; | |
73 replace_to->use_count_ += use_count_; | 74 replace_to->use_count_ += use_count_; |
74 use_count_ = 0; | 75 use_count_ = 0; |
75 first_use_ = NULL; | 76 first_use_ = NULL; |
76 last_use_ = NULL; | 77 last_use_ = NULL; |
77 } | 78 } |
78 | 79 |
79 template <class B, class S> | 80 template <class B, class S> |
80 template <class UnaryPredicate> | 81 template <class UnaryPredicate> |
81 void GenericNode<B, S>::ReplaceUsesIf(UnaryPredicate pred, | 82 void GenericNode<B, S>::ReplaceUsesIf(UnaryPredicate pred, |
82 GenericNode* replace_to) { | 83 GenericNode* replace_to) { |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 ++use; | 237 ++use; |
237 ++input; | 238 ++input; |
238 } | 239 } |
239 return result; | 240 return result; |
240 } | 241 } |
241 } | 242 } |
242 } | 243 } |
243 } // namespace v8::internal::compiler | 244 } // namespace v8::internal::compiler |
244 | 245 |
245 #endif // V8_COMPILER_GENERIC_NODE_INL_H_ | 246 #endif // V8_COMPILER_GENERIC_NODE_INL_H_ |
OLD | NEW |