Chromium Code Reviews| Index: runtime/vm/object.h |
| =================================================================== |
| --- runtime/vm/object.h (revision 37664) |
| +++ runtime/vm/object.h (working copy) |
| @@ -2974,19 +2974,6 @@ |
| class PcDescriptors : public Object { |
| - private: |
| - // Describes the layout of PC descriptor data. |
| - enum { |
| - kPcEntry = 0, // PC value of the descriptor, unique. |
| - kKindEntry = 1, |
| - kDeoptIdEntry = 2, // Deopt id. |
| - kTokenPosEntry = 3, // Token position in source. |
| - kTryIndexEntry = 4, // Try block index. |
| - // We would potentially be adding other objects here like |
| - // pointer maps for optimized functions, local variables information etc. |
| - kNumberOfEntries = 5, |
| - }; |
| - |
| public: |
| enum Kind { |
| kDeopt, // Deoptimization continuation point. |
| @@ -3001,12 +2988,27 @@ |
| intptr_t Length() const; |
| - uword PC(intptr_t index) const; |
| - PcDescriptors::Kind DescriptorKind(intptr_t index) const; |
| + uword PC(intptr_t index) const { |
| + ASSERT(index < Length()); |
| + return raw_ptr()->data()[index].pc; |
| + } |
| + PcDescriptors::Kind DescriptorKind(intptr_t index) const { |
| + ASSERT(index < Length()); |
| + return static_cast<PcDescriptors::Kind>(raw_ptr()->data()[index].kind); |
| + } |
| + intptr_t DeoptId(intptr_t index) const { |
| + ASSERT(index < Length()); |
| + return raw_ptr()->data()[index].deopt_id; |
| + } |
| + intptr_t TokenPos(intptr_t index) const { |
| + ASSERT(index < Length()); |
| + return raw_ptr()->data()[index].token_pos; |
| + } |
| + intptr_t TryIndex(intptr_t index) const { |
| + ASSERT(index < Length()); |
| + return raw_ptr()->data()[index].try_index; |
| + } |
| const char* KindAsStr(intptr_t index) const; |
| - intptr_t DeoptId(intptr_t index) const; |
| - intptr_t TokenPos(intptr_t index) const; |
| - intptr_t TryIndex(intptr_t index) const; |
| void AddDescriptor(intptr_t index, |
| uword pc, |
| @@ -3014,14 +3016,17 @@ |
| intptr_t deopt_id, |
| intptr_t token_pos, // Or deopt reason. |
| intptr_t try_index) const { // Or deopt index. |
| - SetPC(index, pc); |
| - SetKind(index, kind); |
| - SetDeoptId(index, deopt_id); |
| - SetTokenPos(index, token_pos); |
| - SetTryIndex(index, try_index); |
| + RawPcDescriptors::PcDescriptorRec* rec = &raw_ptr()->data()[index]; |
| + rec->pc = pc; |
| + rec->kind = kind; |
| + rec->deopt_id = deopt_id; |
|
zra
2014/06/24 23:25:49
Assert that deopt_id and token_pos fit in an int32
srdjan
2014/06/24 23:31:02
Done. Changed the arguments to be int64_t in order
|
| + rec->token_pos = token_pos; |
| + ASSERT(Utils::IsInt(16, try_index)); |
| + rec->try_index = try_index; |
| } |
| - static const intptr_t kBytesPerElement = (kNumberOfEntries * kWordSize); |
| + static const intptr_t kBytesPerElement = |
| + sizeof(RawPcDescriptors::PcDescriptorRec); |
| static const intptr_t kMaxElements = kSmiMax / kBytesPerElement; |
| static intptr_t InstanceSize() { |
| @@ -3051,23 +3056,8 @@ |
| // pc descriptors table to visit objects if any in the table. |
| private: |
| - void SetPC(intptr_t index, uword value) const; |
| - void SetKind(intptr_t index, PcDescriptors::Kind kind) const; |
| - void SetDeoptId(intptr_t index, intptr_t value) const; |
| - void SetTokenPos(intptr_t index, intptr_t value) const; |
| - void SetTryIndex(intptr_t index, intptr_t value) const; |
| - |
| void SetLength(intptr_t value) const; |
| - intptr_t* EntryAddr(intptr_t index, intptr_t entry_offset) const { |
| - ASSERT((index >=0) && (index < Length())); |
| - intptr_t data_index = (index * kNumberOfEntries) + entry_offset; |
| - return &raw_ptr()->data()[data_index]; |
| - } |
| - RawSmi** SmiAddr(intptr_t index, intptr_t entry_offset) const { |
| - return reinterpret_cast<RawSmi**>(EntryAddr(index, entry_offset)); |
| - } |
| - |
| FINAL_HEAP_OBJECT_IMPLEMENTATION(PcDescriptors, Object); |
| friend class Class; |
| friend class Object; |