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

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

Issue 9706086: Clean-up CodeGenState: remove unused loop_level and move context_level to CodeGenerator (and add it… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 9 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 | Annotate | Revision Log
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 VM_CODE_GENERATOR_X64_H_ 5 #ifndef VM_CODE_GENERATOR_X64_H_
6 #define VM_CODE_GENERATOR_X64_H_ 6 #define VM_CODE_GENERATOR_X64_H_
7 7
8 #ifndef VM_CODE_GENERATOR_H_ 8 #ifndef VM_CODE_GENERATOR_H_
9 #error Do not include code_generator_x64.h directly; use code_generator.h. 9 #error Do not include code_generator_x64.h directly; use code_generator.h.
10 #endif 10 #endif
(...skipping 18 matching lines...) Expand all
29 virtual ~CodeGeneratorState(); 29 virtual ~CodeGeneratorState();
30 30
31 CodeGeneratorState* parent() const { return parent_; } 31 CodeGeneratorState* parent() const { return parent_; }
32 32
33 AstNode* root_node() const { return root_node_; } 33 AstNode* root_node() const { return root_node_; }
34 void set_root_node(AstNode* value) { root_node_ = value; } 34 void set_root_node(AstNode* value) { root_node_ = value; }
35 bool IsRootNode(AstNode* node) const { 35 bool IsRootNode(AstNode* node) const {
36 return root_node_ == node; 36 return root_node_ == node;
37 } 37 }
38 38
39 int loop_level() const { return loop_level_; }
40 void set_loop_level(int loop_level) {
41 loop_level_ = loop_level;
42 }
43
44 int context_level() const { return context_level_; }
45 void set_context_level(int context_level) {
46 context_level_ = context_level;
47 }
48
49 int try_index() const { return current_try_index_; } 39 int try_index() const { return current_try_index_; }
50 void set_try_index(int value) { 40 void set_try_index(int value) {
51 current_try_index_ = value; 41 current_try_index_ = value;
52 } 42 }
53 43
54 private: 44 private:
55 CodeGenerator* codegen_; 45 CodeGenerator* codegen_;
56 CodeGeneratorState* parent_; 46 CodeGeneratorState* parent_;
57 AstNode* root_node_; 47 AstNode* root_node_;
58 48
59 // The loop level reflects the lexical nesting of loop statements, regardless
60 // of the presence of captured variables.
61 int loop_level_;
62
63 // The runtime context level is only incremented when a new context is
64 // allocated and chained to the list of contexts. This occurs when the scopes
65 // at the current loop level contain captured variables.
66 int context_level_;
67
68 // We identify each try block in this function with an unique 'try index' 49 // We identify each try block in this function with an unique 'try index'
69 // value. 50 // value.
70 // The 'try index' is used to match the try blocks with the corresponding 51 // The 'try index' is used to match the try blocks with the corresponding
71 // catch block (if one exists). The PC descriptors generated for 52 // catch block (if one exists). The PC descriptors generated for
72 // statements in the try block use this index so that it can be matched 53 // statements in the try block use this index so that it can be matched
73 // to the appropriate catch block. 54 // to the appropriate catch block.
74 // The 'try index' value is generated by incrementing the try_index_ 55 // The 'try index' value is generated by incrementing the try_index_
75 // variable in the CodeGenerator object. 56 // variable in the CodeGenerator object.
76 // We store the 'try index' of the block of code that we are 57 // We store the 'try index' of the block of code that we are
77 // currently generating code for in the current_try_index_ variable. 58 // currently generating code for in the current_try_index_ variable.
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 void ErrorMsg(intptr_t token_index, const char* format, ...); 198 void ErrorMsg(intptr_t token_index, const char* format, ...);
218 199
219 int generate_next_try_index() { return try_index_ += 1; } 200 int generate_next_try_index() { return try_index_ += 1; }
220 201
221 void MarkDeoptPoint(intptr_t node_id, intptr_t token_index); 202 void MarkDeoptPoint(intptr_t node_id, intptr_t token_index);
222 void AddCurrentDescriptor(PcDescriptors::Kind kind, 203 void AddCurrentDescriptor(PcDescriptors::Kind kind,
223 intptr_t node_id, 204 intptr_t node_id,
224 intptr_t token_index); 205 intptr_t token_index);
225 void CopyParameters(); 206 void CopyParameters();
226 207
208 void set_context_level(intptr_t value) { context_level_ = value; }
209 intptr_t context_level() const { return context_level_; }
210
227 Assembler* assembler_; 211 Assembler* assembler_;
228 const ParsedFunction& parsed_function_; 212 const ParsedFunction& parsed_function_;
229 intptr_t locals_space_size_; 213 intptr_t locals_space_size_;
230 CodeGeneratorState* state_; 214 CodeGeneratorState* state_;
231 DescriptorList* pc_descriptors_list_; 215 DescriptorList* pc_descriptors_list_;
232 HandlerList* exception_handlers_list_; 216 HandlerList* exception_handlers_list_;
233 int try_index_; 217 int try_index_;
218 // The runtime context level is only incremented when a new context is
219 // allocated and chained to the list of contexts.
220 intptr_t context_level_;
234 221
235 DISALLOW_IMPLICIT_CONSTRUCTORS(CodeGenerator); 222 DISALLOW_IMPLICIT_CONSTRUCTORS(CodeGenerator);
236 }; 223 };
237 224
238 225
239 } // namespace dart 226 } // namespace dart
240 227
241 #endif // VM_CODE_GENERATOR_X64_H_ 228 #endif // VM_CODE_GENERATOR_X64_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698