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 5437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5448 friend class SnapshotReader; | 5448 friend class SnapshotReader; |
5449 }; | 5449 }; |
5450 | 5450 |
5451 | 5451 |
5452 class TwoByteString : public AllStatic { | 5452 class TwoByteString : public AllStatic { |
5453 public: | 5453 public: |
5454 static int32_t CharAt(const String& str, intptr_t index) { | 5454 static int32_t CharAt(const String& str, intptr_t index) { |
5455 return *CharAddr(str, index); | 5455 return *CharAddr(str, index); |
5456 } | 5456 } |
5457 | 5457 |
| 5458 static void SetCharAt(const String& str, intptr_t index, uint16_t ch) { |
| 5459 *CharAddr(str, index) = ch; |
| 5460 } |
| 5461 |
5458 static RawTwoByteString* EscapeSpecialCharacters(const String& str); | 5462 static RawTwoByteString* EscapeSpecialCharacters(const String& str); |
5459 | 5463 |
5460 // We use the same maximum elements for all strings. | 5464 // We use the same maximum elements for all strings. |
5461 static const intptr_t kBytesPerElement = 2; | 5465 static const intptr_t kBytesPerElement = 2; |
5462 static const intptr_t kMaxElements = String::kMaxElements; | 5466 static const intptr_t kMaxElements = String::kMaxElements; |
5463 | 5467 |
5464 static intptr_t data_offset() { return OFFSET_OF(RawTwoByteString, data_); } | 5468 static intptr_t data_offset() { return OFFSET_OF(RawTwoByteString, data_); } |
5465 | 5469 |
5466 static intptr_t InstanceSize() { | 5470 static intptr_t InstanceSize() { |
5467 ASSERT(sizeof(RawTwoByteString) == OFFSET_OF(RawTwoByteString, data_)); | 5471 ASSERT(sizeof(RawTwoByteString) == OFFSET_OF(RawTwoByteString, data_)); |
(...skipping 1441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6909 | 6913 |
6910 | 6914 |
6911 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, | 6915 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, |
6912 intptr_t index) { | 6916 intptr_t index) { |
6913 return array.At((index * kEntryLength) + kTargetFunctionIndex); | 6917 return array.At((index * kEntryLength) + kTargetFunctionIndex); |
6914 } | 6918 } |
6915 | 6919 |
6916 } // namespace dart | 6920 } // namespace dart |
6917 | 6921 |
6918 #endif // VM_OBJECT_H_ | 6922 #endif // VM_OBJECT_H_ |
OLD | NEW |