Chromium Code Reviews| Index: runtime/vm/code_generator_x64.h |
| diff --git a/runtime/vm/code_generator_x64.h b/runtime/vm/code_generator_x64.h |
| index d148f4d39352fceae2d74f88db2948ef63b7cb26..6a3de365d3f29f7289a76fe2c74a6d6027a7f5a5 100644 |
| --- a/runtime/vm/code_generator_x64.h |
| +++ b/runtime/vm/code_generator_x64.h |
| @@ -1,4 +1,4 @@ |
| -// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
| +// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| // for details. All rights reserved. Use of this source code is governed by a |
| // BSD-style license that can be found in the LICENSE file. |
| @@ -83,6 +83,9 @@ class CodeGeneratorState : public StackResource { |
| class CodeGenerator : public AstNodeVisitor { |
| public: |
| + // Forward declarations. |
| + class DescriptorList; |
|
srdjan
2012/02/24 23:13:02
Why the move?
Kevin Millikin (Google)
2012/02/27 08:22:07
Making it public for class FlowGraphCompiler. A f
|
| + |
| CodeGenerator(Assembler* assembler, const ParsedFunction& parsed_function); |
| virtual ~CodeGenerator() { } |
| @@ -133,7 +136,6 @@ NODE_LIST(DEFINE_VISITOR_FUNCTION) |
| friend class OptimizingCodeGenerator; |
| // Forward declarations. |
| - class DescriptorList; |
| class HandlerList; |
| // Return true if intrinsification was completed and no other code |
| @@ -227,6 +229,76 @@ NODE_LIST(DEFINE_VISITOR_FUNCTION) |
| DISALLOW_IMPLICIT_CONSTRUCTORS(CodeGenerator); |
| }; |
| + |
| +class CodeGenerator::DescriptorList : public ZoneAllocated { |
|
srdjan
2012/02/24 23:13:02
Remove since I have moved it into code_generator.h
Kevin Millikin (Google)
2012/02/27 08:22:07
Thanks, done.
|
| + public: |
| + struct PcDesc { |
| + intptr_t pc_offset; // PC offset value of the descriptor. |
| + PcDescriptors::Kind kind; // Descriptor kind (kDeopt, kOther). |
| + intptr_t node_id; // AST node id. |
| + intptr_t token_index; // Token position in source of PC. |
| + intptr_t try_index; // Try block index of PC. |
| + }; |
| + |
| + DescriptorList() : list_() { |
| + } |
| + ~DescriptorList() { } |
| + |
| + intptr_t Length() const { |
| + return list_.length(); |
| + } |
| + |
| + intptr_t PcOffset(int index) const { |
| + return list_[index].pc_offset; |
| + } |
| + PcDescriptors::Kind Kind(int index) const { |
| + return list_[index].kind; |
| + } |
| + intptr_t NodeId(int index) const { |
| + return list_[index].node_id; |
| + } |
| + intptr_t TokenIndex(int index) const { |
| + return list_[index].token_index; |
| + } |
| + intptr_t TryIndex(int index) const { |
| + return list_[index].try_index; |
| + } |
| + |
| + void AddDescriptor(PcDescriptors::Kind kind, |
| + intptr_t pc_offset, |
| + intptr_t node_id, |
| + intptr_t token_index, |
| + intptr_t try_index) { |
| + struct PcDesc data; |
| + data.pc_offset = pc_offset; |
| + data.kind = kind; |
| + data.node_id = node_id; |
| + data.token_index = token_index; |
| + data.try_index = try_index; |
| + list_.Add(data); |
| + } |
| + |
| + RawPcDescriptors* FinalizePcDescriptors(uword entry_point) { |
| + intptr_t num_descriptors = Length(); |
| + const PcDescriptors& descriptors = |
| + PcDescriptors::Handle(PcDescriptors::New(num_descriptors)); |
| + for (intptr_t i = 0; i < num_descriptors; i++) { |
| + descriptors.AddDescriptor(i, |
| + (entry_point + PcOffset(i)), |
| + Kind(i), |
| + NodeId(i), |
| + TokenIndex(i), |
| + TryIndex(i)); |
| + } |
| + return descriptors.raw(); |
| + } |
| + |
| + private: |
| + GrowableArray<struct PcDesc> list_; |
| + DISALLOW_COPY_AND_ASSIGN(DescriptorList); |
| +}; |
| + |
| + |
| } // namespace dart |
| #endif // VM_CODE_GENERATOR_X64_H_ |