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 2870 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2881 return raw_ptr()->is_dart_scheme_; | 2881 return raw_ptr()->is_dart_scheme_; |
2882 } | 2882 } |
2883 void set_is_dart_scheme(bool value) const { | 2883 void set_is_dart_scheme(bool value) const { |
2884 raw_ptr()->is_dart_scheme_ = value; | 2884 raw_ptr()->is_dart_scheme_ = value; |
2885 } | 2885 } |
2886 | 2886 |
2887 bool IsCoreLibrary() const { | 2887 bool IsCoreLibrary() const { |
2888 return raw() == CoreLibrary(); | 2888 return raw() == CoreLibrary(); |
2889 } | 2889 } |
2890 | 2890 |
| 2891 inline intptr_t UrlHash() const; |
| 2892 |
2891 static RawLibrary* LookupLibrary(const String& url); | 2893 static RawLibrary* LookupLibrary(const String& url); |
2892 static RawLibrary* GetLibrary(intptr_t index); | 2894 static RawLibrary* GetLibrary(intptr_t index); |
2893 | 2895 |
2894 static void InitCoreLibrary(Isolate* isolate); | 2896 static void InitCoreLibrary(Isolate* isolate); |
2895 static void InitNativeWrappersLibrary(Isolate* isolate); | 2897 static void InitNativeWrappersLibrary(Isolate* isolate); |
2896 | 2898 |
2897 static RawLibrary* AsyncLibrary(); | 2899 static RawLibrary* AsyncLibrary(); |
2898 static RawLibrary* ConvertLibrary(); | 2900 static RawLibrary* ConvertLibrary(); |
2899 static RawLibrary* CoreLibrary(); | 2901 static RawLibrary* CoreLibrary(); |
2900 static RawLibrary* CollectionLibrary(); | 2902 static RawLibrary* CollectionLibrary(); |
(...skipping 4544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7445 } | 7447 } |
7446 for (intptr_t i = 0; i < len; i++) { | 7448 for (intptr_t i = 0; i < len; i++) { |
7447 if (this->CharAt(i) != str.CharAt(begin_index + i)) { | 7449 if (this->CharAt(i) != str.CharAt(begin_index + i)) { |
7448 return false; | 7450 return false; |
7449 } | 7451 } |
7450 } | 7452 } |
7451 return true; | 7453 return true; |
7452 } | 7454 } |
7453 | 7455 |
7454 | 7456 |
| 7457 intptr_t Library::UrlHash() const { |
| 7458 intptr_t result = Smi::Value(url()->ptr()->hash_); |
| 7459 ASSERT(result != 0); |
| 7460 return result; |
| 7461 } |
| 7462 |
| 7463 |
7455 void MegamorphicCache::SetEntry(const Array& array, | 7464 void MegamorphicCache::SetEntry(const Array& array, |
7456 intptr_t index, | 7465 intptr_t index, |
7457 const Smi& class_id, | 7466 const Smi& class_id, |
7458 const Function& target) { | 7467 const Function& target) { |
7459 array.SetAt((index * kEntryLength) + kClassIdIndex, class_id); | 7468 array.SetAt((index * kEntryLength) + kClassIdIndex, class_id); |
7460 array.SetAt((index * kEntryLength) + kTargetFunctionIndex, target); | 7469 array.SetAt((index * kEntryLength) + kTargetFunctionIndex, target); |
7461 } | 7470 } |
7462 | 7471 |
7463 | 7472 |
7464 RawObject* MegamorphicCache::GetClassId(const Array& array, intptr_t index) { | 7473 RawObject* MegamorphicCache::GetClassId(const Array& array, intptr_t index) { |
7465 return array.At((index * kEntryLength) + kClassIdIndex); | 7474 return array.At((index * kEntryLength) + kClassIdIndex); |
7466 } | 7475 } |
7467 | 7476 |
7468 | 7477 |
7469 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, | 7478 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, |
7470 intptr_t index) { | 7479 intptr_t index) { |
7471 return array.At((index * kEntryLength) + kTargetFunctionIndex); | 7480 return array.At((index * kEntryLength) + kTargetFunctionIndex); |
7472 } | 7481 } |
7473 | 7482 |
7474 } // namespace dart | 7483 } // namespace dart |
7475 | 7484 |
7476 #endif // VM_OBJECT_H_ | 7485 #endif // VM_OBJECT_H_ |
OLD | NEW |