| 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 860 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 871 other, | 871 other, |
| 872 other_type_arguments, | 872 other_type_arguments, |
| 873 bound_error); | 873 bound_error); |
| 874 } | 874 } |
| 875 | 875 |
| 876 // Check if this is the top level class. | 876 // Check if this is the top level class. |
| 877 bool IsTopLevel() const; | 877 bool IsTopLevel() const; |
| 878 | 878 |
| 879 RawArray* fields() const { return raw_ptr()->fields_; } | 879 RawArray* fields() const { return raw_ptr()->fields_; } |
| 880 void SetFields(const Array& value) const; | 880 void SetFields(const Array& value) const; |
| 881 intptr_t FindFieldIndex(const Field& field) const; |
| 881 | 882 |
| 882 // Returns an array of all fields of this class and its superclasses indexed | 883 // Returns an array of all fields of this class and its superclasses indexed |
| 883 // by offset in words. | 884 // by offset in words. |
| 884 RawArray* OffsetToFieldMap() const; | 885 RawArray* OffsetToFieldMap() const; |
| 885 | 886 |
| 886 // Returns true if non-static fields are defined. | 887 // Returns true if non-static fields are defined. |
| 887 bool HasInstanceFields() const; | 888 bool HasInstanceFields() const; |
| 888 | 889 |
| 889 RawArray* functions() const { return raw_ptr()->functions_; } | 890 RawArray* functions() const { return raw_ptr()->functions_; } |
| 890 void SetFunctions(const Array& value) const; | 891 void SetFunctions(const Array& value) const; |
| 891 void AddFunction(const Function& function) const; | 892 void AddFunction(const Function& function) const; |
| 893 intptr_t FindFunctionIndex(const Function& function) const; |
| 892 | 894 |
| 893 RawGrowableObjectArray* closures() const { | 895 RawGrowableObjectArray* closures() const { |
| 894 return raw_ptr()->closure_functions_; | 896 return raw_ptr()->closure_functions_; |
| 895 } | 897 } |
| 896 void AddClosureFunction(const Function& function) const; | 898 void AddClosureFunction(const Function& function) const; |
| 897 RawFunction* LookupClosureFunction(intptr_t token_pos) const; | 899 RawFunction* LookupClosureFunction(intptr_t token_pos) const; |
| 900 intptr_t FindClosureIndex(intptr_t token_pos) const; |
| 898 | 901 |
| 899 RawFunction* LookupDynamicFunction(const String& name) const; | 902 RawFunction* LookupDynamicFunction(const String& name) const; |
| 900 RawFunction* LookupDynamicFunctionAllowPrivate(const String& name) const; | 903 RawFunction* LookupDynamicFunctionAllowPrivate(const String& name) const; |
| 901 RawFunction* LookupStaticFunction(const String& name) const; | 904 RawFunction* LookupStaticFunction(const String& name) const; |
| 902 RawFunction* LookupStaticFunctionAllowPrivate(const String& name) const; | 905 RawFunction* LookupStaticFunctionAllowPrivate(const String& name) const; |
| 903 RawFunction* LookupConstructor(const String& name) const; | 906 RawFunction* LookupConstructor(const String& name) const; |
| 904 RawFunction* LookupConstructorAllowPrivate(const String& name) const; | 907 RawFunction* LookupConstructorAllowPrivate(const String& name) const; |
| 905 RawFunction* LookupFactory(const String& name) const; | 908 RawFunction* LookupFactory(const String& name) const; |
| 906 RawFunction* LookupFunction(const String& name) const; | 909 RawFunction* LookupFunction(const String& name) const; |
| 907 RawFunction* LookupFunctionAllowPrivate(const String& name) const; | 910 RawFunction* LookupFunctionAllowPrivate(const String& name) const; |
| (...skipping 4156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5064 intptr_t dst_offset, | 5067 intptr_t dst_offset, |
| 5065 const uint16_t* characters, | 5068 const uint16_t* characters, |
| 5066 intptr_t len); | 5069 intptr_t len); |
| 5067 static void Copy(const String& dst, | 5070 static void Copy(const String& dst, |
| 5068 intptr_t dst_offset, | 5071 intptr_t dst_offset, |
| 5069 const String& src, | 5072 const String& src, |
| 5070 intptr_t src_offset, | 5073 intptr_t src_offset, |
| 5071 intptr_t len); | 5074 intptr_t len); |
| 5072 | 5075 |
| 5073 static RawString* EscapeSpecialCharacters(const String& str); | 5076 static RawString* EscapeSpecialCharacters(const String& str); |
| 5074 | 5077 static RawString* EncodeURI(const String& str); |
| 5078 static RawString* DecodeURI(const String& str); |
| 5075 static RawString* Concat(const String& str1, | 5079 static RawString* Concat(const String& str1, |
| 5076 const String& str2, | 5080 const String& str2, |
| 5077 Heap::Space space = Heap::kNew); | 5081 Heap::Space space = Heap::kNew); |
| 5078 static RawString* ConcatAll(const Array& strings, | 5082 static RawString* ConcatAll(const Array& strings, |
| 5079 Heap::Space space = Heap::kNew); | 5083 Heap::Space space = Heap::kNew); |
| 5080 // Concat all strings in 'strings' from 'start' to 'end' (excluding). | 5084 // Concat all strings in 'strings' from 'start' to 'end' (excluding). |
| 5081 static RawString* ConcatAllRange(const Array& strings, | 5085 static RawString* ConcatAllRange(const Array& strings, |
| 5082 intptr_t start, | 5086 intptr_t start, |
| 5083 intptr_t end, | 5087 intptr_t end, |
| 5084 Heap::Space space = Heap::kNew); | 5088 Heap::Space space = Heap::kNew); |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5155 class OneByteString : public AllStatic { | 5159 class OneByteString : public AllStatic { |
| 5156 public: | 5160 public: |
| 5157 static int32_t CharAt(const String& str, intptr_t index) { | 5161 static int32_t CharAt(const String& str, intptr_t index) { |
| 5158 return *CharAddr(str, index); | 5162 return *CharAddr(str, index); |
| 5159 } | 5163 } |
| 5160 | 5164 |
| 5161 static void SetCharAt(const String& str, intptr_t index, uint8_t code_point) { | 5165 static void SetCharAt(const String& str, intptr_t index, uint8_t code_point) { |
| 5162 *CharAddr(str, index) = code_point; | 5166 *CharAddr(str, index) = code_point; |
| 5163 } | 5167 } |
| 5164 static RawOneByteString* EscapeSpecialCharacters(const String& str); | 5168 static RawOneByteString* EscapeSpecialCharacters(const String& str); |
| 5165 | 5169 static RawOneByteString* EncodeURI(const String& str); |
| 5170 static RawOneByteString* DecodeURI(const String& str); |
| 5166 // We use the same maximum elements for all strings. | 5171 // We use the same maximum elements for all strings. |
| 5167 static const intptr_t kBytesPerElement = 1; | 5172 static const intptr_t kBytesPerElement = 1; |
| 5168 static const intptr_t kMaxElements = String::kMaxElements; | 5173 static const intptr_t kMaxElements = String::kMaxElements; |
| 5169 | 5174 |
| 5170 static intptr_t data_offset() { return OFFSET_OF(RawOneByteString, data_); } | 5175 static intptr_t data_offset() { return OFFSET_OF(RawOneByteString, data_); } |
| 5171 | 5176 |
| 5172 static intptr_t InstanceSize() { | 5177 static intptr_t InstanceSize() { |
| 5173 ASSERT(sizeof(RawOneByteString) == OFFSET_OF(RawOneByteString, data_)); | 5178 ASSERT(sizeof(RawOneByteString) == OFFSET_OF(RawOneByteString, data_)); |
| 5174 return 0; | 5179 return 0; |
| 5175 } | 5180 } |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5379 intptr_t len, | 5384 intptr_t len, |
| 5380 void* peer, | 5385 void* peer, |
| 5381 Dart_PeerFinalizer callback, | 5386 Dart_PeerFinalizer callback, |
| 5382 Heap::Space space); | 5387 Heap::Space space); |
| 5383 | 5388 |
| 5384 static RawExternalOneByteString* null() { | 5389 static RawExternalOneByteString* null() { |
| 5385 return reinterpret_cast<RawExternalOneByteString*>(Object::null()); | 5390 return reinterpret_cast<RawExternalOneByteString*>(Object::null()); |
| 5386 } | 5391 } |
| 5387 | 5392 |
| 5388 static RawOneByteString* EscapeSpecialCharacters(const String& str); | 5393 static RawOneByteString* EscapeSpecialCharacters(const String& str); |
| 5394 static RawOneByteString* EncodeURI(const String& str); |
| 5395 static RawOneByteString* DecodeURI(const String& str); |
| 5389 | 5396 |
| 5390 static const ClassId kClassId = kExternalOneByteStringCid; | 5397 static const ClassId kClassId = kExternalOneByteStringCid; |
| 5391 | 5398 |
| 5392 private: | 5399 private: |
| 5393 static RawExternalOneByteString* raw(const String& str) { | 5400 static RawExternalOneByteString* raw(const String& str) { |
| 5394 return reinterpret_cast<RawExternalOneByteString*>(str.raw()); | 5401 return reinterpret_cast<RawExternalOneByteString*>(str.raw()); |
| 5395 } | 5402 } |
| 5396 | 5403 |
| 5397 static RawExternalOneByteString* raw_ptr(const String& str) { | 5404 static RawExternalOneByteString* raw_ptr(const String& str) { |
| 5398 return reinterpret_cast<RawExternalOneByteString*>(str.raw_ptr()); | 5405 return reinterpret_cast<RawExternalOneByteString*>(str.raw_ptr()); |
| (...skipping 1164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6563 | 6570 |
| 6564 | 6571 |
| 6565 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, | 6572 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, |
| 6566 intptr_t index) { | 6573 intptr_t index) { |
| 6567 return array.At((index * kEntryLength) + kTargetFunctionIndex); | 6574 return array.At((index * kEntryLength) + kTargetFunctionIndex); |
| 6568 } | 6575 } |
| 6569 | 6576 |
| 6570 } // namespace dart | 6577 } // namespace dart |
| 6571 | 6578 |
| 6572 #endif // VM_OBJECT_H_ | 6579 #endif // VM_OBJECT_H_ |
| OLD | NEW |