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 1903 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1914 bool HasOneTarget() const; | 1914 bool HasOneTarget() const; |
1915 bool HasReceiverClassId(intptr_t class_id) const; | 1915 bool HasReceiverClassId(intptr_t class_id) const; |
1916 | 1916 |
1917 static RawICData* New(const Function& owner, | 1917 static RawICData* New(const Function& owner, |
1918 const String& target_name, | 1918 const String& target_name, |
1919 const Array& arguments_descriptor, | 1919 const Array& arguments_descriptor, |
1920 intptr_t deopt_id, | 1920 intptr_t deopt_id, |
1921 intptr_t num_args_tested); | 1921 intptr_t num_args_tested); |
1922 static RawICData* NewFrom(const ICData& from, intptr_t num_args_tested); | 1922 static RawICData* NewFrom(const ICData& from, intptr_t num_args_tested); |
1923 | 1923 |
| 1924 // Generates a new ICData with descriptor data copied (shallow clone). |
| 1925 // Entry array of the result is the same as in 'from'. Once entry array is |
| 1926 // created, it can only change the 'count', all other properties are invariant |
| 1927 // (target, cids, number of checks). |
| 1928 static RawICData* CloneDescriptor(const ICData& from); |
| 1929 |
1924 static intptr_t TestEntryLengthFor(intptr_t num_args); | 1930 static intptr_t TestEntryLengthFor(intptr_t num_args); |
1925 | 1931 |
1926 static intptr_t TargetIndexFor(intptr_t num_args) { | 1932 static intptr_t TargetIndexFor(intptr_t num_args) { |
1927 return num_args; | 1933 return num_args; |
1928 } | 1934 } |
1929 | 1935 |
1930 static intptr_t CountIndexFor(intptr_t num_args) { | 1936 static intptr_t CountIndexFor(intptr_t num_args) { |
1931 return (num_args + 1); | 1937 return (num_args + 1); |
1932 } | 1938 } |
1933 | 1939 |
(...skipping 675 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2609 // functions. | 2615 // functions. |
2610 int32_t SourceFingerprint() const; | 2616 int32_t SourceFingerprint() const; |
2611 | 2617 |
2612 // Return false and report an error if the fingerprint does not match. | 2618 // Return false and report an error if the fingerprint does not match. |
2613 bool CheckSourceFingerprint(const char* prefix, int32_t fp) const; | 2619 bool CheckSourceFingerprint(const char* prefix, int32_t fp) const; |
2614 | 2620 |
2615 // Works with map [deopt-id] -> ICData. | 2621 // Works with map [deopt-id] -> ICData. |
2616 void SaveICDataMap( | 2622 void SaveICDataMap( |
2617 const ZoneGrowableArray<const ICData*>& deopt_id_to_ic_data, | 2623 const ZoneGrowableArray<const ICData*>& deopt_id_to_ic_data, |
2618 const Array& edge_counters_array) const; | 2624 const Array& edge_counters_array) const; |
| 2625 // Uses saved ICData to populate the table 'deopt_id_to_ic_data'. Clone |
| 2626 // descriptors if 'clone_descriptors' true. |
2619 void RestoreICDataMap( | 2627 void RestoreICDataMap( |
2620 ZoneGrowableArray<const ICData*>* deopt_id_to_ic_data) const; | 2628 ZoneGrowableArray<const ICData*>* deopt_id_to_ic_data, |
| 2629 bool clone_descriptors) const; |
2621 | 2630 |
2622 RawArray* ic_data_array() const; | 2631 RawArray* ic_data_array() const; |
2623 void ClearICDataArray() const; | 2632 void ClearICDataArray() const; |
2624 | 2633 |
2625 // Sets deopt reason in all ICData-s with given deopt_id. | 2634 // Sets deopt reason in all ICData-s with given deopt_id. |
2626 void SetDeoptReasonForAll(intptr_t deopt_id, ICData::DeoptReasonId reason); | 2635 void SetDeoptReasonForAll(intptr_t deopt_id, ICData::DeoptReasonId reason); |
2627 | 2636 |
2628 static const int kCtorPhaseInit = 1 << 0; | 2637 static const int kCtorPhaseInit = 1 << 0; |
2629 static const int kCtorPhaseBody = 1 << 1; | 2638 static const int kCtorPhaseBody = 1 << 1; |
2630 static const int kCtorPhaseAll = (kCtorPhaseInit | kCtorPhaseBody); | 2639 static const int kCtorPhaseAll = (kCtorPhaseInit | kCtorPhaseBody); |
(...skipping 5565 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8196 | 8205 |
8197 | 8206 |
8198 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, | 8207 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, |
8199 intptr_t index) { | 8208 intptr_t index) { |
8200 return array.At((index * kEntryLength) + kTargetFunctionIndex); | 8209 return array.At((index * kEntryLength) + kTargetFunctionIndex); |
8201 } | 8210 } |
8202 | 8211 |
8203 } // namespace dart | 8212 } // namespace dart |
8204 | 8213 |
8205 #endif // VM_OBJECT_H_ | 8214 #endif // VM_OBJECT_H_ |
OLD | NEW |