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

Side by Side Diff: src/compiler/node.cc

Issue 1114163005: [turbofan] Fix tail call optimization. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 7 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
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 #include "src/compiler/node.h" 5 #include "src/compiler/node.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 namespace v8 { 9 namespace v8 {
10 namespace internal { 10 namespace internal {
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 if (last_use) { 131 if (last_use) {
132 // Concat the use list of {this} and {that}. 132 // Concat the use list of {this} and {that}.
133 last_use->next = that->first_use_; 133 last_use->next = that->first_use_;
134 if (that->first_use_) that->first_use_->prev = last_use; 134 if (that->first_use_) that->first_use_->prev = last_use;
135 that->first_use_ = this->first_use_; 135 that->first_use_ = this->first_use_;
136 } 136 }
137 first_use_ = nullptr; 137 first_use_ = nullptr;
138 } 138 }
139 139
140 140
141 bool Node::OwnedBy(Node const* owner1, Node const* owner2) const {
142 unsigned mask = 0;
143 for (Use* use = first_use_; use; use = use->next) {
144 if (use->from == owner1) {
145 mask |= 1;
146 } else if (use->from == owner2) {
147 mask |= 2;
148 } else {
149 return false;
150 }
151 }
152 return mask == 3;
153 }
154
155
141 void Node::Input::Update(Node* new_to) { 156 void Node::Input::Update(Node* new_to) {
142 Node* old_to = this->to; 157 Node* old_to = this->to;
143 if (new_to == old_to) return; // Nothing to do. 158 if (new_to == old_to) return; // Nothing to do.
144 // Snip out the use from where it used to be 159 // Snip out the use from where it used to be
145 if (old_to) { 160 if (old_to) {
146 old_to->RemoveUse(use); 161 old_to->RemoveUse(use);
147 } 162 }
148 to = new_to; 163 to = new_to;
149 // And put it into the new node's use list. 164 // And put it into the new node's use list.
150 if (new_to) { 165 if (new_to) {
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 ++(*this); 268 ++(*this);
254 return result; 269 return result;
255 } 270 }
256 271
257 272
258 bool Node::Uses::empty() const { return begin() == end(); } 273 bool Node::Uses::empty() const { return begin() == end(); }
259 274
260 } // namespace compiler 275 } // namespace compiler
261 } // namespace internal 276 } // namespace internal
262 } // namespace v8 277 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698