| 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 4651 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4662 ASSERT((byte_offset >= 0) && (byte_offset < ByteLength())); | 4662 ASSERT((byte_offset >= 0) && (byte_offset < ByteLength())); |
| 4663 return reinterpret_cast<uint8_t*>(&raw_ptr()->data_) + byte_offset; | 4663 return reinterpret_cast<uint8_t*>(&raw_ptr()->data_) + byte_offset; |
| 4664 } | 4664 } |
| 4665 | 4665 |
| 4666 HEAP_OBJECT_IMPLEMENTATION(Uint8Array, ByteArray); | 4666 HEAP_OBJECT_IMPLEMENTATION(Uint8Array, ByteArray); |
| 4667 friend class ByteArray; | 4667 friend class ByteArray; |
| 4668 friend class Class; | 4668 friend class Class; |
| 4669 }; | 4669 }; |
| 4670 | 4670 |
| 4671 | 4671 |
| 4672 class Uint8ClampedArray : public Uint8Array { |
| 4673 public: |
| 4674 static RawUint8ClampedArray* New(intptr_t len, |
| 4675 Heap::Space space = Heap::kNew); |
| 4676 static RawUint8ClampedArray* New(const uint8_t* data, |
| 4677 intptr_t len, |
| 4678 Heap::Space space = Heap::kNew); |
| 4679 |
| 4680 private: |
| 4681 HEAP_OBJECT_IMPLEMENTATION(Uint8ClampedArray, Uint8Array); |
| 4682 friend class Class; |
| 4683 }; |
| 4684 |
| 4685 |
| 4672 class Int16Array : public ByteArray { | 4686 class Int16Array : public ByteArray { |
| 4673 public: | 4687 public: |
| 4674 intptr_t ByteLength() const { | 4688 intptr_t ByteLength() const { |
| 4675 return Length() * kBytesPerElement; | 4689 return Length() * kBytesPerElement; |
| 4676 } | 4690 } |
| 4677 | 4691 |
| 4678 int16_t At(intptr_t index) const { | 4692 int16_t At(intptr_t index) const { |
| 4679 ASSERT((index >= 0) && (index < Length())); | 4693 ASSERT((index >= 0) && (index < Length())); |
| 4680 return raw_ptr()->data_[index]; | 4694 return raw_ptr()->data_[index]; |
| 4681 } | 4695 } |
| (...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5199 raw_ptr()->external_data_ = data; | 5213 raw_ptr()->external_data_ = data; |
| 5200 } | 5214 } |
| 5201 | 5215 |
| 5202 HEAP_OBJECT_IMPLEMENTATION(ExternalUint8Array, ByteArray); | 5216 HEAP_OBJECT_IMPLEMENTATION(ExternalUint8Array, ByteArray); |
| 5203 friend class ByteArray; | 5217 friend class ByteArray; |
| 5204 friend class Class; | 5218 friend class Class; |
| 5205 friend class TokenStream; | 5219 friend class TokenStream; |
| 5206 }; | 5220 }; |
| 5207 | 5221 |
| 5208 | 5222 |
| 5223 class ExternalUint8ClampedArray : public ExternalUint8Array { |
| 5224 public: |
| 5225 static RawExternalUint8ClampedArray* New(uint8_t* data, |
| 5226 intptr_t len, |
| 5227 void* peer, |
| 5228 Dart_PeerFinalizer callback, |
| 5229 Heap::Space space = Heap::kNew); |
| 5230 |
| 5231 private: |
| 5232 HEAP_OBJECT_IMPLEMENTATION(ExternalUint8ClampedArray, ExternalUint8Array); |
| 5233 friend class Class; |
| 5234 }; |
| 5235 |
| 5236 |
| 5209 class ExternalInt16Array : public ByteArray { | 5237 class ExternalInt16Array : public ByteArray { |
| 5210 public: | 5238 public: |
| 5211 intptr_t ByteLength() const { | 5239 intptr_t ByteLength() const { |
| 5212 return Length() * kBytesPerElement; | 5240 return Length() * kBytesPerElement; |
| 5213 } | 5241 } |
| 5214 | 5242 |
| 5215 int16_t At(intptr_t index) const { | 5243 int16_t At(intptr_t index) const { |
| 5216 ASSERT((index >= 0) && (index < Length())); | 5244 ASSERT((index >= 0) && (index < Length())); |
| 5217 return raw_ptr()->external_data_->data()[index]; | 5245 return raw_ptr()->external_data_->data()[index]; |
| 5218 } | 5246 } |
| (...skipping 778 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5997 if (this->CharAt(i) != str.CharAt(begin_index + i)) { | 6025 if (this->CharAt(i) != str.CharAt(begin_index + i)) { |
| 5998 return false; | 6026 return false; |
| 5999 } | 6027 } |
| 6000 } | 6028 } |
| 6001 return true; | 6029 return true; |
| 6002 } | 6030 } |
| 6003 | 6031 |
| 6004 } // namespace dart | 6032 } // namespace dart |
| 6005 | 6033 |
| 6006 #endif // VM_OBJECT_H_ | 6034 #endif // VM_OBJECT_H_ |
| OLD | NEW |