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

Side by Side Diff: src/compiler/js-graph.cc

Issue 929123002: Move DeadControl into the JSGraph so that it can be reused. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 10 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
« no previous file with comments | « src/compiler/js-graph.h ('k') | src/compiler/osr.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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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/code-stubs.h" 5 #include "src/code-stubs.h"
6 #include "src/compiler/js-graph.h" 6 #include "src/compiler/js-graph.h"
7 #include "src/compiler/node-properties.h" 7 #include "src/compiler/node-properties.h"
8 #include "src/compiler/typer.h" 8 #include "src/compiler/typer.h"
9 9
10 namespace v8 { 10 namespace v8 {
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 184
185 Node* JSGraph::Float64Constant(double value) { 185 Node* JSGraph::Float64Constant(double value) {
186 Node** loc = cache_.FindFloat64Constant(value); 186 Node** loc = cache_.FindFloat64Constant(value);
187 if (*loc == NULL) { 187 if (*loc == NULL) {
188 *loc = graph()->NewNode(common()->Float64Constant(value)); 188 *loc = graph()->NewNode(common()->Float64Constant(value));
189 } 189 }
190 return *loc; 190 return *loc;
191 } 191 }
192 192
193 193
194 Node* JSGraph::ExternalConstant(ExternalReference reference) {
195 Node** loc = cache_.FindExternalConstant(reference);
196 if (*loc == NULL) {
197 *loc = graph()->NewNode(common()->ExternalConstant(reference));
198 }
199 return *loc;
200 }
201
202
194 Node* JSGraph::EmptyFrameState() { 203 Node* JSGraph::EmptyFrameState() {
195 if (!empty_frame_state_.is_set()) { 204 if (!empty_frame_state_.is_set()) {
196 Node* values = graph()->NewNode(common()->StateValues(0)); 205 Node* values = graph()->NewNode(common()->StateValues(0));
197 Node* state_node = graph()->NewNode( 206 Node* state_node = graph()->NewNode(
198 common()->FrameState(JS_FRAME, BailoutId(0), 207 common()->FrameState(JS_FRAME, BailoutId(0),
199 OutputFrameStateCombine::Ignore()), 208 OutputFrameStateCombine::Ignore()),
200 values, values, values, NoContextConstant(), UndefinedConstant()); 209 values, values, values, NoContextConstant(), UndefinedConstant());
201 empty_frame_state_.set(state_node); 210 empty_frame_state_.set(state_node);
202 } 211 }
203 return empty_frame_state_.get(); 212 return empty_frame_state_.get();
204 } 213 }
205 214
206 215
207 Node* JSGraph::ExternalConstant(ExternalReference reference) { 216 Node* JSGraph::DeadControl() {
208 Node** loc = cache_.FindExternalConstant(reference); 217 if (!dead_control_.is_set()) {
209 if (*loc == NULL) { 218 Node* dead_node = graph()->NewNode(common()->Dead());
210 *loc = graph()->NewNode(common()->ExternalConstant(reference)); 219 dead_control_.set(dead_node);
211 } 220 }
212 return *loc; 221 return dead_control_.get();
213 } 222 }
214 223
215 224
216 void JSGraph::GetCachedNodes(NodeVector* nodes) { 225 void JSGraph::GetCachedNodes(NodeVector* nodes) {
217 cache_.GetCachedNodes(nodes); 226 cache_.GetCachedNodes(nodes);
218 SetOncePointer<Node>* ptrs[] = { 227 SetOncePointer<Node>* ptrs[] = {
219 &c_entry_stub_constant_, &undefined_constant_, &the_hole_constant_, 228 &c_entry_stub_constant_, &undefined_constant_, &the_hole_constant_,
220 &true_constant_, &false_constant_, &null_constant_, 229 &true_constant_, &false_constant_, &null_constant_,
221 &zero_constant_, &one_constant_, &nan_constant_}; 230 &zero_constant_, &one_constant_, &nan_constant_};
222 for (size_t i = 0; i < arraysize(ptrs); i++) { 231 for (size_t i = 0; i < arraysize(ptrs); i++) {
223 if (ptrs[i]->is_set()) nodes->push_back(ptrs[i]->get()); 232 if (ptrs[i]->is_set()) nodes->push_back(ptrs[i]->get());
224 } 233 }
225 } 234 }
226 235
227 } // namespace compiler 236 } // namespace compiler
228 } // namespace internal 237 } // namespace internal
229 } // namespace v8 238 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/js-graph.h ('k') | src/compiler/osr.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698