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 6268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6279 } | 6279 } |
6280 | 6280 |
6281 static const int kDefaultInitialCapacity = 4; | 6281 static const int kDefaultInitialCapacity = 4; |
6282 | 6282 |
6283 FINAL_HEAP_OBJECT_IMPLEMENTATION(GrowableObjectArray, Instance); | 6283 FINAL_HEAP_OBJECT_IMPLEMENTATION(GrowableObjectArray, Instance); |
6284 friend class Array; | 6284 friend class Array; |
6285 friend class Class; | 6285 friend class Class; |
6286 }; | 6286 }; |
6287 | 6287 |
6288 | 6288 |
| 6289 // Corresponds to |
| 6290 // - "new Map()", |
| 6291 // - non-const map literals, and |
| 6292 // - the default constructor of LinkedHashMap in dart:collection. |
| 6293 class LinkedHashMap : public Instance { |
| 6294 public: |
| 6295 intptr_t Length() const; |
| 6296 RawObject* LookUp(const Object& key) const; |
| 6297 void InsertOrUpdate(const Object& key, const Object& value) const; |
| 6298 bool Contains(const Object& key) const; |
| 6299 RawObject* Remove(const Object& key) const; |
| 6300 void Clear() const; |
| 6301 // List of key, value pairs in iteration (i.e., key insertion) order. |
| 6302 RawArray* ToArray() const; |
| 6303 |
| 6304 static intptr_t InstanceSize() { |
| 6305 return RoundedAllocationSize(sizeof(RawLinkedHashMap)); |
| 6306 } |
| 6307 |
| 6308 static RawLinkedHashMap* New(Heap::Space space = Heap::kNew); |
| 6309 |
| 6310 virtual RawTypeArguments* GetTypeArguments() const { |
| 6311 return raw_ptr()->type_arguments_; |
| 6312 } |
| 6313 virtual void SetTypeArguments(const TypeArguments& value) const { |
| 6314 ASSERT(value.IsNull() || ((value.Length() >= 2) && value.IsInstantiated())); |
| 6315 StorePointer(&raw_ptr()->type_arguments_, value.raw()); |
| 6316 } |
| 6317 static intptr_t type_arguments_offset() { |
| 6318 return OFFSET_OF(RawLinkedHashMap, type_arguments_); |
| 6319 } |
| 6320 |
| 6321 // Called whenever the set of keys changes. |
| 6322 void SetModified() const; |
| 6323 RawInstance* GetModificationMark(bool create) const; |
| 6324 |
| 6325 private: |
| 6326 RawArray* data() const { return raw_ptr()->data_; } |
| 6327 void SetData(const Array& value) const { |
| 6328 StorePointer(&raw_ptr()->data_, value.raw()); |
| 6329 } |
| 6330 |
| 6331 FINAL_HEAP_OBJECT_IMPLEMENTATION(LinkedHashMap, Instance); |
| 6332 friend class Class; |
| 6333 }; |
| 6334 |
| 6335 |
6289 class Float32x4 : public Instance { | 6336 class Float32x4 : public Instance { |
6290 public: | 6337 public: |
6291 static RawFloat32x4* New(float value0, float value1, float value2, | 6338 static RawFloat32x4* New(float value0, float value1, float value2, |
6292 float value3, Heap::Space space = Heap::kNew); | 6339 float value3, Heap::Space space = Heap::kNew); |
6293 static RawFloat32x4* New(simd128_value_t value, | 6340 static RawFloat32x4* New(simd128_value_t value, |
6294 Heap::Space space = Heap::kNew); | 6341 Heap::Space space = Heap::kNew); |
6295 | 6342 |
6296 float x() const; | 6343 float x() const; |
6297 float y() const; | 6344 float y() const; |
6298 float z() const; | 6345 float z() const; |
(...skipping 937 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7236 | 7283 |
7237 | 7284 |
7238 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, | 7285 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, |
7239 intptr_t index) { | 7286 intptr_t index) { |
7240 return array.At((index * kEntryLength) + kTargetFunctionIndex); | 7287 return array.At((index * kEntryLength) + kTargetFunctionIndex); |
7241 } | 7288 } |
7242 | 7289 |
7243 } // namespace dart | 7290 } // namespace dart |
7244 | 7291 |
7245 #endif // VM_OBJECT_H_ | 7292 #endif // VM_OBJECT_H_ |
OLD | NEW |