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 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
368 Heap::Space space); | 368 Heap::Space space); |
369 | 369 |
370 static intptr_t RoundedAllocationSize(intptr_t size) { | 370 static intptr_t RoundedAllocationSize(intptr_t size) { |
371 return Utils::RoundUp(size, kObjectAlignment); | 371 return Utils::RoundUp(size, kObjectAlignment); |
372 } | 372 } |
373 | 373 |
374 template<typename type> void StorePointer(type* addr, type value) const { | 374 template<typename type> void StorePointer(type* addr, type value) const { |
375 // TODO(iposva): Implement real store barrier here. | 375 // TODO(iposva): Implement real store barrier here. |
376 *addr = value; | 376 *addr = value; |
377 // Filter stores based on source and target. | 377 // Filter stores based on source and target. |
| 378 if (!value->IsHeapObject()) return; |
378 if (value->IsNewObject() && raw()->IsOldObject()) { | 379 if (value->IsNewObject() && raw()->IsOldObject()) { |
379 uword ptr = reinterpret_cast<uword>(addr); | 380 uword ptr = reinterpret_cast<uword>(addr); |
380 Isolate::Current()->store_buffer()->AddPointer(ptr); | 381 Isolate::Current()->store_buffer()->AddPointer(ptr); |
381 } | 382 } |
382 } | 383 } |
383 | 384 |
384 RawObject* raw_; // The raw object reference. | 385 RawObject* raw_; // The raw object reference. |
385 | 386 |
386 private: | 387 private: |
387 static void InitializeObject(uword address, intptr_t id, intptr_t size); | 388 static void InitializeObject(uword address, intptr_t id, intptr_t size); |
(...skipping 2491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2879 // Number is an abstract class. | 2880 // Number is an abstract class. |
2880 UNREACHABLE(); | 2881 UNREACHABLE(); |
2881 return false; | 2882 return false; |
2882 } | 2883 } |
2883 OBJECT_IMPLEMENTATION(Number, Instance); | 2884 OBJECT_IMPLEMENTATION(Number, Instance); |
2884 }; | 2885 }; |
2885 | 2886 |
2886 | 2887 |
2887 class Integer : public Number { | 2888 class Integer : public Number { |
2888 public: | 2889 public: |
2889 static RawInteger* New(const String& str); | 2890 static RawInteger* New(const String& str, Heap::Space space = Heap::kNew); |
2890 static RawInteger* New(int64_t value); | 2891 static RawInteger* New(int64_t value, Heap::Space space = Heap::kNew); |
2891 | 2892 |
2892 virtual double AsDoubleValue() const; | 2893 virtual double AsDoubleValue() const; |
2893 virtual int64_t AsInt64Value() const; | 2894 virtual int64_t AsInt64Value() const; |
2894 | 2895 |
2895 // Returns 0, -1 or 1. | 2896 // Returns 0, -1 or 1. |
2896 virtual int CompareWith(const Integer& other) const; | 2897 virtual int CompareWith(const Integer& other) const; |
2897 | 2898 |
2898 OBJECT_IMPLEMENTATION(Integer, Number); | 2899 OBJECT_IMPLEMENTATION(Integer, Number); |
2899 }; | 2900 }; |
2900 | 2901 |
(...skipping 2190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5091 } | 5092 } |
5092 | 5093 |
5093 | 5094 |
5094 intptr_t Stackmap::SizeInBits() const { | 5095 intptr_t Stackmap::SizeInBits() const { |
5095 return (Smi::Value(raw_ptr()->bitmap_size_in_bytes_) * kBitsPerByte); | 5096 return (Smi::Value(raw_ptr()->bitmap_size_in_bytes_) * kBitsPerByte); |
5096 } | 5097 } |
5097 | 5098 |
5098 } // namespace dart | 5099 } // namespace dart |
5099 | 5100 |
5100 #endif // VM_OBJECT_H_ | 5101 #endif // VM_OBJECT_H_ |
OLD | NEW |