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 #include <stdint.h> | |
rmcilroy
2017/01/13 09:53:57
Unecessary?
Leszek Swirski
2017/01/13 10:58:10
Necessary, for uintptr_t
| |
9 | |
8 namespace v8 { | 10 namespace v8 { |
9 namespace internal { | 11 namespace internal { |
10 | 12 |
11 // Forward declarations. | 13 // Forward declarations. |
12 class FunctionLiteral; | 14 class FunctionLiteral; |
15 class ObjectLiteral; | |
16 class ArrayLiteral; | |
rmcilroy
2017/01/13 09:53:57
Ditto?
Leszek Swirski
2017/01/13 10:58:10
Removed.
| |
13 class Isolate; | 17 class Isolate; |
14 class Zone; | 18 class Zone; |
15 template <typename T> | 19 template <typename T> |
16 class ThreadedList; | 20 class ThreadedList; |
17 template <typename T> | 21 template <typename T> |
18 class ThreadedListZoneEntry; | 22 class ThreadedListZoneEntry; |
19 template <typename T> | 23 template <typename T> |
20 class ZoneVector; | 24 class ZoneVector; |
21 | 25 |
22 namespace AstNumbering { | 26 namespace AstNumbering { |
23 // Assign type feedback IDs, bailout IDs, and generator yield IDs to an AST node | 27 // Assign type feedback IDs, bailout IDs, and generator yield IDs to an AST node |
24 // tree; perform catch prediction for TryStatements. If |eager_literals| is | 28 // tree; perform catch prediction for TryStatements. If |eager_literals| is |
25 // non-null, adds any eager inner literal functions into it. | 29 // non-null, adds any eager inner literal functions into it. Adds ObjectLiterals |
30 // to |object_literals| and ArrayLiterals to |array_literals|. | |
rmcilroy
2017/01/13 09:53:57
Remove sentence added here?
Leszek Swirski
2017/01/13 10:58:10
Oops, leftovers. Removed.
| |
26 bool Renumber( | 31 bool Renumber( |
27 Isolate* isolate, Zone* zone, FunctionLiteral* function, | 32 uintptr_t stack_limit, Zone* zone, FunctionLiteral* function, |
28 ThreadedList<ThreadedListZoneEntry<FunctionLiteral*>>* eager_literals); | 33 ThreadedList<ThreadedListZoneEntry<FunctionLiteral*>>* eager_literals); |
29 } | 34 } |
30 | 35 |
31 // Some details on yield IDs | 36 // Some details on yield IDs |
32 // ------------------------- | 37 // ------------------------- |
33 // | 38 // |
34 // In order to assist Ignition in generating bytecode for a generator function, | 39 // In order to assist Ignition in generating bytecode for a generator function, |
35 // we assign a unique number (the yield ID) to each Yield node in its AST. We | 40 // we assign a unique number (the yield ID) to each Yield node in its AST. We |
36 // also annotate loops with the number of yields they contain (loop.yield_count) | 41 // also annotate loops with the number of yields they contain (loop.yield_count) |
37 // and the smallest ID of those (loop.first_yield_id), and we annotate the | 42 // and the smallest ID of those (loop.first_yield_id), and we annotate the |
38 // function itself with the number of yields it contains (function.yield_count). | 43 // function itself with the number of yields it contains (function.yield_count). |
39 // | 44 // |
40 // The way in which we choose the IDs is simply by enumerating the Yield nodes. | 45 // The way in which we choose the IDs is simply by enumerating the Yield nodes. |
41 // Ignition relies on the following properties: | 46 // Ignition relies on the following properties: |
42 // - For each loop l and each yield y of l: | 47 // - For each loop l and each yield y of l: |
43 // l.first_yield_id <= y.yield_id < l.first_yield_id + l.yield_count | 48 // l.first_yield_id <= y.yield_id < l.first_yield_id + l.yield_count |
44 // - For the generator function f itself and each yield y of f: | 49 // - For the generator function f itself and each yield y of f: |
45 // 0 <= y.yield_id < f.yield_count | 50 // 0 <= y.yield_id < f.yield_count |
46 | 51 |
47 } // namespace internal | 52 } // namespace internal |
48 } // namespace v8 | 53 } // namespace v8 |
49 | 54 |
50 #endif // V8_AST_AST_NUMBERING_H_ | 55 #endif // V8_AST_AST_NUMBERING_H_ |
OLD | NEW |