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 1824 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1835 } | 1835 } |
1836 | 1836 |
1837 intptr_t NumArgsTested() const; | 1837 intptr_t NumArgsTested() const; |
1838 | 1838 |
1839 intptr_t deopt_id() const { | 1839 intptr_t deopt_id() const { |
1840 return raw_ptr()->deopt_id_; | 1840 return raw_ptr()->deopt_id_; |
1841 } | 1841 } |
1842 | 1842 |
1843 bool IsImmutable() const; | 1843 bool IsImmutable() const; |
1844 | 1844 |
1845 void Reset(bool is_static_call) const; | 1845 void Reset() const; |
1846 void ResetData() const; | 1846 void ResetData() const; |
1847 | 1847 |
1848 // Note: only deopts with reasons before Unknown in this list are recorded in | 1848 // Note: only deopts with reasons before Unknown in this list are recorded in |
1849 // the ICData. All other reasons are used purely for informational messages | 1849 // the ICData. All other reasons are used purely for informational messages |
1850 // printed during deoptimization itself. | 1850 // printed during deoptimization itself. |
1851 #define DEOPT_REASONS(V) \ | 1851 #define DEOPT_REASONS(V) \ |
1852 V(BinarySmiOp) \ | 1852 V(BinarySmiOp) \ |
1853 V(BinaryMintOp) \ | 1853 V(BinaryMintOp) \ |
1854 V(DoubleToSmi) \ | 1854 V(DoubleToSmi) \ |
1855 V(CheckSmi) \ | 1855 V(CheckSmi) \ |
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2139 | 2139 |
2140 enum { | 2140 enum { |
2141 kCachedICDataArrayCount = 4 | 2141 kCachedICDataArrayCount = 4 |
2142 }; | 2142 }; |
2143 | 2143 |
2144 #if defined(TAG_IC_DATA) | 2144 #if defined(TAG_IC_DATA) |
2145 void set_tag(intptr_t value) const; | 2145 void set_tag(intptr_t value) const; |
2146 intptr_t tag() const { return raw_ptr()->tag_; } | 2146 intptr_t tag() const { return raw_ptr()->tag_; } |
2147 #endif | 2147 #endif |
2148 | 2148 |
| 2149 void SetIsStaticCall(bool static_call) const; |
| 2150 bool is_static_call() const; |
| 2151 |
2149 private: | 2152 private: |
2150 static RawICData* New(); | 2153 static RawICData* New(); |
2151 | 2154 |
2152 RawArray* ic_data() const { | 2155 RawArray* ic_data() const { |
2153 return raw_ptr()->ic_data_; | 2156 return raw_ptr()->ic_data_; |
2154 } | 2157 } |
2155 | 2158 |
2156 void set_owner(const Function& value) const; | 2159 void set_owner(const Function& value) const; |
2157 void set_target_name(const String& value) const; | 2160 void set_target_name(const String& value) const; |
2158 void set_arguments_descriptor(const Array& value) const; | 2161 void set_arguments_descriptor(const Array& value) const; |
2159 void set_deopt_id(intptr_t value) const; | 2162 void set_deopt_id(intptr_t value) const; |
2160 void SetNumArgsTested(intptr_t value) const; | 2163 void SetNumArgsTested(intptr_t value) const; |
2161 void set_ic_data_array(const Array& value) const; | 2164 void set_ic_data_array(const Array& value) const; |
2162 void set_state_bits(uint32_t bits) const; | 2165 void set_state_bits(uint32_t bits) const; |
2163 | 2166 |
2164 enum { | 2167 enum { |
2165 kNumArgsTestedPos = 0, | 2168 kNumArgsTestedPos = 0, |
2166 kNumArgsTestedSize = 2, | 2169 kNumArgsTestedSize = 2, |
2167 kDeoptReasonPos = kNumArgsTestedPos + kNumArgsTestedSize, | 2170 kDeoptReasonPos = kNumArgsTestedPos + kNumArgsTestedSize, |
2168 kDeoptReasonSize = kLastRecordedDeoptReason + 1, | 2171 kDeoptReasonSize = kLastRecordedDeoptReason + 1, |
2169 kRangeFeedbackPos = kDeoptReasonPos + kDeoptReasonSize, | 2172 kRangeFeedbackPos = kDeoptReasonPos + kDeoptReasonSize, |
2170 kRangeFeedbackSize = kBitsPerRangeFeedback * kRangeFeedbackSlots | 2173 kRangeFeedbackSize = kBitsPerRangeFeedback * kRangeFeedbackSlots, |
| 2174 kStaticCallPos = kRangeFeedbackPos + kRangeFeedbackSize, |
| 2175 kStaticCallSize = 1, |
2171 }; | 2176 }; |
2172 | 2177 |
2173 class NumArgsTestedBits : public BitField<uint32_t, | 2178 class NumArgsTestedBits : public BitField<uint32_t, |
2174 uint32_t, | 2179 uint32_t, |
2175 kNumArgsTestedPos, | 2180 kNumArgsTestedPos, |
2176 kNumArgsTestedSize> {}; | 2181 kNumArgsTestedSize> {}; |
2177 class DeoptReasonBits : public BitField<uint32_t, | 2182 class DeoptReasonBits : public BitField<uint32_t, |
2178 uint32_t, | 2183 uint32_t, |
2179 ICData::kDeoptReasonPos, | 2184 ICData::kDeoptReasonPos, |
2180 ICData::kDeoptReasonSize> {}; | 2185 ICData::kDeoptReasonSize> {}; |
2181 class RangeFeedbackBits : public BitField<uint32_t, | 2186 class RangeFeedbackBits : public BitField<uint32_t, |
2182 uint32_t, | 2187 uint32_t, |
2183 ICData::kRangeFeedbackPos, | 2188 ICData::kRangeFeedbackPos, |
2184 ICData::kRangeFeedbackSize> {}; | 2189 ICData::kRangeFeedbackSize> {}; |
2185 | 2190 |
| 2191 class StaticCallBit : public BitField<uint32_t, |
| 2192 bool, |
| 2193 ICData::kStaticCallPos, |
| 2194 ICData::kStaticCallSize> {}; |
2186 #if defined(DEBUG) | 2195 #if defined(DEBUG) |
2187 // Used in asserts to verify that a check is not added twice. | 2196 // Used in asserts to verify that a check is not added twice. |
2188 bool HasCheck(const GrowableArray<intptr_t>& cids) const; | 2197 bool HasCheck(const GrowableArray<intptr_t>& cids) const; |
2189 #endif // DEBUG | 2198 #endif // DEBUG |
2190 | 2199 |
2191 intptr_t TestEntryLength() const; | 2200 intptr_t TestEntryLength() const; |
2192 static RawArray* NewNonCachedEmptyICDataArray(intptr_t num_args_tested); | 2201 static RawArray* NewNonCachedEmptyICDataArray(intptr_t num_args_tested); |
2193 static RawArray* NewEmptyICDataArray(intptr_t num_args_tested); | 2202 static RawArray* NewEmptyICDataArray(intptr_t num_args_tested); |
2194 static RawICData* NewDescriptor(Zone* zone, | 2203 static RawICData* NewDescriptor(Zone* zone, |
2195 const Function& owner, | 2204 const Function& owner, |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2268 // does not involve generic parameter types or generic result type. | 2277 // does not involve generic parameter types or generic result type. |
2269 bool HasInstantiatedSignature() const; | 2278 bool HasInstantiatedSignature() const; |
2270 | 2279 |
2271 // Build a string of the form 'T, {B b, C c}' representing the user | 2280 // Build a string of the form 'T, {B b, C c}' representing the user |
2272 // visible formal parameters of the function. | 2281 // visible formal parameters of the function. |
2273 RawString* UserVisibleFormalParameters() const; | 2282 RawString* UserVisibleFormalParameters() const; |
2274 | 2283 |
2275 // Reloading support: | 2284 // Reloading support: |
2276 void Reparent(const Class& new_cls) const; | 2285 void Reparent(const Class& new_cls) const; |
2277 void ZeroEdgeCounters() const; | 2286 void ZeroEdgeCounters() const; |
2278 void FillICDataWithSentinels(const Code& code) const; | |
2279 | 2287 |
2280 RawClass* Owner() const; | 2288 RawClass* Owner() const; |
2281 RawClass* origin() const; | 2289 RawClass* origin() const; |
2282 RawScript* script() const; | 2290 RawScript* script() const; |
2283 RawObject* RawOwner() const { return raw_ptr()->owner_; } | 2291 RawObject* RawOwner() const { return raw_ptr()->owner_; } |
2284 | 2292 |
2285 RawRegExp* regexp() const; | 2293 RawRegExp* regexp() const; |
2286 intptr_t string_specialization_cid() const; | 2294 intptr_t string_specialization_cid() const; |
2287 void SetRegExpData(const RegExp& regexp, | 2295 void SetRegExpData(const RegExp& regexp, |
2288 intptr_t string_specialization_cid) const; | 2296 intptr_t string_specialization_cid) const; |
(...skipping 2243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4532 | 4540 |
4533 RawCodeSourceMap* code_source_map() const { | 4541 RawCodeSourceMap* code_source_map() const { |
4534 return raw_ptr()->code_source_map_; | 4542 return raw_ptr()->code_source_map_; |
4535 } | 4543 } |
4536 | 4544 |
4537 void set_code_source_map(const CodeSourceMap& code_source_map) const { | 4545 void set_code_source_map(const CodeSourceMap& code_source_map) const { |
4538 ASSERT(code_source_map.IsOld()); | 4546 ASSERT(code_source_map.IsOld()); |
4539 StorePointer(&raw_ptr()->code_source_map_, code_source_map.raw()); | 4547 StorePointer(&raw_ptr()->code_source_map_, code_source_map.raw()); |
4540 } | 4548 } |
4541 | 4549 |
| 4550 // Used during reloading (see object_reload.cc). |
| 4551 void ResetICDatas(const Function& function) const; |
| 4552 |
4542 TokenPosition GetTokenPositionAt(intptr_t offset) const; | 4553 TokenPosition GetTokenPositionAt(intptr_t offset) const; |
4543 | 4554 |
4544 // Array of DeoptInfo objects. | 4555 // Array of DeoptInfo objects. |
4545 RawArray* deopt_info_array() const { | 4556 RawArray* deopt_info_array() const { |
4546 return raw_ptr()->deopt_info_array_; | 4557 return raw_ptr()->deopt_info_array_; |
4547 } | 4558 } |
4548 void set_deopt_info_array(const Array& array) const; | 4559 void set_deopt_info_array(const Array& array) const; |
4549 | 4560 |
4550 RawArray* stackmaps() const { | 4561 RawArray* stackmaps() const { |
4551 return raw_ptr()->stackmaps_; | 4562 return raw_ptr()->stackmaps_; |
(...skipping 4160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8712 | 8723 |
8713 inline void TypeArguments::SetHash(intptr_t value) const { | 8724 inline void TypeArguments::SetHash(intptr_t value) const { |
8714 // This is only safe because we create a new Smi, which does not cause | 8725 // This is only safe because we create a new Smi, which does not cause |
8715 // heap allocation. | 8726 // heap allocation. |
8716 StoreSmi(&raw_ptr()->hash_, Smi::New(value)); | 8727 StoreSmi(&raw_ptr()->hash_, Smi::New(value)); |
8717 } | 8728 } |
8718 | 8729 |
8719 } // namespace dart | 8730 } // namespace dart |
8720 | 8731 |
8721 #endif // VM_OBJECT_H_ | 8732 #endif // VM_OBJECT_H_ |
OLD | NEW |