OLD | NEW |
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_CODE_DESCRIPTORS_H_ | 5 #ifndef VM_CODE_DESCRIPTORS_H_ |
6 #define VM_CODE_DESCRIPTORS_H_ | 6 #define VM_CODE_DESCRIPTORS_H_ |
7 | 7 |
8 #include "vm/ast.h" | 8 #include "vm/ast.h" |
9 #include "vm/code_generator.h" | 9 #include "vm/code_generator.h" |
10 #include "vm/globals.h" | 10 #include "vm/globals.h" |
11 #include "vm/growable_array.h" | 11 #include "vm/growable_array.h" |
12 #include "vm/object.h" | 12 #include "vm/object.h" |
13 | 13 |
14 namespace dart { | 14 namespace dart { |
15 | 15 |
16 class DescriptorList : public ZoneAllocated { | 16 class DescriptorList : public ZoneAllocated { |
17 public: | 17 public: |
18 explicit DescriptorList(intptr_t initial_capacity) | 18 explicit DescriptorList(intptr_t initial_capacity) |
19 : encoded_data_(initial_capacity), | 19 : encoded_data_(initial_capacity), |
20 prev_pc_offset(0), | 20 prev_pc_offset(0), |
21 prev_deopt_id(0), | 21 prev_deopt_id(0), |
22 prev_token_pos(0) {} | 22 prev_token_pos(0) {} |
23 | 23 |
24 ~DescriptorList() { } | 24 ~DescriptorList() { } |
25 | 25 |
26 void AddDescriptor(RawPcDescriptors::Kind kind, | 26 void AddDescriptor(RawPcDescriptors::Kind kind, |
27 intptr_t pc_offset, | 27 intptr_t pc_offset, |
28 intptr_t deopt_id, | 28 intptr_t deopt_id, |
29 intptr_t token_pos, | 29 TokenPosition token_pos, |
30 intptr_t try_index); | 30 intptr_t try_index); |
31 | 31 |
32 RawPcDescriptors* FinalizePcDescriptors(uword entry_point); | 32 RawPcDescriptors* FinalizePcDescriptors(uword entry_point); |
33 | 33 |
34 private: | 34 private: |
35 GrowableArray<uint8_t> encoded_data_; | 35 GrowableArray<uint8_t> encoded_data_; |
36 | 36 |
37 intptr_t prev_pc_offset; | 37 intptr_t prev_pc_offset; |
38 intptr_t prev_deopt_id; | 38 intptr_t prev_deopt_id; |
39 intptr_t prev_token_pos; | 39 intptr_t prev_token_pos; |
40 | 40 |
41 DISALLOW_COPY_AND_ASSIGN(DescriptorList); | 41 DISALLOW_COPY_AND_ASSIGN(DescriptorList); |
42 }; | 42 }; |
43 | 43 |
44 | 44 |
45 class CodeSourceMapBuilder : public ZoneAllocated { | 45 class CodeSourceMapBuilder : public ZoneAllocated { |
46 public: | 46 public: |
47 explicit CodeSourceMapBuilder(intptr_t initial_capacity = 64) | 47 explicit CodeSourceMapBuilder(intptr_t initial_capacity = 64) |
48 : encoded_data_(initial_capacity), | 48 : encoded_data_(initial_capacity), |
49 prev_pc_offset(0), | 49 prev_pc_offset(0), |
50 prev_token_pos(0) {} | 50 prev_token_pos(0) {} |
51 | 51 |
52 ~CodeSourceMapBuilder() { } | 52 ~CodeSourceMapBuilder() { } |
53 | 53 |
54 void AddEntry(intptr_t pc_offset, intptr_t token_pos); | 54 void AddEntry(intptr_t pc_offset, TokenPosition token_pos); |
55 | 55 |
56 RawCodeSourceMap* Finalize(); | 56 RawCodeSourceMap* Finalize(); |
57 | 57 |
58 private: | 58 private: |
59 GrowableArray<uint8_t> encoded_data_; | 59 GrowableArray<uint8_t> encoded_data_; |
60 | 60 |
61 intptr_t prev_pc_offset; | 61 intptr_t prev_pc_offset; |
62 intptr_t prev_token_pos; | 62 intptr_t prev_token_pos; |
63 | 63 |
64 DISALLOW_COPY_AND_ASSIGN(CodeSourceMapBuilder); | 64 DISALLOW_COPY_AND_ASSIGN(CodeSourceMapBuilder); |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 RawExceptionHandlers* FinalizeExceptionHandlers(uword entry_point) const; | 159 RawExceptionHandlers* FinalizeExceptionHandlers(uword entry_point) const; |
160 | 160 |
161 private: | 161 private: |
162 GrowableArray<struct HandlerDesc> list_; | 162 GrowableArray<struct HandlerDesc> list_; |
163 DISALLOW_COPY_AND_ASSIGN(ExceptionHandlerList); | 163 DISALLOW_COPY_AND_ASSIGN(ExceptionHandlerList); |
164 }; | 164 }; |
165 | 165 |
166 } // namespace dart | 166 } // namespace dart |
167 | 167 |
168 #endif // VM_CODE_DESCRIPTORS_H_ | 168 #endif // VM_CODE_DESCRIPTORS_H_ |
OLD | NEW |