| 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_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 |
| 11 | 11 |
| 12 #include "vm/assembler.h" | 12 #include "vm/assembler.h" |
| 13 #include "vm/ast.h" | 13 #include "vm/ast.h" |
| 14 #include "vm/growable_array.h" | 14 #include "vm/growable_array.h" |
| 15 #include "vm/parser.h" | 15 #include "vm/parser.h" |
| 16 | 16 |
| 17 namespace dart { | 17 namespace dart { |
| 18 | 18 |
| 19 // Forward declarations. | 19 // Forward declarations. |
| 20 class Assembler; | 20 class Assembler; |
| 21 class AstNode; | 21 class AstNode; |
| 22 class CodeGenerator; | 22 class CodeGenerator; |
| 23 class DescriptorList; | 23 class DescriptorList; |
| 24 class ExceptionHandlerList; |
| 24 class SourceLabel; | 25 class SourceLabel; |
| 25 class StackmapBuilder; | 26 class StackmapBuilder; |
| 26 | 27 |
| 27 | 28 |
| 28 class CodeGeneratorState : public StackResource { | 29 class CodeGeneratorState : public StackResource { |
| 29 public: | 30 public: |
| 30 explicit CodeGeneratorState(CodeGenerator* codegen); | 31 explicit CodeGeneratorState(CodeGenerator* codegen); |
| 31 virtual ~CodeGeneratorState(); | 32 virtual ~CodeGeneratorState(); |
| 32 | 33 |
| 33 CodeGeneratorState* parent() const { return parent_; } | 34 CodeGeneratorState* parent() const { return parent_; } |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 void GenerateReturnEpilog(ReturnNode* node); | 113 void GenerateReturnEpilog(ReturnNode* node); |
| 113 | 114 |
| 114 // Return true if the VM may optimize functions. | 115 // Return true if the VM may optimize functions. |
| 115 static bool CanOptimize(); | 116 static bool CanOptimize(); |
| 116 | 117 |
| 117 private: | 118 private: |
| 118 // TODO(srdjan): Remove the friendship once the two compilers are properly | 119 // TODO(srdjan): Remove the friendship once the two compilers are properly |
| 119 // structured. | 120 // structured. |
| 120 friend class OptimizingCodeGenerator; | 121 friend class OptimizingCodeGenerator; |
| 121 | 122 |
| 122 // Forward declarations. | |
| 123 class HandlerList; | |
| 124 | |
| 125 // Return true if intrinsification was completed and no other code | 123 // Return true if intrinsification was completed and no other code |
| 126 // needs to be generated. | 124 // needs to be generated. |
| 127 virtual bool TryIntrinsify() { return false; } | 125 virtual bool TryIntrinsify() { return false; } |
| 128 virtual void GeneratePreEntryCode(); | 126 virtual void GeneratePreEntryCode(); |
| 129 void GenerateLegacyEntryCode(); | 127 void GenerateLegacyEntryCode(); |
| 130 void GenerateEntryCode(); | 128 void GenerateEntryCode(); |
| 131 void GenerateLoadVariable(Register dst, const LocalVariable& local); | 129 void GenerateLoadVariable(Register dst, const LocalVariable& local); |
| 132 void GeneratePushVariable(const LocalVariable& variable, Register scratch); | 130 void GeneratePushVariable(const LocalVariable& variable, Register scratch); |
| 133 void GenerateStoreVariable(const LocalVariable& local, | 131 void GenerateStoreVariable(const LocalVariable& local, |
| 134 Register src, | 132 Register src, |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 | 207 |
| 210 void set_context_level(intptr_t value) { context_level_ = value; } | 208 void set_context_level(intptr_t value) { context_level_ = value; } |
| 211 intptr_t context_level() const { return context_level_; } | 209 intptr_t context_level() const { return context_level_; } |
| 212 | 210 |
| 213 Assembler* assembler_; | 211 Assembler* assembler_; |
| 214 const ParsedFunction& parsed_function_; | 212 const ParsedFunction& parsed_function_; |
| 215 intptr_t locals_space_size_; | 213 intptr_t locals_space_size_; |
| 216 CodeGeneratorState* state_; | 214 CodeGeneratorState* state_; |
| 217 DescriptorList* pc_descriptors_list_; | 215 DescriptorList* pc_descriptors_list_; |
| 218 StackmapBuilder* stackmap_builder_; | 216 StackmapBuilder* stackmap_builder_; |
| 219 HandlerList* exception_handlers_list_; | 217 ExceptionHandlerList* exception_handlers_list_; |
| 220 int try_index_; | 218 int try_index_; |
| 221 // The runtime context level is only incremented when a new context is | 219 // The runtime context level is only incremented when a new context is |
| 222 // allocated and chained to the list of contexts. | 220 // allocated and chained to the list of contexts. |
| 223 intptr_t context_level_; | 221 intptr_t context_level_; |
| 224 | 222 |
| 225 DISALLOW_IMPLICIT_CONSTRUCTORS(CodeGenerator); | 223 DISALLOW_IMPLICIT_CONSTRUCTORS(CodeGenerator); |
| 226 }; | 224 }; |
| 227 | 225 |
| 228 | 226 |
| 229 } // namespace dart | 227 } // namespace dart |
| 230 | 228 |
| 231 #endif // VM_CODE_GENERATOR_X64_H_ | 229 #endif // VM_CODE_GENERATOR_X64_H_ |
| OLD | NEW |