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

Side by Side Diff: runtime/vm/flow_graph_optimizer.h

Issue 1149713002: With --noopt run unoptimized code through optimizer, more optimizations can be done later. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Cleanup 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 (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #ifndef VM_FLOW_GRAPH_OPTIMIZER_H_ 5 #ifndef VM_FLOW_GRAPH_OPTIMIZER_H_
6 #define VM_FLOW_GRAPH_OPTIMIZER_H_ 6 #define VM_FLOW_GRAPH_OPTIMIZER_H_
7 7
8 #include "vm/intermediate_language.h" 8 #include "vm/intermediate_language.h"
9 #include "vm/flow_graph.h" 9 #include "vm/flow_graph.h"
10 10
11 namespace dart { 11 namespace dart {
12 12
13 class CSEInstructionMap; 13 class CSEInstructionMap;
14 template <typename T> class GrowableArray; 14 template <typename T> class GrowableArray;
15 class ParsedFunction; 15 class ParsedFunction;
16 16
17 class FlowGraphOptimizer : public FlowGraphVisitor { 17 class FlowGraphOptimizer : public FlowGraphVisitor {
18 public: 18 public:
19 explicit FlowGraphOptimizer(FlowGraph* flow_graph) 19 explicit FlowGraphOptimizer(FlowGraph* flow_graph)
20 : FlowGraphVisitor(flow_graph->reverse_postorder()), 20 : FlowGraphVisitor(flow_graph->reverse_postorder()),
21 flow_graph_(flow_graph) { } 21 flow_graph_(flow_graph) { }
22 virtual ~FlowGraphOptimizer() {} 22 virtual ~FlowGraphOptimizer() {}
23 23
24 FlowGraph* flow_graph() const { return flow_graph_; } 24 FlowGraph* flow_graph() const { return flow_graph_; }
25 25
26 // Add ICData to InstanceCalls, so that optimizations can be run on them.
27 // TODO(srdjan): StaticCals as well?
28 void PopulateWithICData();
29
26 // Use ICData to optimize, replace or eliminate instructions. 30 // Use ICData to optimize, replace or eliminate instructions.
27 void ApplyICData(); 31 void ApplyICData();
28 32
29 // Use propagated class ids to optimize, replace or eliminate instructions. 33 // Use propagated class ids to optimize, replace or eliminate instructions.
30 void ApplyClassIds(); 34 void ApplyClassIds();
31 35
32 // Optimize (a << b) & c pattern: if c is a positive Smi or zero, then the 36 // Optimize (a << b) & c pattern: if c is a positive Smi or zero, then the
33 // shift can be a truncating Smi shift-left and result is always Smi. 37 // shift can be a truncating Smi shift-left and result is always Smi.
34 // Merge instructions (only per basic-block). 38 // Merge instructions (only per basic-block).
35 void TryOptimizePatterns(); 39 void TryOptimizePatterns();
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 254
251 void AppendLoadIndexedForMerged(Definition* instr, intptr_t ix, intptr_t cid); 255 void AppendLoadIndexedForMerged(Definition* instr, intptr_t ix, intptr_t cid);
252 void AppendExtractNthOutputForMerged(Definition* instr, intptr_t ix, 256 void AppendExtractNthOutputForMerged(Definition* instr, intptr_t ix,
253 Representation rep, intptr_t cid); 257 Representation rep, intptr_t cid);
254 bool TryStringLengthOneEquality(InstanceCallInstr* call, Token::Kind op_kind); 258 bool TryStringLengthOneEquality(InstanceCallInstr* call, Token::Kind op_kind);
255 259
256 Thread* thread() const { return flow_graph_->thread(); } 260 Thread* thread() const { return flow_graph_->thread(); }
257 Isolate* isolate() const { return flow_graph_->isolate(); } 261 Isolate* isolate() const { return flow_graph_->isolate(); }
258 Zone* zone() const { return flow_graph_->zone(); } 262 Zone* zone() const { return flow_graph_->zone(); }
259 263
264 const Function& function() const { return flow_graph_->function(); }
265
260 FlowGraph* flow_graph_; 266 FlowGraph* flow_graph_;
261 267
262 DISALLOW_COPY_AND_ASSIGN(FlowGraphOptimizer); 268 DISALLOW_COPY_AND_ASSIGN(FlowGraphOptimizer);
263 }; 269 };
264 270
265 271
266 // Loop invariant code motion. 272 // Loop invariant code motion.
267 class LICM : public ValueObject { 273 class LICM : public ValueObject {
268 public: 274 public:
269 explicit LICM(FlowGraph* flow_graph); 275 explicit LICM(FlowGraph* flow_graph);
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 // Optimize spill stores inside try-blocks by identifying values that always 433 // Optimize spill stores inside try-blocks by identifying values that always
428 // contain a single known constant at catch block entry. 434 // contain a single known constant at catch block entry.
429 class TryCatchAnalyzer : public AllStatic { 435 class TryCatchAnalyzer : public AllStatic {
430 public: 436 public:
431 static void Optimize(FlowGraph* flow_graph); 437 static void Optimize(FlowGraph* flow_graph);
432 }; 438 };
433 439
434 } // namespace dart 440 } // namespace dart
435 441
436 #endif // VM_FLOW_GRAPH_OPTIMIZER_H_ 442 #endif // VM_FLOW_GRAPH_OPTIMIZER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698