Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(76)

Side by Side Diff: runtime/vm/object.h

Issue 2044423003: Remember inside an ICData if it is for a static call or an instance call (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « runtime/vm/jit_optimizer.cc ('k') | runtime/vm/object.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
2021 // Consider only used entries. 2021 // Consider only used entries.
2022 bool AllTargetsHaveSameOwner(intptr_t owner_cid) const; 2022 bool AllTargetsHaveSameOwner(intptr_t owner_cid) const;
2023 bool AllReceiversAreNumbers() const; 2023 bool AllReceiversAreNumbers() const;
2024 bool HasOneTarget() const; 2024 bool HasOneTarget() const;
2025 bool HasReceiverClassId(intptr_t class_id) const; 2025 bool HasReceiverClassId(intptr_t class_id) const;
2026 2026
2027 static RawICData* New(const Function& owner, 2027 static RawICData* New(const Function& owner,
2028 const String& target_name, 2028 const String& target_name,
2029 const Array& arguments_descriptor, 2029 const Array& arguments_descriptor,
2030 intptr_t deopt_id, 2030 intptr_t deopt_id,
2031 intptr_t num_args_tested); 2031 intptr_t num_args_tested,
2032 bool is_static_call);
2032 static RawICData* NewFrom(const ICData& from, intptr_t num_args_tested); 2033 static RawICData* NewFrom(const ICData& from, intptr_t num_args_tested);
2033 2034
2034 // Generates a new ICData with descriptor and data array copied (deep clone). 2035 // Generates a new ICData with descriptor and data array copied (deep clone).
2035 static RawICData* Clone(const ICData& from); 2036 static RawICData* Clone(const ICData& from);
2036 2037
2037 static intptr_t TestEntryLengthFor(intptr_t num_args); 2038 static intptr_t TestEntryLengthFor(intptr_t num_args);
2038 2039
2039 static intptr_t TargetIndexFor(intptr_t num_args) { 2040 static intptr_t TargetIndexFor(intptr_t num_args) {
2040 return num_args; 2041 return num_args;
2041 } 2042 }
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
2139 2140
2140 enum { 2141 enum {
2141 kCachedICDataArrayCount = 4 2142 kCachedICDataArrayCount = 4
2142 }; 2143 };
2143 2144
2144 #if defined(TAG_IC_DATA) 2145 #if defined(TAG_IC_DATA)
2145 void set_tag(intptr_t value) const; 2146 void set_tag(intptr_t value) const;
2146 intptr_t tag() const { return raw_ptr()->tag_; } 2147 intptr_t tag() const { return raw_ptr()->tag_; }
2147 #endif 2148 #endif
2148 2149
2150 void SetIsStaticCall(bool static_call) const;
2151 bool is_static_call() const;
2152
2149 private: 2153 private:
2150 static RawICData* New(); 2154 static RawICData* New();
2151 2155
2152 RawArray* ic_data() const { 2156 RawArray* ic_data() const {
2153 return raw_ptr()->ic_data_; 2157 return raw_ptr()->ic_data_;
2154 } 2158 }
2155 2159
2156 void set_owner(const Function& value) const; 2160 void set_owner(const Function& value) const;
2157 void set_target_name(const String& value) const; 2161 void set_target_name(const String& value) const;
2158 void set_arguments_descriptor(const Array& value) const; 2162 void set_arguments_descriptor(const Array& value) const;
2159 void set_deopt_id(intptr_t value) const; 2163 void set_deopt_id(intptr_t value) const;
2160 void SetNumArgsTested(intptr_t value) const; 2164 void SetNumArgsTested(intptr_t value) const;
2161 void set_ic_data_array(const Array& value) const; 2165 void set_ic_data_array(const Array& value) const;
2162 void set_state_bits(uint32_t bits) const; 2166 void set_state_bits(uint32_t bits) const;
2163 2167
2164 enum { 2168 enum {
2165 kNumArgsTestedPos = 0, 2169 kNumArgsTestedPos = 0,
2166 kNumArgsTestedSize = 2, 2170 kNumArgsTestedSize = 2,
2167 kDeoptReasonPos = kNumArgsTestedPos + kNumArgsTestedSize, 2171 kDeoptReasonPos = kNumArgsTestedPos + kNumArgsTestedSize,
2168 kDeoptReasonSize = kLastRecordedDeoptReason + 1, 2172 kDeoptReasonSize = kLastRecordedDeoptReason + 1,
2169 kRangeFeedbackPos = kDeoptReasonPos + kDeoptReasonSize, 2173 kRangeFeedbackPos = kDeoptReasonPos + kDeoptReasonSize,
2170 kRangeFeedbackSize = kBitsPerRangeFeedback * kRangeFeedbackSlots 2174 kRangeFeedbackSize = kBitsPerRangeFeedback * kRangeFeedbackSlots,
2175 kStaticCallPos = kRangeFeedbackPos + kRangeFeedbackSize,
2176 kStaticCallSize = 1,
2171 }; 2177 };
2172 2178
2173 class NumArgsTestedBits : public BitField<uint32_t, 2179 class NumArgsTestedBits : public BitField<uint32_t,
2174 uint32_t, 2180 uint32_t,
2175 kNumArgsTestedPos, 2181 kNumArgsTestedPos,
2176 kNumArgsTestedSize> {}; 2182 kNumArgsTestedSize> {};
2177 class DeoptReasonBits : public BitField<uint32_t, 2183 class DeoptReasonBits : public BitField<uint32_t,
2178 uint32_t, 2184 uint32_t,
2179 ICData::kDeoptReasonPos, 2185 ICData::kDeoptReasonPos,
2180 ICData::kDeoptReasonSize> {}; 2186 ICData::kDeoptReasonSize> {};
2181 class RangeFeedbackBits : public BitField<uint32_t, 2187 class RangeFeedbackBits : public BitField<uint32_t,
2182 uint32_t, 2188 uint32_t,
2183 ICData::kRangeFeedbackPos, 2189 ICData::kRangeFeedbackPos,
2184 ICData::kRangeFeedbackSize> {}; 2190 ICData::kRangeFeedbackSize> {};
2185 2191
2192 class StaticCallBit : public BitField<uint32_t,
2193 bool,
2194 ICData::kStaticCallPos,
2195 ICData::kStaticCallSize> {};
2186 #if defined(DEBUG) 2196 #if defined(DEBUG)
2187 // Used in asserts to verify that a check is not added twice. 2197 // Used in asserts to verify that a check is not added twice.
2188 bool HasCheck(const GrowableArray<intptr_t>& cids) const; 2198 bool HasCheck(const GrowableArray<intptr_t>& cids) const;
2189 #endif // DEBUG 2199 #endif // DEBUG
2190 2200
2191 intptr_t TestEntryLength() const; 2201 intptr_t TestEntryLength() const;
2192 static RawArray* NewNonCachedEmptyICDataArray(intptr_t num_args_tested); 2202 static RawArray* NewNonCachedEmptyICDataArray(intptr_t num_args_tested);
2193 static RawArray* NewEmptyICDataArray(intptr_t num_args_tested); 2203 static RawArray* NewEmptyICDataArray(intptr_t num_args_tested);
2194 static RawICData* NewDescriptor(Zone* zone, 2204 static RawICData* NewDescriptor(Zone* zone,
2195 const Function& owner, 2205 const Function& owner,
2196 const String& target_name, 2206 const String& target_name,
2197 const Array& arguments_descriptor, 2207 const Array& arguments_descriptor,
2198 intptr_t deopt_id, 2208 intptr_t deopt_id,
2199 intptr_t num_args_tested); 2209 intptr_t num_args_tested,
2210 bool is_static_call);
2200 2211
2201 static void WriteSentinel(const Array& data, intptr_t test_entry_length); 2212 static void WriteSentinel(const Array& data, intptr_t test_entry_length);
2202 2213
2203 // A cache of VM heap allocated preinitialized empty ic data entry arrays. 2214 // A cache of VM heap allocated preinitialized empty ic data entry arrays.
2204 static RawArray* cached_icdata_arrays_[kCachedICDataArrayCount]; 2215 static RawArray* cached_icdata_arrays_[kCachedICDataArrayCount];
2205 2216
2206 FINAL_HEAP_OBJECT_IMPLEMENTATION(ICData, Object); 2217 FINAL_HEAP_OBJECT_IMPLEMENTATION(ICData, Object);
2207 friend class Class; 2218 friend class Class;
2208 friend class SnapshotWriter; 2219 friend class SnapshotWriter;
2209 }; 2220 };
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
2268 // does not involve generic parameter types or generic result type. 2279 // does not involve generic parameter types or generic result type.
2269 bool HasInstantiatedSignature() const; 2280 bool HasInstantiatedSignature() const;
2270 2281
2271 // Build a string of the form 'T, {B b, C c}' representing the user 2282 // Build a string of the form 'T, {B b, C c}' representing the user
2272 // visible formal parameters of the function. 2283 // visible formal parameters of the function.
2273 RawString* UserVisibleFormalParameters() const; 2284 RawString* UserVisibleFormalParameters() const;
2274 2285
2275 // Reloading support: 2286 // Reloading support:
2276 void Reparent(const Class& new_cls) const; 2287 void Reparent(const Class& new_cls) const;
2277 void ZeroEdgeCounters() const; 2288 void ZeroEdgeCounters() const;
2278 void FillICDataWithSentinels(const Code& code) const;
2279 2289
2280 RawClass* Owner() const; 2290 RawClass* Owner() const;
2281 RawClass* origin() const; 2291 RawClass* origin() const;
2282 RawScript* script() const; 2292 RawScript* script() const;
2283 RawObject* RawOwner() const { return raw_ptr()->owner_; } 2293 RawObject* RawOwner() const { return raw_ptr()->owner_; }
2284 2294
2285 RawRegExp* regexp() const; 2295 RawRegExp* regexp() const;
2286 intptr_t string_specialization_cid() const; 2296 intptr_t string_specialization_cid() const;
2287 void SetRegExpData(const RegExp& regexp, 2297 void SetRegExpData(const RegExp& regexp,
2288 intptr_t string_specialization_cid) const; 2298 intptr_t string_specialization_cid) const;
(...skipping 2243 matching lines...) Expand 10 before | Expand all | Expand 10 after
4532 4542
4533 RawCodeSourceMap* code_source_map() const { 4543 RawCodeSourceMap* code_source_map() const {
4534 return raw_ptr()->code_source_map_; 4544 return raw_ptr()->code_source_map_;
4535 } 4545 }
4536 4546
4537 void set_code_source_map(const CodeSourceMap& code_source_map) const { 4547 void set_code_source_map(const CodeSourceMap& code_source_map) const {
4538 ASSERT(code_source_map.IsOld()); 4548 ASSERT(code_source_map.IsOld());
4539 StorePointer(&raw_ptr()->code_source_map_, code_source_map.raw()); 4549 StorePointer(&raw_ptr()->code_source_map_, code_source_map.raw());
4540 } 4550 }
4541 4551
4552 // Used during reloading (see object_reload.cc). Calls Reset on all ICDatas
4553 // that are embedded inside the Code object.
4554 void ResetICDatas() const;
4555
4542 TokenPosition GetTokenPositionAt(intptr_t offset) const; 4556 TokenPosition GetTokenPositionAt(intptr_t offset) const;
4543 4557
4544 // Array of DeoptInfo objects. 4558 // Array of DeoptInfo objects.
4545 RawArray* deopt_info_array() const { 4559 RawArray* deopt_info_array() const {
4546 return raw_ptr()->deopt_info_array_; 4560 return raw_ptr()->deopt_info_array_;
4547 } 4561 }
4548 void set_deopt_info_array(const Array& array) const; 4562 void set_deopt_info_array(const Array& array) const;
4549 4563
4550 RawArray* stackmaps() const { 4564 RawArray* stackmaps() const {
4551 return raw_ptr()->stackmaps_; 4565 return raw_ptr()->stackmaps_;
(...skipping 4160 matching lines...) Expand 10 before | Expand all | Expand 10 after
8712 8726
8713 inline void TypeArguments::SetHash(intptr_t value) const { 8727 inline void TypeArguments::SetHash(intptr_t value) const {
8714 // This is only safe because we create a new Smi, which does not cause 8728 // This is only safe because we create a new Smi, which does not cause
8715 // heap allocation. 8729 // heap allocation.
8716 StoreSmi(&raw_ptr()->hash_, Smi::New(value)); 8730 StoreSmi(&raw_ptr()->hash_, Smi::New(value));
8717 } 8731 }
8718 8732
8719 } // namespace dart 8733 } // namespace dart
8720 8734
8721 #endif // VM_OBJECT_H_ 8735 #endif // VM_OBJECT_H_
OLDNEW
« no previous file with comments | « runtime/vm/jit_optimizer.cc ('k') | runtime/vm/object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698