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

Side by Side Diff: src/compiler/simplified-lowering.cc

Issue 505133003: Introduce subclass wrappers for STL containers that make them a lot easier (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 | « src/compiler/scheduler.cc ('k') | src/compiler/structured-machine-assembler.h » ('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/compiler/simplified-lowering.h" 5 #include "src/compiler/simplified-lowering.h"
6 6
7 #include <deque>
8 #include <queue>
9
10 #include "src/compiler/common-operator.h" 7 #include "src/compiler/common-operator.h"
11 #include "src/compiler/graph-inl.h" 8 #include "src/compiler/graph-inl.h"
12 #include "src/compiler/node-properties-inl.h" 9 #include "src/compiler/node-properties-inl.h"
13 #include "src/compiler/representation-change.h" 10 #include "src/compiler/representation-change.h"
14 #include "src/compiler/simplified-lowering.h" 11 #include "src/compiler/simplified-lowering.h"
15 #include "src/compiler/simplified-operator.h" 12 #include "src/compiler/simplified-operator.h"
16 #include "src/objects.h" 13 #include "src/objects.h"
17 14
18 namespace v8 { 15 namespace v8 {
19 namespace internal { 16 namespace internal {
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 bool queued : 1; // Bookkeeping for the traversal. 55 bool queued : 1; // Bookkeeping for the traversal.
59 bool visited : 1; // Bookkeeping for the traversal. 56 bool visited : 1; // Bookkeeping for the traversal.
60 MachineTypeUnion output : 14; // Output type of the node. 57 MachineTypeUnion output : 14; // Output type of the node.
61 }; 58 };
62 59
63 RepresentationSelector(JSGraph* jsgraph, Zone* zone, 60 RepresentationSelector(JSGraph* jsgraph, Zone* zone,
64 RepresentationChanger* changer) 61 RepresentationChanger* changer)
65 : jsgraph_(jsgraph), 62 : jsgraph_(jsgraph),
66 count_(jsgraph->graph()->NodeCount()), 63 count_(jsgraph->graph()->NodeCount()),
67 info_(zone->NewArray<NodeInfo>(count_)), 64 info_(zone->NewArray<NodeInfo>(count_)),
68 nodes_(NodeVector::allocator_type(zone)), 65 nodes_(zone),
69 replacements_(NodeVector::allocator_type(zone)), 66 replacements_(zone),
70 contains_js_nodes_(false), 67 contains_js_nodes_(false),
71 phase_(PROPAGATE), 68 phase_(PROPAGATE),
72 changer_(changer), 69 changer_(changer),
73 queue_(std::deque<Node*, NodePtrZoneAllocator>( 70 queue_(zone) {
74 NodePtrZoneAllocator(zone))) {
75 memset(info_, 0, sizeof(NodeInfo) * count_); 71 memset(info_, 0, sizeof(NodeInfo) * count_);
76 } 72 }
77 73
78 void Run(SimplifiedLowering* lowering) { 74 void Run(SimplifiedLowering* lowering) {
79 // Run propagation phase to a fixpoint. 75 // Run propagation phase to a fixpoint.
80 TRACE(("--{Propagation phase}--\n")); 76 TRACE(("--{Propagation phase}--\n"));
81 phase_ = PROPAGATE; 77 phase_ = PROPAGATE;
82 Enqueue(jsgraph_->graph()->end()); 78 Enqueue(jsgraph_->graph()->end());
83 // Process nodes from the queue until it is empty. 79 // Process nodes from the queue until it is empty.
84 while (!queue_.empty()) { 80 while (!queue_.empty()) {
(...skipping 612 matching lines...) Expand 10 before | Expand all | Expand 10 after
697 693
698 private: 694 private:
699 JSGraph* jsgraph_; 695 JSGraph* jsgraph_;
700 int count_; // number of nodes in the graph 696 int count_; // number of nodes in the graph
701 NodeInfo* info_; // node id -> usage information 697 NodeInfo* info_; // node id -> usage information
702 NodeVector nodes_; // collected nodes 698 NodeVector nodes_; // collected nodes
703 NodeVector replacements_; // replacements to be done after lowering 699 NodeVector replacements_; // replacements to be done after lowering
704 bool contains_js_nodes_; // {true} if a JS operator was seen 700 bool contains_js_nodes_; // {true} if a JS operator was seen
705 Phase phase_; // current phase of algorithm 701 Phase phase_; // current phase of algorithm
706 RepresentationChanger* changer_; // for inserting representation changes 702 RepresentationChanger* changer_; // for inserting representation changes
707 703 ZoneQueue<Node*> queue_; // queue for traversing the graph
708 std::queue<Node*, std::deque<Node*, NodePtrZoneAllocator> > queue_;
709 704
710 NodeInfo* GetInfo(Node* node) { 705 NodeInfo* GetInfo(Node* node) {
711 DCHECK(node->id() >= 0); 706 DCHECK(node->id() >= 0);
712 DCHECK(node->id() < count_); 707 DCHECK(node->id() < count_);
713 return &info_[node->id()]; 708 return &info_[node->id()];
714 } 709 }
715 710
716 MachineTypeUnion GetUseInfo(Node* node) { return GetInfo(node)->use; } 711 MachineTypeUnion GetUseInfo(Node* node) { return GetInfo(node)->use; }
717 }; 712 };
718 713
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
1000 break; 995 break;
1001 default: 996 default:
1002 UNREACHABLE(); 997 UNREACHABLE();
1003 break; 998 break;
1004 } 999 }
1005 } 1000 }
1006 1001
1007 } // namespace compiler 1002 } // namespace compiler
1008 } // namespace internal 1003 } // namespace internal
1009 } // namespace v8 1004 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/scheduler.cc ('k') | src/compiler/structured-machine-assembler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698