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