OLD | NEW |
---|---|
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_AST_AST_NUMBERING_H_ | 5 #ifndef V8_AST_AST_NUMBERING_H_ |
6 #define V8_AST_AST_NUMBERING_H_ | 6 #define V8_AST_AST_NUMBERING_H_ |
7 | 7 |
8 namespace v8 { | 8 namespace v8 { |
9 namespace internal { | 9 namespace internal { |
10 | 10 |
11 // Forward declarations. | 11 // Forward declarations. |
12 class FunctionLiteral; | 12 class FunctionLiteral; |
13 class Isolate; | 13 class Isolate; |
14 class Zone; | 14 class Zone; |
15 template <typename T> | |
16 class ZoneVector; | |
15 | 17 |
16 namespace AstNumbering { | 18 namespace AstNumbering { |
17 // Assign type feedback IDs, bailout IDs, and generator yield IDs to an AST node | 19 // Assign type feedback IDs, bailout IDs, and generator yield IDs to an AST node |
18 // tree; perform catch prediction for TryStatements. | 20 // tree; perform catch prediction for TryStatements. Adds any eager inner |
19 bool Renumber(Isolate* isolate, Zone* zone, FunctionLiteral* function); | 21 // literal functions found into |eager_inner_functions|. |
22 bool Renumber(Isolate* isolate, Zone* zone, FunctionLiteral* function, | |
23 ZoneVector<FunctionLiteral*>* eager_inner_functions); | |
marja
2017/01/05 19:25:22
I was thinking about the ZoneVector usage here...
rmcilroy
2017/01/06 17:08:14
Yes good point, I'm not sure we have a good defaul
rmcilroy
2017/01/09 16:50:10
Done.
| |
20 } | 24 } |
21 | 25 |
22 // Some details on yield IDs | 26 // Some details on yield IDs |
23 // ------------------------- | 27 // ------------------------- |
24 // | 28 // |
25 // In order to assist Ignition in generating bytecode for a generator function, | 29 // In order to assist Ignition in generating bytecode for a generator function, |
26 // we assign a unique number (the yield ID) to each Yield node in its AST. We | 30 // we assign a unique number (the yield ID) to each Yield node in its AST. We |
27 // also annotate loops with the number of yields they contain (loop.yield_count) | 31 // also annotate loops with the number of yields they contain (loop.yield_count) |
28 // and the smallest ID of those (loop.first_yield_id), and we annotate the | 32 // and the smallest ID of those (loop.first_yield_id), and we annotate the |
29 // function itself with the number of yields it contains (function.yield_count). | 33 // function itself with the number of yields it contains (function.yield_count). |
30 // | 34 // |
31 // The way in which we choose the IDs is simply by enumerating the Yield nodes. | 35 // The way in which we choose the IDs is simply by enumerating the Yield nodes. |
32 // Ignition relies on the following properties: | 36 // Ignition relies on the following properties: |
33 // - For each loop l and each yield y of l: | 37 // - For each loop l and each yield y of l: |
34 // l.first_yield_id <= y.yield_id < l.first_yield_id + l.yield_count | 38 // l.first_yield_id <= y.yield_id < l.first_yield_id + l.yield_count |
35 // - For the generator function f itself and each yield y of f: | 39 // - For the generator function f itself and each yield y of f: |
36 // 0 <= y.yield_id < f.yield_count | 40 // 0 <= y.yield_id < f.yield_count |
37 | 41 |
38 } // namespace internal | 42 } // namespace internal |
39 } // namespace v8 | 43 } // namespace v8 |
40 | 44 |
41 #endif // V8_AST_AST_NUMBERING_H_ | 45 #endif // V8_AST_AST_NUMBERING_H_ |
OLD | NEW |