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

Side by Side Diff: src/compiler/osr.h

Issue 816053002: [turbofan] First version of loop peeling. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 11 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/opcodes.h ('k') | src/compiler/pipeline.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 #ifndef V8_COMPILER_OSR_H_ 5 #ifndef V8_COMPILER_OSR_H_
6 #define V8_COMPILER_OSR_H_ 6 #define V8_COMPILER_OSR_H_
7 7
8 #include "src/zone.h" 8 #include "src/zone.h"
9 9
10 // TurboFan structures OSR graphs in a way that separates almost all phases of 10 // TurboFan structures OSR graphs in a way that separates almost all phases of
11 // compilation from OSR implementation details. This is accomplished with 11 // compilation from OSR implementation details. This is accomplished with
12 // special 12 // special control nodes that are added at graph building time. In particular,
13 // control nodes that are added at graph building time. In particular, the graph 13 // the graph is built in such a way that typing still computes the best types
14 // is built in such a way that typing still computes the best types and 14 // and optimizations and lowering work unchanged. All that remains is to
15 // optimizations and lowering work unchanged. All that remains is to deconstruct 15 // deconstruct the OSR artifacts before scheduling and code generation.
16 // the OSR artifacts before scheduling. The helper class below performs the
17 // necessary graph rewriting.
18 16
19 // Graphs built for OSR from the AstGraphBuilder are structured as follows: 17 // Graphs built for OSR from the AstGraphBuilder are structured as follows:
20 // Start 18 // Start
21 // +-------------------^^-----+ 19 // +-------------------^^-----+
22 // | | 20 // | |
23 // OsrNormalEntry OsrLoopEntry <-------------+ 21 // OsrNormalEntry OsrLoopEntry <-------------+
24 // | | | 22 // | | |
25 // control flow before loop | A OsrValue 23 // control flow before loop | A OsrValue
26 // | | | | 24 // | | | |
27 // | +------------------------+ | +-------+ 25 // | +------------------------+ | +-------+
28 // | | +-------------+ | | +--------+ 26 // | | +-------------+ | | +--------+
29 // | | | | | | | | 27 // | | | | | | | |
30 // ( Loop )<-----------|------------------ ( phi ) | 28 // ( Loop )<-----------|------------------ ( phi ) |
31 // | | | 29 // | | |
32 // loop body | backedge(s) | 30 // loop body | backedge(s) |
33 // | | | | 31 // | | | |
34 // | +--------------+ B <-----+ 32 // | +--------------+ B <-----+
35 // | 33 // |
36 // end 34 // end
37 35
38 // The control structure expresses the relationship that the loop has a separate 36 // The control structure expresses the relationship that the loop has a separate
39 // entrypoint which corresponds to entering the loop directly from start. 37 // entrypoint which corresponds to entering the loop directly from the middle
38 // of unoptimized code.
40 // Similarly, the values that come in from unoptimized code are represented with 39 // Similarly, the values that come in from unoptimized code are represented with
41 // {OsrValue} nodes that merge into any phis associated with the OSR loop. 40 // {OsrValue} nodes that merge into any phis associated with the OSR loop.
42 // The nodes {A} and {B} represent values in the "normal" graph that correspond 41 // In the above diagram, nodes {A} and {B} represent values in the "normal"
43 // to the values of those phis before the loop and on any backedges, 42 // graph that correspond to the values of those phis before the loop and on any
44 // respectively. 43 // backedges, respectively.
45 44
46 // To deconstruct OSR, we simply replace the uses of the {OsrNormalEntry} 45 // To deconstruct OSR, we simply replace the uses of the {OsrNormalEntry}
47 // control 46 // control node with {Dead} and {OsrLoopEntry} with start and run the
48 // node with {Dead} and {OsrLoopEntry} with start and run the {ControlReducer}. 47 // {ControlReducer}. Control reduction propagates the dead control forward,
49 // Control reduction propagates the dead control forward, essentially "killing" 48 // essentially "killing" all the code before the OSR loop. The entrypoint to the
50 // all the code before the OSR loop. The entrypoint to the loop corresponding 49 // loop corresponding to the "normal" entry path will also be removed, as well
51 // to the "normal" entry path will also be removed, as well as the inputs to 50 // as the inputs to the loop phis, resulting in the reduced graph:
52 // the loop phis, resulting in the reduced graph:
53 51
54 // Start 52 // Start
55 // Dead |^-------------------------+ 53 // Dead |^-------------------------+
56 // | | | 54 // | | |
57 // | | | 55 // | | |
58 // | | | 56 // | | |
59 // disconnected, dead | A=dead OsrValue 57 // disconnected, dead | A=dead OsrValue
60 // | | 58 // | |
61 // +------------------+ +------+ 59 // +------------------+ +------+
62 // | +-------------+ | +--------+ 60 // | +-------------+ | +--------+
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 private: 117 private:
120 size_t parameter_count_; 118 size_t parameter_count_;
121 size_t stack_slot_count_; 119 size_t stack_slot_count_;
122 }; 120 };
123 121
124 } // namespace compiler 122 } // namespace compiler
125 } // namespace internal 123 } // namespace internal
126 } // namespace v8 124 } // namespace v8
127 125
128 #endif // V8_COMPILER_OSR_H_ 126 #endif // V8_COMPILER_OSR_H_
OLDNEW
« no previous file with comments | « src/compiler/opcodes.h ('k') | src/compiler/pipeline.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698