Chromium Code Reviews| 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 5139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5150 static const intptr_t kBytesPerElement = 1; | 5150 static const intptr_t kBytesPerElement = 1; |
| 5151 | 5151 |
| 5152 // Since external arrays may be serialized to non-external ones, | 5152 // Since external arrays may be serialized to non-external ones, |
| 5153 // enforce the same maximum element count. | 5153 // enforce the same maximum element count. |
| 5154 static const intptr_t kMaxElements = Uint8Array::kMaxElements; | 5154 static const intptr_t kMaxElements = Uint8Array::kMaxElements; |
| 5155 | 5155 |
| 5156 static intptr_t InstanceSize() { | 5156 static intptr_t InstanceSize() { |
| 5157 return RoundedAllocationSize(sizeof(RawExternalUint8Array)); | 5157 return RoundedAllocationSize(sizeof(RawExternalUint8Array)); |
| 5158 } | 5158 } |
| 5159 | 5159 |
| 5160 static intptr_t external_data_offset() { | |
| 5161 return length_offset() + kWordSize; | |
|
Florian Schneider
2012/11/21 15:15:17
Maybe instead use OFFSET_OF here as well?
Mads Ager (google)
2012/11/21 15:31:34
Done for all of these.
| |
| 5162 } | |
| 5163 | |
| 5160 static RawExternalUint8Array* New(uint8_t* data, | 5164 static RawExternalUint8Array* New(uint8_t* data, |
| 5161 intptr_t len, | 5165 intptr_t len, |
| 5162 void* peer, | 5166 void* peer, |
| 5163 Dart_PeerFinalizer callback, | 5167 Dart_PeerFinalizer callback, |
| 5164 Heap::Space space = Heap::kNew); | 5168 Heap::Space space = Heap::kNew); |
| 5165 | 5169 |
| 5166 private: | 5170 private: |
| 5167 uint8_t* ByteAddr(intptr_t byte_offset) const { | 5171 uint8_t* ByteAddr(intptr_t byte_offset) const { |
| 5168 ASSERT((byte_offset >= 0) && (byte_offset < ByteLength())); | 5172 ASSERT((byte_offset >= 0) && (byte_offset < ByteLength())); |
| 5169 uint8_t* data = | 5173 uint8_t* data = |
| (...skipping 801 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5971 if (this->CharAt(i) != str.CharAt(begin_index + i)) { | 5975 if (this->CharAt(i) != str.CharAt(begin_index + i)) { |
| 5972 return false; | 5976 return false; |
| 5973 } | 5977 } |
| 5974 } | 5978 } |
| 5975 return true; | 5979 return true; |
| 5976 } | 5980 } |
| 5977 | 5981 |
| 5978 } // namespace dart | 5982 } // namespace dart |
| 5979 | 5983 |
| 5980 #endif // VM_OBJECT_H_ | 5984 #endif // VM_OBJECT_H_ |
| OLD | NEW |