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

Side by Side Diff: src/compiler/generic-node-inl.h

Issue 521643002: Fix Node::ReplaceUses to handle unused nodes. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 3 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 | « no previous file | test/cctest/compiler/test-node.cc » ('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 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
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
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_
OLDNEW
« no previous file with comments | « no previous file | test/cctest/compiler/test-node.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698