| 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_OBJECT_H_ | 5 #ifndef VM_OBJECT_H_ |
| 6 #define VM_OBJECT_H_ | 6 #define VM_OBJECT_H_ |
| 7 | 7 |
| 8 #include "include/dart_api.h" | 8 #include "include/dart_api.h" |
| 9 #include "platform/assert.h" | 9 #include "platform/assert.h" |
| 10 #include "platform/utils.h" | 10 #include "platform/utils.h" |
| (...skipping 2934 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2945 | 2945 |
| 2946 class Code : public Object { | 2946 class Code : public Object { |
| 2947 public: | 2947 public: |
| 2948 RawInstructions* instructions() const { return raw_ptr()->instructions_; } | 2948 RawInstructions* instructions() const { return raw_ptr()->instructions_; } |
| 2949 static intptr_t instructions_offset() { | 2949 static intptr_t instructions_offset() { |
| 2950 return OFFSET_OF(RawCode, instructions_); | 2950 return OFFSET_OF(RawCode, instructions_); |
| 2951 } | 2951 } |
| 2952 intptr_t pointer_offsets_length() const { | 2952 intptr_t pointer_offsets_length() const { |
| 2953 return raw_ptr()->pointer_offsets_length_; | 2953 return raw_ptr()->pointer_offsets_length_; |
| 2954 } | 2954 } |
| 2955 |
| 2955 bool is_optimized() const { | 2956 bool is_optimized() const { |
| 2956 return (raw_ptr()->is_optimized_ == 1); | 2957 return OptimizedBit::decode(raw_ptr()->state_bits_); |
| 2957 } | 2958 } |
| 2958 void set_is_optimized(bool value) const { | 2959 void set_is_optimized(bool value) const; |
| 2959 raw_ptr()->is_optimized_ = value ? 1 : 0; | 2960 bool is_alive() const { |
| 2961 return AliveBit::decode(raw_ptr()->state_bits_); |
| 2960 } | 2962 } |
| 2961 bool is_alive() const { | 2963 void set_is_alive(bool value) const; |
| 2962 return (raw_ptr()->is_alive_ == 1); | |
| 2963 } | |
| 2964 void set_is_alive(bool value) const { | |
| 2965 raw_ptr()->is_alive_ = value ? 1 : 0; | |
| 2966 } | |
| 2967 | 2964 |
| 2968 uword EntryPoint() const { | 2965 uword EntryPoint() const { |
| 2969 const Instructions& instr = Instructions::Handle(instructions()); | 2966 const Instructions& instr = Instructions::Handle(instructions()); |
| 2970 return instr.EntryPoint(); | 2967 return instr.EntryPoint(); |
| 2971 } | 2968 } |
| 2972 intptr_t Size() const { | 2969 intptr_t Size() const { |
| 2973 const Instructions& instr = Instructions::Handle(instructions()); | 2970 const Instructions& instr = Instructions::Handle(instructions()); |
| 2974 return instr.size(); | 2971 return instr.size(); |
| 2975 } | 2972 } |
| 2976 RawArray* ObjectPool() const { | 2973 RawArray* ObjectPool() const { |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3128 // Each (*node_ids)[n] has a an extracted ic data array (*arrays)[n]. | 3125 // Each (*node_ids)[n] has a an extracted ic data array (*arrays)[n]. |
| 3129 // Returns the maximum id found. | 3126 // Returns the maximum id found. |
| 3130 intptr_t ExtractIcDataArraysAtCalls( | 3127 intptr_t ExtractIcDataArraysAtCalls( |
| 3131 GrowableArray<intptr_t>* node_ids, | 3128 GrowableArray<intptr_t>* node_ids, |
| 3132 const GrowableObjectArray& ic_data_objs) const; | 3129 const GrowableObjectArray& ic_data_objs) const; |
| 3133 | 3130 |
| 3134 // Returns an array indexed by deopt id, containing the extracted ICData. | 3131 // Returns an array indexed by deopt id, containing the extracted ICData. |
| 3135 RawArray* ExtractTypeFeedbackArray() const; | 3132 RawArray* ExtractTypeFeedbackArray() const; |
| 3136 | 3133 |
| 3137 private: | 3134 private: |
| 3135 void set_state_bits(intptr_t bits) const; |
| 3136 |
| 3137 friend class RawCode; |
| 3138 enum { |
| 3139 kOptimizedBit = 0, |
| 3140 kAliveBit = 1, |
| 3141 }; |
| 3142 |
| 3143 class OptimizedBit : public BitField<bool, kOptimizedBit, 1> {}; |
| 3144 class AliveBit : public BitField<bool, kAliveBit, 1> {}; |
| 3145 |
| 3138 // An object finder visitor interface. | 3146 // An object finder visitor interface. |
| 3139 class FindRawCodeVisitor : public FindObjectVisitor { | 3147 class FindRawCodeVisitor : public FindObjectVisitor { |
| 3140 public: | 3148 public: |
| 3141 explicit FindRawCodeVisitor(uword pc) | 3149 explicit FindRawCodeVisitor(uword pc) |
| 3142 : FindObjectVisitor(Isolate::Current()), pc_(pc) { } | 3150 : FindObjectVisitor(Isolate::Current()), pc_(pc) { } |
| 3143 virtual ~FindRawCodeVisitor() { } | 3151 virtual ~FindRawCodeVisitor() { } |
| 3144 | 3152 |
| 3145 // Check if object matches find condition. | 3153 // Check if object matches find condition. |
| 3146 virtual bool FindObject(RawObject* obj); | 3154 virtual bool FindObject(RawObject* obj); |
| 3147 | 3155 |
| (...skipping 2995 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6143 | 6151 |
| 6144 | 6152 |
| 6145 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, | 6153 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, |
| 6146 intptr_t index) { | 6154 intptr_t index) { |
| 6147 return array.At((index * kEntryLength) + kTargetFunctionIndex); | 6155 return array.At((index * kEntryLength) + kTargetFunctionIndex); |
| 6148 } | 6156 } |
| 6149 | 6157 |
| 6150 } // namespace dart | 6158 } // namespace dart |
| 6151 | 6159 |
| 6152 #endif // VM_OBJECT_H_ | 6160 #endif // VM_OBJECT_H_ |
| OLD | NEW |