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