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 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
287 static RawClass* deopt_info_class() { return deopt_info_class_; } | 287 static RawClass* deopt_info_class() { return deopt_info_class_; } |
288 static RawClass* context_class() { return context_class_; } | 288 static RawClass* context_class() { return context_class_; } |
289 static RawClass* context_scope_class() { return context_scope_class_; } | 289 static RawClass* context_scope_class() { return context_scope_class_; } |
290 static RawClass* api_error_class() { return api_error_class_; } | 290 static RawClass* api_error_class() { return api_error_class_; } |
291 static RawClass* language_error_class() { return language_error_class_; } | 291 static RawClass* language_error_class() { return language_error_class_; } |
292 static RawClass* unhandled_exception_class() { | 292 static RawClass* unhandled_exception_class() { |
293 return unhandled_exception_class_; | 293 return unhandled_exception_class_; |
294 } | 294 } |
295 static RawClass* unwind_error_class() { return unwind_error_class_; } | 295 static RawClass* unwind_error_class() { return unwind_error_class_; } |
296 static RawClass* icdata_class() { return icdata_class_; } | 296 static RawClass* icdata_class() { return icdata_class_; } |
| 297 static RawClass* megamorphic_cache_class() { |
| 298 return megamorphic_cache_class_; |
| 299 } |
297 static RawClass* subtypetestcache_class() { return subtypetestcache_class_; } | 300 static RawClass* subtypetestcache_class() { return subtypetestcache_class_; } |
298 | 301 |
299 static RawError* Init(Isolate* isolate); | 302 static RawError* Init(Isolate* isolate); |
300 static void InitFromSnapshot(Isolate* isolate); | 303 static void InitFromSnapshot(Isolate* isolate); |
301 static void InitOnce(); | 304 static void InitOnce(); |
302 static void RegisterSingletonClassNames(); | 305 static void RegisterSingletonClassNames(); |
303 static void MakeUnusedSpaceTraversable(const Object& obj, | 306 static void MakeUnusedSpaceTraversable(const Object& obj, |
304 intptr_t original_size, | 307 intptr_t original_size, |
305 intptr_t used_size); | 308 intptr_t used_size); |
306 | 309 |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
421 static RawClass* code_class_; // Class of the Code vm object. | 424 static RawClass* code_class_; // Class of the Code vm object. |
422 static RawClass* instructions_class_; // Class of the Instructions vm object. | 425 static RawClass* instructions_class_; // Class of the Instructions vm object. |
423 static RawClass* pc_descriptors_class_; // Class of PcDescriptors vm object. | 426 static RawClass* pc_descriptors_class_; // Class of PcDescriptors vm object. |
424 static RawClass* stackmap_class_; // Class of Stackmap vm object. | 427 static RawClass* stackmap_class_; // Class of Stackmap vm object. |
425 static RawClass* var_descriptors_class_; // Class of LocalVarDescriptors. | 428 static RawClass* var_descriptors_class_; // Class of LocalVarDescriptors. |
426 static RawClass* exception_handlers_class_; // Class of ExceptionHandlers. | 429 static RawClass* exception_handlers_class_; // Class of ExceptionHandlers. |
427 static RawClass* deopt_info_class_; // Class of DeoptInfo. | 430 static RawClass* deopt_info_class_; // Class of DeoptInfo. |
428 static RawClass* context_class_; // Class of the Context vm object. | 431 static RawClass* context_class_; // Class of the Context vm object. |
429 static RawClass* context_scope_class_; // Class of ContextScope vm object. | 432 static RawClass* context_scope_class_; // Class of ContextScope vm object. |
430 static RawClass* icdata_class_; // Class of ICData. | 433 static RawClass* icdata_class_; // Class of ICData. |
| 434 static RawClass* megamorphic_cache_class_; // Class of MegamorphiCache. |
431 static RawClass* subtypetestcache_class_; // Class of SubtypeTestCache. | 435 static RawClass* subtypetestcache_class_; // Class of SubtypeTestCache. |
432 static RawClass* api_error_class_; // Class of ApiError. | 436 static RawClass* api_error_class_; // Class of ApiError. |
433 static RawClass* language_error_class_; // Class of LanguageError. | 437 static RawClass* language_error_class_; // Class of LanguageError. |
434 static RawClass* unhandled_exception_class_; // Class of UnhandledException. | 438 static RawClass* unhandled_exception_class_; // Class of UnhandledException. |
435 static RawClass* unwind_error_class_; // Class of UnwindError. | 439 static RawClass* unwind_error_class_; // Class of UnwindError. |
436 | 440 |
437 friend void ClassTable::Register(const Class& cls); | 441 friend void ClassTable::Register(const Class& cls); |
438 friend void RawObject::Validate(Isolate* isolate) const; | 442 friend void RawObject::Validate(Isolate* isolate) const; |
439 friend class Closure; | 443 friend class Closure; |
440 friend class SnapshotReader; | 444 friend class SnapshotReader; |
(...skipping 2478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2919 #endif // DEBUG | 2923 #endif // DEBUG |
2920 | 2924 |
2921 intptr_t TestEntryLength() const; | 2925 intptr_t TestEntryLength() const; |
2922 void WriteSentinel() const; | 2926 void WriteSentinel() const; |
2923 | 2927 |
2924 HEAP_OBJECT_IMPLEMENTATION(ICData, Object); | 2928 HEAP_OBJECT_IMPLEMENTATION(ICData, Object); |
2925 friend class Class; | 2929 friend class Class; |
2926 }; | 2930 }; |
2927 | 2931 |
2928 | 2932 |
| 2933 class MegamorphicCache : public Object { |
| 2934 public: |
| 2935 static const int kInitialCapacity = 16; |
| 2936 static const double kLoadFactor = 0.75; |
| 2937 |
| 2938 RawArray* buckets() const; |
| 2939 void set_buckets(const Array& buckets) const; |
| 2940 |
| 2941 intptr_t mask() const; |
| 2942 void set_mask(intptr_t mask) const; |
| 2943 |
| 2944 intptr_t fill_count() const; |
| 2945 void set_fill_count(intptr_t fill_count) const; |
| 2946 |
| 2947 static intptr_t buckets_offset() { |
| 2948 return OFFSET_OF(RawMegamorphicCache, buckets_); |
| 2949 } |
| 2950 static intptr_t mask_offset() { |
| 2951 return OFFSET_OF(RawMegamorphicCache, mask_); |
| 2952 } |
| 2953 |
| 2954 static RawMegamorphicCache* New(); |
| 2955 |
| 2956 void EnsureCapacity() const; |
| 2957 |
| 2958 void Insert(const Smi& class_id, const Function& target) const; |
| 2959 |
| 2960 static intptr_t InstanceSize() { |
| 2961 return RoundedAllocationSize(sizeof(RawMegamorphicCache)); |
| 2962 } |
| 2963 |
| 2964 private: |
| 2965 friend class Class; |
| 2966 |
| 2967 HEAP_OBJECT_IMPLEMENTATION(MegamorphicCache, Object); |
| 2968 }; |
| 2969 |
| 2970 |
2929 class SubtypeTestCache : public Object { | 2971 class SubtypeTestCache : public Object { |
2930 public: | 2972 public: |
2931 enum Entries { | 2973 enum Entries { |
2932 kInstanceClassId = 0, | 2974 kInstanceClassId = 0, |
2933 kInstanceTypeArguments = 1, | 2975 kInstanceTypeArguments = 1, |
2934 kInstantiatorTypeArguments = 2, | 2976 kInstantiatorTypeArguments = 2, |
2935 kTestResult = 3, | 2977 kTestResult = 3, |
2936 kTestEntryLength = 4, | 2978 kTestEntryLength = 4, |
2937 }; | 2979 }; |
2938 | 2980 |
(...skipping 3034 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5973 if (this->CharAt(i) != str.CharAt(begin_index + i)) { | 6015 if (this->CharAt(i) != str.CharAt(begin_index + i)) { |
5974 return false; | 6016 return false; |
5975 } | 6017 } |
5976 } | 6018 } |
5977 return true; | 6019 return true; |
5978 } | 6020 } |
5979 | 6021 |
5980 } // namespace dart | 6022 } // namespace dart |
5981 | 6023 |
5982 #endif // VM_OBJECT_H_ | 6024 #endif // VM_OBJECT_H_ |
OLD | NEW |