Chromium Code Reviews| 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_DESCRIPTORS_H_ | 5 #ifndef VM_CODE_DESCRIPTORS_H_ |
| 6 #define VM_CODE_DESCRIPTORS_H_ | 6 #define VM_CODE_DESCRIPTORS_H_ |
| 7 | 7 |
| 8 #include "vm/globals.h" | 8 #include "vm/globals.h" |
| 9 #include "vm/growable_array.h" | 9 #include "vm/growable_array.h" |
| 10 #include "vm/object.h" | 10 #include "vm/object.h" |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 52 intptr_t try_index); | 52 intptr_t try_index); |
| 53 | 53 |
| 54 RawPcDescriptors* FinalizePcDescriptors(uword entry_point); | 54 RawPcDescriptors* FinalizePcDescriptors(uword entry_point); |
| 55 | 55 |
| 56 private: | 56 private: |
| 57 GrowableArray<struct PcDesc> list_; | 57 GrowableArray<struct PcDesc> list_; |
| 58 DISALLOW_COPY_AND_ASSIGN(DescriptorList); | 58 DISALLOW_COPY_AND_ASSIGN(DescriptorList); |
| 59 }; | 59 }; |
| 60 | 60 |
| 61 | 61 |
| 62 class StackmapBuilder : public ZoneAllocated { | 62 class StackmapTableBuilder : public ZoneAllocated { |
| 63 public: | 63 public: |
| 64 StackmapBuilder() : | 64 StackmapTableBuilder() : |
| 65 builder_(new BitmapBuilder()), | |
| 66 stack_map_(Stackmap::ZoneHandle()), | 65 stack_map_(Stackmap::ZoneHandle()), |
| 67 list_(GrowableObjectArray::ZoneHandle( | 66 list_(GrowableObjectArray::ZoneHandle( |
| 68 GrowableObjectArray::New(Heap::kOld))) { } | 67 GrowableObjectArray::New(Heap::kOld))) { } |
| 69 ~StackmapBuilder() { } | 68 ~StackmapTableBuilder() { } |
| 70 | 69 |
| 71 // Gets state of stack slot (object or regular value). | 70 void AddEntry(intptr_t pc_offset, BitmapBuilder* bitmap); |
| 72 bool IsSlotObject(intptr_t stack_slot) const { | |
| 73 ASSERT(builder_ != NULL); | |
| 74 return builder_->Get(stack_slot); | |
| 75 } | |
| 76 // Sets stack slot as containing an object. | |
| 77 void SetSlotAsObject(intptr_t stack_slot) { | |
| 78 ASSERT(builder_ != NULL); | |
| 79 builder_->Set(stack_slot, true); | |
| 80 } | |
| 81 // Sets stack slot as containing regular value. | |
| 82 void SetSlotAsValue(intptr_t stack_slot) { | |
| 83 ASSERT(builder_ != NULL); | |
| 84 builder_->Set(stack_slot, false); | |
| 85 } | |
| 86 // Sets min..max (inclusive) as stack slots containing objects. | |
| 87 void SetSlotRangeAsObject(intptr_t min_stack_slot, intptr_t max_stack_slot) { | |
| 88 ASSERT(builder_ != NULL); | |
| 89 builder_->SetRange(min_stack_slot, max_stack_slot, true); | |
| 90 } | |
| 91 // Sets min..max (inclusive) as stack slots containing regular values. | |
| 92 void SetSlotRangeAsValue(intptr_t min_stack_slot, intptr_t max_stack_slot) { | |
| 93 ASSERT(builder_ != NULL); | |
| 94 builder_->SetRange(min_stack_slot, max_stack_slot, false); | |
| 95 } | |
| 96 | |
| 97 void AddEntry(intptr_t pc_offset); | |
| 98 | 71 |
|
siva
2012/07/31 19:03:01
I would retain a StackmapBuilder class which has a
Kevin Millikin (Google)
2012/08/01 09:34:33
Thanks for the comment.
I agree with the naming i
| |
| 99 bool Verify(); | 72 bool Verify(); |
| 100 | 73 |
| 101 RawArray* FinalizeStackmaps(const Code& code); | 74 RawArray* FinalizeStackmaps(const Code& code); |
| 102 | 75 |
| 103 private: | 76 private: |
| 104 intptr_t Length() const { return list_.Length(); } | 77 intptr_t Length() const { return list_.Length(); } |
| 105 RawStackmap* Map(int index) const; | 78 RawStackmap* Map(int index) const; |
| 106 | 79 |
| 107 BitmapBuilder* builder_; | |
| 108 Stackmap& stack_map_; | 80 Stackmap& stack_map_; |
| 109 GrowableObjectArray& list_; | 81 GrowableObjectArray& list_; |
| 110 DISALLOW_COPY_AND_ASSIGN(StackmapBuilder); | 82 DISALLOW_COPY_AND_ASSIGN(StackmapTableBuilder); |
| 111 }; | 83 }; |
| 112 | 84 |
| 113 | 85 |
| 114 class ExceptionHandlerList : public ZoneAllocated { | 86 class ExceptionHandlerList : public ZoneAllocated { |
| 115 public: | 87 public: |
| 116 struct HandlerDesc { | 88 struct HandlerDesc { |
| 117 intptr_t try_index; // Try block index handled by the handler. | 89 intptr_t try_index; // Try block index handled by the handler. |
| 118 intptr_t pc_offset; // Handler PC offset value. | 90 intptr_t pc_offset; // Handler PC offset value. |
| 119 }; | 91 }; |
| 120 | 92 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 152 } | 124 } |
| 153 | 125 |
| 154 private: | 126 private: |
| 155 GrowableArray<struct HandlerDesc> list_; | 127 GrowableArray<struct HandlerDesc> list_; |
| 156 DISALLOW_COPY_AND_ASSIGN(ExceptionHandlerList); | 128 DISALLOW_COPY_AND_ASSIGN(ExceptionHandlerList); |
| 157 }; | 129 }; |
| 158 | 130 |
| 159 } // namespace dart | 131 } // namespace dart |
| 160 | 132 |
| 161 #endif // VM_CODE_DESCRIPTORS_H_ | 133 #endif // VM_CODE_DESCRIPTORS_H_ |
| OLD | NEW |