| Index: runtime/vm/code_generator_ia32.h
|
| ===================================================================
|
| --- runtime/vm/code_generator_ia32.h (revision 1822)
|
| +++ runtime/vm/code_generator_ia32.h (working copy)
|
| @@ -19,9 +19,68 @@
|
| // Forward Declarations.
|
| class Assembler;
|
| class AstNode;
|
| -class CodeGeneratorState;
|
| +class CodeGenerator;
|
| class SourceLabel;
|
|
|
| +
|
| +class CodeGeneratorState : public StackResource {
|
| + public:
|
| + explicit CodeGeneratorState(CodeGenerator* codegen);
|
| + virtual ~CodeGeneratorState();
|
| +
|
| + CodeGeneratorState* parent() const { return parent_; }
|
| +
|
| + AstNode* root_node() const { return root_node_; }
|
| + void set_root_node(AstNode* value) { root_node_ = value; }
|
| + bool IsRootNode(AstNode* node) const {
|
| + return root_node_ == node;
|
| + }
|
| +
|
| + int loop_level() const { return loop_level_; }
|
| + void set_loop_level(int loop_level) {
|
| + loop_level_ = loop_level;
|
| + }
|
| +
|
| + int context_level() const { return context_level_; }
|
| + void set_context_level(int context_level) {
|
| + context_level_ = context_level;
|
| + }
|
| +
|
| + int try_index() const { return current_try_index_; }
|
| + void set_try_index(int value) {
|
| + current_try_index_ = value;
|
| + }
|
| +
|
| + private:
|
| + CodeGenerator* codegen_;
|
| + CodeGeneratorState* parent_;
|
| + AstNode* root_node_;
|
| +
|
| + // The loop level reflects the lexical nesting of loop statements, regardless
|
| + // of the presence of captured variables.
|
| + int loop_level_;
|
| +
|
| + // The runtime context level is only incremented when a new context is
|
| + // allocated and chained to the list of contexts. This occurs when the scopes
|
| + // at the current loop level contain captured variables.
|
| + int context_level_;
|
| +
|
| + // We identify each try block in this function with an unique 'try index'
|
| + // value.
|
| + // The 'try index' is used to match the try blocks with the corresponding
|
| + // catch block (if one exists). The PC descriptors generated for
|
| + // statements in the try block use this index so that it can be matched
|
| + // to the appropriate catch block.
|
| + // The 'try index' value is generated by incrementing the try_index_
|
| + // variable in the CodeGenerator object.
|
| + // We store the 'try index' of the block of code that we are
|
| + // currently generating code for in the current_try_index_ variable.
|
| + int current_try_index_;
|
| +
|
| + DISALLOW_IMPLICIT_CONSTRUCTORS(CodeGeneratorState);
|
| +};
|
| +
|
| +
|
| class CodeGenerator : public AstNodeVisitor {
|
| public:
|
| CodeGenerator(Assembler* assembler, const ParsedFunction& parsed_function);
|
| @@ -63,6 +122,8 @@
|
|
|
| virtual void CountBackwardLoop();
|
|
|
| + void GenerateReturnEpilog();
|
| +
|
| private:
|
| // TODO(srdjan): Remove the friendship once the two compilers are properly
|
| // structured.
|
|
|