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 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
365 Heap::Space space); | 365 Heap::Space space); |
366 | 366 |
367 static intptr_t RoundedAllocationSize(intptr_t size) { | 367 static intptr_t RoundedAllocationSize(intptr_t size) { |
368 return Utils::RoundUp(size, kObjectAlignment); | 368 return Utils::RoundUp(size, kObjectAlignment); |
369 } | 369 } |
370 | 370 |
371 template<typename type> void StorePointer(type* addr, type value) const { | 371 template<typename type> void StorePointer(type* addr, type value) const { |
372 // TODO(iposva): Implement real store barrier here. | 372 // TODO(iposva): Implement real store barrier here. |
373 *addr = value; | 373 *addr = value; |
374 // Filter stores based on source and target. | 374 // Filter stores based on source and target. |
| 375 if (!value->IsHeapObject()) return; |
375 if (value->IsNewObject() && raw()->IsOldObject()) { | 376 if (value->IsNewObject() && raw()->IsOldObject()) { |
376 uword ptr = reinterpret_cast<uword>(addr); | 377 uword ptr = reinterpret_cast<uword>(addr); |
377 Isolate::Current()->store_buffer()->AddPointer(ptr); | 378 Isolate::Current()->store_buffer()->AddPointer(ptr); |
378 } | 379 } |
379 } | 380 } |
380 | 381 |
381 RawObject* raw_; // The raw object reference. | 382 RawObject* raw_; // The raw object reference. |
382 | 383 |
383 private: | 384 private: |
384 static void InitializeObject(uword address, intptr_t id, intptr_t size); | 385 static void InitializeObject(uword address, intptr_t id, intptr_t size); |
(...skipping 2491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2876 // Number is an abstract class. | 2877 // Number is an abstract class. |
2877 UNREACHABLE(); | 2878 UNREACHABLE(); |
2878 return false; | 2879 return false; |
2879 } | 2880 } |
2880 OBJECT_IMPLEMENTATION(Number, Instance); | 2881 OBJECT_IMPLEMENTATION(Number, Instance); |
2881 }; | 2882 }; |
2882 | 2883 |
2883 | 2884 |
2884 class Integer : public Number { | 2885 class Integer : public Number { |
2885 public: | 2886 public: |
2886 static RawInteger* New(const String& str); | 2887 static RawInteger* New(const String& str, Heap::Space space = Heap::kNew); |
2887 static RawInteger* New(int64_t value); | 2888 static RawInteger* New(int64_t value, Heap::Space space = Heap::kNew); |
2888 | 2889 |
2889 virtual double AsDoubleValue() const; | 2890 virtual double AsDoubleValue() const; |
2890 virtual int64_t AsInt64Value() const; | 2891 virtual int64_t AsInt64Value() const; |
2891 | 2892 |
2892 // Returns 0, -1 or 1. | 2893 // Returns 0, -1 or 1. |
2893 virtual int CompareWith(const Integer& other) const; | 2894 virtual int CompareWith(const Integer& other) const; |
2894 | 2895 |
2895 OBJECT_IMPLEMENTATION(Integer, Number); | 2896 OBJECT_IMPLEMENTATION(Integer, Number); |
2896 }; | 2897 }; |
2897 | 2898 |
(...skipping 2193 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 |