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

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

Issue 2903993002: Remember deopt-id -> context-level mappings in var descriptors. (Closed)
Patch Set: . Created 3 years, 6 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) 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 RUNTIME_VM_FLOW_GRAPH_BUILDER_H_ 5 #ifndef RUNTIME_VM_FLOW_GRAPH_BUILDER_H_
6 #define RUNTIME_VM_FLOW_GRAPH_BUILDER_H_ 6 #define RUNTIME_VM_FLOW_GRAPH_BUILDER_H_
7 7
8 #include "platform/assert.h" 8 #include "platform/assert.h"
9 #include "platform/globals.h" 9 #include "platform/globals.h"
10 #include "vm/allocation.h" 10 #include "vm/allocation.h"
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 }; 91 };
92 92
93 93
94 // Build a flow graph from a parsed function's AST. 94 // Build a flow graph from a parsed function's AST.
95 class FlowGraphBuilder : public ValueObject { 95 class FlowGraphBuilder : public ValueObject {
96 public: 96 public:
97 // The inlining context is NULL if not inlining. The osr_id is the deopt 97 // The inlining context is NULL if not inlining. The osr_id is the deopt
98 // id of the OSR entry or Compiler::kNoOSRDeoptId if not compiling for OSR. 98 // id of the OSR entry or Compiler::kNoOSRDeoptId if not compiling for OSR.
99 FlowGraphBuilder(const ParsedFunction& parsed_function, 99 FlowGraphBuilder(const ParsedFunction& parsed_function,
100 const ZoneGrowableArray<const ICData*>& ic_data_array, 100 const ZoneGrowableArray<const ICData*>& ic_data_array,
101 ZoneGrowableArray<intptr_t>* context_level_array,
101 InlineExitCollector* exit_collector, 102 InlineExitCollector* exit_collector,
102 intptr_t osr_id); 103 intptr_t osr_id);
103 104
104 FlowGraph* BuildGraph(); 105 FlowGraph* BuildGraph();
105 106
106 const ParsedFunction& parsed_function() const { return parsed_function_; } 107 const ParsedFunction& parsed_function() const { return parsed_function_; }
107 const Function& function() const { return parsed_function_.function(); } 108 const Function& function() const { return parsed_function_.function(); }
108 const ZoneGrowableArray<const ICData*>& ic_data_array() const { 109 const ZoneGrowableArray<const ICData*>& ic_data_array() const {
109 return ic_data_array_; 110 return ic_data_array_;
110 } 111 }
111 112
112 void Bailout(const char* reason) const; 113 void Bailout(const char* reason) const;
113 114
114 intptr_t AllocateBlockId() { return ++last_used_block_id_; } 115 intptr_t AllocateBlockId() { return ++last_used_block_id_; }
115 void SetInitialBlockId(intptr_t id) { last_used_block_id_ = id; } 116 void SetInitialBlockId(intptr_t id) { last_used_block_id_ = id; }
116 117
117 intptr_t GetNextDeoptId() { 118 intptr_t GetNextDeoptId() const;
118 // TODO(rmacnak): Record current scope / context level.
119 return thread()->GetNextDeoptId();
120 }
121 119
122 intptr_t context_level() const; 120 intptr_t context_level() const;
123 121
124 void IncrementLoopDepth() { ++loop_depth_; } 122 void IncrementLoopDepth() { ++loop_depth_; }
125 void DecrementLoopDepth() { --loop_depth_; } 123 void DecrementLoopDepth() { --loop_depth_; }
126 intptr_t loop_depth() const { return loop_depth_; } 124 intptr_t loop_depth() const { return loop_depth_; }
127 125
128 // Manage the currently active try index. 126 // Manage the currently active try index.
129 void set_try_index(intptr_t value) { try_index_ = value; } 127 void set_try_index(intptr_t value) { try_index_ = value; }
130 intptr_t try_index() const { return try_index_; } 128 intptr_t try_index() const { return try_index_; }
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 189
192 intptr_t parameter_count() const { 190 intptr_t parameter_count() const {
193 return num_copied_params_ + num_non_copied_params_; 191 return num_copied_params_ + num_non_copied_params_;
194 } 192 }
195 intptr_t variable_count() const { 193 intptr_t variable_count() const {
196 return parameter_count() + num_stack_locals_; 194 return parameter_count() + num_stack_locals_;
197 } 195 }
198 196
199 const ParsedFunction& parsed_function_; 197 const ParsedFunction& parsed_function_;
200 const ZoneGrowableArray<const ICData*>& ic_data_array_; 198 const ZoneGrowableArray<const ICData*>& ic_data_array_;
199 ZoneGrowableArray<intptr_t>* context_level_array_;
Vyacheslav Egorov (Google) 2017/05/31 14:29:51 it might be worth adding a comment here that this
rmacnak 2017/05/31 18:03:17 Added.
201 200
202 const intptr_t num_copied_params_; 201 const intptr_t num_copied_params_;
203 const intptr_t num_non_copied_params_; 202 const intptr_t num_non_copied_params_;
204 const intptr_t num_stack_locals_; // Does not include any parameters. 203 const intptr_t num_stack_locals_; // Does not include any parameters.
205 InlineExitCollector* const exit_collector_; 204 InlineExitCollector* const exit_collector_;
206 205
207 intptr_t last_used_block_id_; 206 intptr_t last_used_block_id_;
208 intptr_t try_index_; 207 intptr_t try_index_;
209 intptr_t catch_try_index_; 208 intptr_t catch_try_index_;
210 intptr_t loop_depth_; 209 intptr_t loop_depth_;
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after
571 // Output parameters. 570 // Output parameters.
572 GrowableArray<TargetEntryInstr**> true_successor_addresses_; 571 GrowableArray<TargetEntryInstr**> true_successor_addresses_;
573 GrowableArray<TargetEntryInstr**> false_successor_addresses_; 572 GrowableArray<TargetEntryInstr**> false_successor_addresses_;
574 573
575 TokenPosition condition_token_pos_; 574 TokenPosition condition_token_pos_;
576 }; 575 };
577 576
578 } // namespace dart 577 } // namespace dart
579 578
580 #endif // RUNTIME_VM_FLOW_GRAPH_BUILDER_H_ 579 #endif // RUNTIME_VM_FLOW_GRAPH_BUILDER_H_
OLDNEW
« no previous file with comments | « runtime/vm/flag_list.h ('k') | runtime/vm/flow_graph_builder.cc » ('j') | runtime/vm/scopes.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698