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

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

Issue 2853423002: Move the Kernel canonical name table into the VM's heap (Closed)
Patch Set: Merge a bugfix Created 3 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) 2017, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2017, 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 RUNTIME_VM_KERNEL_BINARY_FLOWGRAPH_H_ 5 #ifndef RUNTIME_VM_KERNEL_BINARY_FLOWGRAPH_H_
6 #define RUNTIME_VM_KERNEL_BINARY_FLOWGRAPH_H_ 6 #define RUNTIME_VM_KERNEL_BINARY_FLOWGRAPH_H_
7 7
8 #if !defined(DART_PRECOMPILED_RUNTIME) 8 #if !defined(DART_PRECOMPILED_RUNTIME)
9 9
10 #include <map> 10 #include <map>
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 53
54 54
55 class StreamingFlowGraphBuilder { 55 class StreamingFlowGraphBuilder {
56 public: 56 public:
57 StreamingFlowGraphBuilder(FlowGraphBuilder* flow_graph_builder, 57 StreamingFlowGraphBuilder(FlowGraphBuilder* flow_graph_builder,
58 const uint8_t* buffer, 58 const uint8_t* buffer,
59 intptr_t buffer_length) 59 intptr_t buffer_length)
60 : flow_graph_builder_(flow_graph_builder), 60 : flow_graph_builder_(flow_graph_builder),
61 translation_helper_(flow_graph_builder->translation_helper_), 61 translation_helper_(flow_graph_builder->translation_helper_),
62 zone_(flow_graph_builder->zone_), 62 zone_(flow_graph_builder->zone_),
63 reader_(new kernel::Reader(buffer, buffer_length)), 63 reader_(new Reader(buffer, buffer_length)),
64 constant_evaluator_(this, 64 constant_evaluator_(this,
65 flow_graph_builder->zone_, 65 flow_graph_builder->zone_,
66 &flow_graph_builder->translation_helper_, 66 &flow_graph_builder->translation_helper_,
67 &flow_graph_builder->type_translator_), 67 &flow_graph_builder->type_translator_) {}
68 canonical_names_(NULL),
69 canonical_names_size_(-1),
70 canonical_names_entries_read_(0),
71 canonical_names_next_offset_(-1) {}
72 68
73 virtual ~StreamingFlowGraphBuilder() { 69 virtual ~StreamingFlowGraphBuilder() {}
74 delete reader_;
75 // The canonical names themselves are not (yet) deallocated.
76 delete[] canonical_names_;
77 }
78 70
79 Fragment BuildAt(intptr_t kernel_offset); 71 Fragment BuildAt(intptr_t kernel_offset);
80 72
81 private: 73 private:
82 CanonicalName* GetCanonicalName(intptr_t index);
83
84 intptr_t ReaderOffset(); 74 intptr_t ReaderOffset();
85 void SetOffset(intptr_t offset); 75 void SetOffset(intptr_t offset);
86 void SkipBytes(intptr_t skip); 76 void SkipBytes(intptr_t skip);
87 uint32_t ReadUInt(); 77 uint32_t ReadUInt();
88 intptr_t ReadListLength(); 78 intptr_t ReadListLength();
89 TokenPosition ReadPosition(bool record = true); 79 TokenPosition ReadPosition(bool record = true);
90 Tag ReadTag(uint8_t* payload = NULL); 80 Tag ReadTag(uint8_t* payload = NULL);
91 81
92 CatchBlock* catch_block(); 82 CatchBlock* catch_block();
93 ScopeBuildingResult* scopes(); 83 ScopeBuildingResult* scopes();
(...skipping 20 matching lines...) Expand all
114 Fragment BuildStringLiteral(); 104 Fragment BuildStringLiteral();
115 Fragment BuildIntLiteral(uint8_t payload); 105 Fragment BuildIntLiteral(uint8_t payload);
116 Fragment BuildIntLiteral(bool is_negative); 106 Fragment BuildIntLiteral(bool is_negative);
117 Fragment BuildDoubleLiteral(); 107 Fragment BuildDoubleLiteral();
118 Fragment BuildBoolLiteral(bool value); 108 Fragment BuildBoolLiteral(bool value);
119 Fragment BuildNullLiteral(); 109 Fragment BuildNullLiteral();
120 110
121 FlowGraphBuilder* flow_graph_builder_; 111 FlowGraphBuilder* flow_graph_builder_;
122 TranslationHelper& translation_helper_; 112 TranslationHelper& translation_helper_;
123 Zone* zone_; 113 Zone* zone_;
124 kernel::Reader* reader_; 114 Reader* reader_;
125 StreamingConstantEvaluator constant_evaluator_; 115 StreamingConstantEvaluator constant_evaluator_;
126 116
127 CanonicalName** canonical_names_;
128 intptr_t canonical_names_size_;
129 intptr_t canonical_names_entries_read_;
130 intptr_t canonical_names_next_offset_;
131
132 friend class StreamingConstantEvaluator; 117 friend class StreamingConstantEvaluator;
133 }; 118 };
134 119
135 120
136 } // namespace kernel 121 } // namespace kernel
137 } // namespace dart 122 } // namespace dart
138 123
139 #endif // !defined(DART_PRECOMPILED_RUNTIME) 124 #endif // !defined(DART_PRECOMPILED_RUNTIME)
140 #endif // RUNTIME_VM_KERNEL_BINARY_FLOWGRAPH_H_ 125 #endif // RUNTIME_VM_KERNEL_BINARY_FLOWGRAPH_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698