Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(86)

Side by Side Diff: runtime/vm/object.h

Issue 11464011: Windows complains: (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | runtime/vm/raw_object.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 { 4672 class Uint8ClampedArray : public ByteArray {
4673 public: 4673 public:
4674 intptr_t ByteLength() const {
4675 return Length();
4676 }
4677
4678 uint8_t At(intptr_t index) const {
4679 ASSERT((index >= 0) && (index < Length()));
4680 return raw_ptr()->data_[index];
4681 }
4682
4683 void SetAt(intptr_t index, uint8_t value) const {
4684 ASSERT((index >= 0) && (index < Length()));
4685 raw_ptr()->data_[index] = value;
4686 }
4687
4688 static const intptr_t kBytesPerElement = 1;
4689 static const intptr_t kMaxElements = kSmiMax / kBytesPerElement;
4690
4691 static intptr_t data_offset() {
4692 return OFFSET_OF(RawUint8ClampedArray, data_);
4693 }
4694
4695 static intptr_t InstanceSize() {
4696 ASSERT(sizeof(RawUint8ClampedArray) ==
4697 OFFSET_OF(RawUint8ClampedArray, data_));
4698 return 0;
4699 }
4700
4701 static intptr_t InstanceSize(intptr_t len) {
4702 ASSERT(0 <= len && len <= kMaxElements);
4703 return RoundedAllocationSize(
4704 sizeof(RawUint8ClampedArray) + (len * kBytesPerElement));
4705 }
4706
4674 static RawUint8ClampedArray* New(intptr_t len, 4707 static RawUint8ClampedArray* New(intptr_t len,
4675 Heap::Space space = Heap::kNew); 4708 Heap::Space space = Heap::kNew);
4676 static RawUint8ClampedArray* New(const uint8_t* data, 4709 static RawUint8ClampedArray* New(const uint8_t* data,
4677 intptr_t len, 4710 intptr_t len,
4678 Heap::Space space = Heap::kNew); 4711 Heap::Space space = Heap::kNew);
4679 4712
4680 private: 4713 private:
4681 HEAP_OBJECT_IMPLEMENTATION(Uint8ClampedArray, Uint8Array); 4714 uint8_t* ByteAddr(intptr_t byte_offset) const {
4715 ASSERT((byte_offset >= 0) && (byte_offset < ByteLength()));
4716 return reinterpret_cast<uint8_t*>(&raw_ptr()->data_) + byte_offset;
4717 }
4718
4719 HEAP_OBJECT_IMPLEMENTATION(Uint8ClampedArray, ByteArray);
4720 friend class ByteArray;
4682 friend class Class; 4721 friend class Class;
4683 }; 4722 };
4684 4723
4685 4724
4686 class Int16Array : public ByteArray { 4725 class Int16Array : public ByteArray {
4687 public: 4726 public:
4688 intptr_t ByteLength() const { 4727 intptr_t ByteLength() const {
4689 return Length() * kBytesPerElement; 4728 return Length() * kBytesPerElement;
4690 } 4729 }
4691 4730
(...skipping 1333 matching lines...) Expand 10 before | Expand all | Expand 10 after
6025 if (this->CharAt(i) != str.CharAt(begin_index + i)) { 6064 if (this->CharAt(i) != str.CharAt(begin_index + i)) {
6026 return false; 6065 return false;
6027 } 6066 }
6028 } 6067 }
6029 return true; 6068 return true;
6030 } 6069 }
6031 6070
6032 } // namespace dart 6071 } // namespace dart
6033 6072
6034 #endif // VM_OBJECT_H_ 6073 #endif // VM_OBJECT_H_
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/raw_object.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698