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

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

Issue 1122423003: [turbofan] Add support for advanced reducers. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Move comment 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
« no previous file with comments | « src/compiler/node-marker.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 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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-marker.h" 5 #include "src/compiler/node-marker.h"
6 6
7 #include "src/compiler/graph.h" 7 #include "src/compiler/graph.h"
8 #include "src/compiler/node.h" 8 #include "src/compiler/node.h"
9 9
10 namespace v8 { 10 namespace v8 {
11 namespace internal { 11 namespace internal {
12 namespace compiler { 12 namespace compiler {
13 13
14 NodeMarkerBase::NodeMarkerBase(Graph* graph, uint32_t num_states) 14 NodeMarkerBase::NodeMarkerBase(Graph* graph, uint32_t num_states)
15 : mark_min_(graph->mark_max_), mark_max_(graph->mark_max_ += num_states) { 15 : mark_min_(graph->mark_max_), mark_max_(graph->mark_max_ += num_states) {
16 DCHECK(num_states > 0); // user error! 16 DCHECK_NE(0u, num_states); // user error!
17 DCHECK(mark_max_ > mark_min_); // check for wraparound. 17 DCHECK_LT(mark_min_, mark_max_); // check for wraparound.
18 } 18 }
19 19
20 20
21 Mark NodeMarkerBase::Get(Node* node) { 21 Mark NodeMarkerBase::Get(Node* node) {
22 Mark mark = node->mark(); 22 Mark mark = node->mark();
23 if (mark < mark_min_) { 23 if (mark < mark_min_) {
24 mark = mark_min_; 24 mark = mark_min_;
25 node->set_mark(mark_min_); 25 node->set_mark(mark_min_);
26 } 26 }
27 DCHECK_LT(mark, mark_max_); 27 DCHECK_LT(mark, mark_max_);
28 return mark - mark_min_; 28 return mark - mark_min_;
29 } 29 }
30 30
31 31
32 void NodeMarkerBase::Set(Node* node, Mark mark) { 32 void NodeMarkerBase::Set(Node* node, Mark mark) {
33 DCHECK_LT(mark, mark_max_ - mark_min_); 33 DCHECK_LT(mark, mark_max_ - mark_min_);
34 DCHECK_LT(node->mark(), mark_max_); 34 DCHECK_LT(node->mark(), mark_max_);
35 node->set_mark(mark + mark_min_); 35 node->set_mark(mark + mark_min_);
36 } 36 }
37 37
38
39 void NodeMarkerBase::Reset(Graph* graph) {
40 uint32_t const num_states = mark_max_ - mark_min_;
41 mark_min_ = graph->mark_max_;
42 mark_max_ = graph->mark_max_ += num_states;
43 DCHECK_LT(mark_min_, mark_max_); // check for wraparound.
44 }
45
38 } // namespace compiler 46 } // namespace compiler
39 } // namespace internal 47 } // namespace internal
40 } // namespace v8 48 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/node-marker.h ('k') | src/compiler/osr.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698