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 <limits> | 8 #include <limits> |
9 #include "include/dart_api.h" | 9 #include "include/dart_api.h" |
10 #include "platform/assert.h" | 10 #include "platform/assert.h" |
(...skipping 2153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2164 class Field : public Object { | 2164 class Field : public Object { |
2165 public: | 2165 public: |
2166 RawString* name() const { return raw_ptr()->name_; } | 2166 RawString* name() const { return raw_ptr()->name_; } |
2167 RawString* PrettyName() const; | 2167 RawString* PrettyName() const; |
2168 RawString* UserVisibleName() const; | 2168 RawString* UserVisibleName() const; |
2169 virtual RawString* DictionaryName() const { return name(); } | 2169 virtual RawString* DictionaryName() const { return name(); } |
2170 | 2170 |
2171 bool is_static() const { return StaticBit::decode(raw_ptr()->kind_bits_); } | 2171 bool is_static() const { return StaticBit::decode(raw_ptr()->kind_bits_); } |
2172 bool is_final() const { return FinalBit::decode(raw_ptr()->kind_bits_); } | 2172 bool is_final() const { return FinalBit::decode(raw_ptr()->kind_bits_); } |
2173 bool is_const() const { return ConstBit::decode(raw_ptr()->kind_bits_); } | 2173 bool is_const() const { return ConstBit::decode(raw_ptr()->kind_bits_); } |
| 2174 bool is_synthetic() const { |
| 2175 return SyntheticBit::decode(raw_ptr()->kind_bits_); |
| 2176 } |
2174 | 2177 |
2175 inline intptr_t Offset() const; | 2178 inline intptr_t Offset() const; |
2176 inline void SetOffset(intptr_t value_in_bytes) const; | 2179 inline void SetOffset(intptr_t value_in_bytes) const; |
2177 | 2180 |
2178 RawInstance* value() const; | 2181 RawInstance* value() const; |
2179 void set_value(const Instance& value) const; | 2182 void set_value(const Instance& value) const; |
2180 | 2183 |
2181 RawClass* owner() const; | 2184 RawClass* owner() const; |
2182 RawClass* origin() const; // Either mixin class, or same as owner(). | 2185 RawClass* origin() const; // Either mixin class, or same as owner(). |
2183 | 2186 |
2184 RawAbstractType* type() const { return raw_ptr()->type_; } | 2187 RawAbstractType* type() const { return raw_ptr()->type_; } |
2185 void set_type(const AbstractType& value) const; | 2188 void set_type(const AbstractType& value) const; |
2186 | 2189 |
2187 static intptr_t InstanceSize() { | 2190 static intptr_t InstanceSize() { |
2188 return RoundedAllocationSize(sizeof(RawField)); | 2191 return RoundedAllocationSize(sizeof(RawField)); |
2189 } | 2192 } |
2190 | 2193 |
2191 static RawField* New(const String& name, | 2194 static RawField* New(const String& name, |
2192 bool is_static, | 2195 bool is_static, |
2193 bool is_final, | 2196 bool is_final, |
2194 bool is_const, | 2197 bool is_const, |
| 2198 bool is_synthetic, |
2195 const Class& owner, | 2199 const Class& owner, |
2196 intptr_t token_pos); | 2200 intptr_t token_pos); |
2197 | 2201 |
2198 // Allocate new field object, clone values from this field. The | 2202 // Allocate new field object, clone values from this field. The |
2199 // owner of the clone is new_owner. | 2203 // owner of the clone is new_owner. |
2200 RawField* Clone(const Class& new_owner) const; | 2204 RawField* Clone(const Class& new_owner) const; |
2201 | 2205 |
2202 static intptr_t value_offset() { return OFFSET_OF(RawField, value_); } | 2206 static intptr_t value_offset() { return OFFSET_OF(RawField, value_); } |
2203 | 2207 |
2204 static intptr_t kind_bits_offset() { return OFFSET_OF(RawField, kind_bits_); } | 2208 static intptr_t kind_bits_offset() { return OFFSET_OF(RawField, kind_bits_); } |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2319 static bool IsSetterName(const String& function_name); | 2323 static bool IsSetterName(const String& function_name); |
2320 | 2324 |
2321 private: | 2325 private: |
2322 friend class StoreInstanceFieldInstr; // Generated code access to bit field. | 2326 friend class StoreInstanceFieldInstr; // Generated code access to bit field. |
2323 | 2327 |
2324 enum { | 2328 enum { |
2325 kConstBit = 0, | 2329 kConstBit = 0, |
2326 kStaticBit, | 2330 kStaticBit, |
2327 kFinalBit, | 2331 kFinalBit, |
2328 kHasInitializerBit, | 2332 kHasInitializerBit, |
2329 kUnboxingCandidateBit | 2333 kUnboxingCandidateBit, |
| 2334 kSyntheticBit |
2330 }; | 2335 }; |
2331 class ConstBit : public BitField<bool, kConstBit, 1> {}; | 2336 class ConstBit : public BitField<bool, kConstBit, 1> {}; |
2332 class StaticBit : public BitField<bool, kStaticBit, 1> {}; | 2337 class StaticBit : public BitField<bool, kStaticBit, 1> {}; |
2333 class FinalBit : public BitField<bool, kFinalBit, 1> {}; | 2338 class FinalBit : public BitField<bool, kFinalBit, 1> {}; |
2334 class HasInitializerBit : public BitField<bool, kHasInitializerBit, 1> {}; | 2339 class HasInitializerBit : public BitField<bool, kHasInitializerBit, 1> {}; |
2335 class UnboxingCandidateBit : public BitField<bool, | 2340 class UnboxingCandidateBit : public BitField<bool, |
2336 kUnboxingCandidateBit, 1> { | 2341 kUnboxingCandidateBit, 1> { |
2337 }; | 2342 }; |
| 2343 class SyntheticBit : public BitField<bool, kSyntheticBit, 1> {}; |
2338 | 2344 |
2339 // Update guarded cid and guarded length for this field. Returns true, if | 2345 // Update guarded cid and guarded length for this field. Returns true, if |
2340 // deoptimization of dependent code is required. | 2346 // deoptimization of dependent code is required. |
2341 bool UpdateGuardedCidAndLength(const Object& value) const; | 2347 bool UpdateGuardedCidAndLength(const Object& value) const; |
2342 | 2348 |
2343 void set_name(const String& value) const; | 2349 void set_name(const String& value) const; |
2344 void set_is_static(bool is_static) const { | 2350 void set_is_static(bool is_static) const { |
2345 set_kind_bits(StaticBit::update(is_static, raw_ptr()->kind_bits_)); | 2351 set_kind_bits(StaticBit::update(is_static, raw_ptr()->kind_bits_)); |
2346 } | 2352 } |
2347 void set_is_final(bool is_final) const { | 2353 void set_is_final(bool is_final) const { |
2348 set_kind_bits(FinalBit::update(is_final, raw_ptr()->kind_bits_)); | 2354 set_kind_bits(FinalBit::update(is_final, raw_ptr()->kind_bits_)); |
2349 } | 2355 } |
2350 void set_is_const(bool value) const { | 2356 void set_is_const(bool value) const { |
2351 set_kind_bits(ConstBit::update(value, raw_ptr()->kind_bits_)); | 2357 set_kind_bits(ConstBit::update(value, raw_ptr()->kind_bits_)); |
2352 } | 2358 } |
| 2359 void set_is_synthetic(bool value) const { |
| 2360 set_kind_bits(SyntheticBit::update(value, raw_ptr()->kind_bits_)); |
| 2361 } |
2353 void set_owner(const Object& value) const { | 2362 void set_owner(const Object& value) const { |
2354 StorePointer(&raw_ptr()->owner_, value.raw()); | 2363 StorePointer(&raw_ptr()->owner_, value.raw()); |
2355 } | 2364 } |
2356 void set_token_pos(intptr_t token_pos) const { | 2365 void set_token_pos(intptr_t token_pos) const { |
2357 raw_ptr()->token_pos_ = token_pos; | 2366 raw_ptr()->token_pos_ = token_pos; |
2358 } | 2367 } |
2359 void set_kind_bits(intptr_t value) const { | 2368 void set_kind_bits(intptr_t value) const { |
2360 raw_ptr()->kind_bits_ = static_cast<uint8_t>(value); | 2369 raw_ptr()->kind_bits_ = static_cast<uint8_t>(value); |
2361 } | 2370 } |
2362 | 2371 |
(...skipping 4774 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7137 | 7146 |
7138 | 7147 |
7139 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, | 7148 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, |
7140 intptr_t index) { | 7149 intptr_t index) { |
7141 return array.At((index * kEntryLength) + kTargetFunctionIndex); | 7150 return array.At((index * kEntryLength) + kTargetFunctionIndex); |
7142 } | 7151 } |
7143 | 7152 |
7144 } // namespace dart | 7153 } // namespace dart |
7145 | 7154 |
7146 #endif // VM_OBJECT_H_ | 7155 #endif // VM_OBJECT_H_ |
OLD | NEW |