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 2101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2112 bool is_const, | 2112 bool is_const, |
2113 const Class& owner, | 2113 const Class& owner, |
2114 intptr_t token_pos); | 2114 intptr_t token_pos); |
2115 | 2115 |
2116 // Allocate new field object, clone values from this field. The | 2116 // Allocate new field object, clone values from this field. The |
2117 // owner of the clone is new_owner. | 2117 // owner of the clone is new_owner. |
2118 RawField* Clone(const Class& new_owner) const; | 2118 RawField* Clone(const Class& new_owner) const; |
2119 | 2119 |
2120 static intptr_t value_offset() { return OFFSET_OF(RawField, value_); } | 2120 static intptr_t value_offset() { return OFFSET_OF(RawField, value_); } |
2121 | 2121 |
| 2122 static intptr_t kind_bits_offset() { return OFFSET_OF(RawField, kind_bits_); } |
| 2123 |
2122 intptr_t token_pos() const { return raw_ptr()->token_pos_; } | 2124 intptr_t token_pos() const { return raw_ptr()->token_pos_; } |
2123 | 2125 |
2124 bool has_initializer() const { | 2126 bool has_initializer() const { |
2125 return HasInitializerBit::decode(raw_ptr()->kind_bits_); | 2127 return HasInitializerBit::decode(raw_ptr()->kind_bits_); |
2126 } | 2128 } |
2127 void set_has_initializer(bool has_initializer) const { | 2129 void set_has_initializer(bool has_initializer) const { |
2128 set_kind_bits(HasInitializerBit::update(has_initializer, | 2130 set_kind_bits(HasInitializerBit::update(has_initializer, |
2129 raw_ptr()->kind_bits_)); | 2131 raw_ptr()->kind_bits_)); |
2130 } | 2132 } |
2131 | 2133 |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2226 static bool IsGetterName(const String& function_name); | 2228 static bool IsGetterName(const String& function_name); |
2227 static bool IsSetterName(const String& function_name); | 2229 static bool IsSetterName(const String& function_name); |
2228 | 2230 |
2229 // When we print a field to a JSON stream, we want to make it appear | 2231 // When we print a field to a JSON stream, we want to make it appear |
2230 // that the value is a property of the field, so we allow the actual | 2232 // that the value is a property of the field, so we allow the actual |
2231 // instance to be supplied here. | 2233 // instance to be supplied here. |
2232 virtual void PrintToJSONStreamWithInstance( | 2234 virtual void PrintToJSONStreamWithInstance( |
2233 JSONStream* stream, const Instance& instance, bool ref) const; | 2235 JSONStream* stream, const Instance& instance, bool ref) const; |
2234 | 2236 |
2235 private: | 2237 private: |
| 2238 friend class StoreInstanceFieldInstr; // Generated code access to bit field. |
| 2239 |
2236 enum { | 2240 enum { |
2237 kConstBit = 1, | 2241 kConstBit = 0, |
2238 kStaticBit, | 2242 kStaticBit, |
2239 kFinalBit, | 2243 kFinalBit, |
2240 kHasInitializerBit, | 2244 kHasInitializerBit, |
2241 kUnboxingCandidateBit | 2245 kUnboxingCandidateBit |
2242 }; | 2246 }; |
2243 class ConstBit : public BitField<bool, kConstBit, 1> {}; | 2247 class ConstBit : public BitField<bool, kConstBit, 1> {}; |
2244 class StaticBit : public BitField<bool, kStaticBit, 1> {}; | 2248 class StaticBit : public BitField<bool, kStaticBit, 1> {}; |
2245 class FinalBit : public BitField<bool, kFinalBit, 1> {}; | 2249 class FinalBit : public BitField<bool, kFinalBit, 1> {}; |
2246 class HasInitializerBit : public BitField<bool, kHasInitializerBit, 1> {}; | 2250 class HasInitializerBit : public BitField<bool, kHasInitializerBit, 1> {}; |
2247 class UnboxingCandidateBit : public BitField<bool, | 2251 class UnboxingCandidateBit : public BitField<bool, |
(...skipping 4311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6559 | 6563 |
6560 | 6564 |
6561 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, | 6565 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, |
6562 intptr_t index) { | 6566 intptr_t index) { |
6563 return array.At((index * kEntryLength) + kTargetFunctionIndex); | 6567 return array.At((index * kEntryLength) + kTargetFunctionIndex); |
6564 } | 6568 } |
6565 | 6569 |
6566 } // namespace dart | 6570 } // namespace dart |
6567 | 6571 |
6568 #endif // VM_OBJECT_H_ | 6572 #endif // VM_OBJECT_H_ |
OLD | NEW |