| 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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 static void initializeHandle(object* obj, RawObject* raw_ptr) { \ | 120 static void initializeHandle(object* obj, RawObject* raw_ptr) { \ |
| 121 if (raw_ptr != Object::null()) { \ | 121 if (raw_ptr != Object::null()) { \ |
| 122 obj->SetRaw(raw_ptr); \ | 122 obj->SetRaw(raw_ptr); \ |
| 123 } else { \ | 123 } else { \ |
| 124 obj->raw_ = Object::null(); \ | 124 obj->raw_ = Object::null(); \ |
| 125 object fake_object; \ | 125 object fake_object; \ |
| 126 obj->set_vtable(fake_object.vtable()); \ | 126 obj->set_vtable(fake_object.vtable()); \ |
| 127 } \ | 127 } \ |
| 128 } \ | 128 } \ |
| 129 /* Disallow allocation, copy constructors and override super assignment. */ \ | 129 /* Disallow allocation, copy constructors and override super assignment. */ \ |
| 130 public: /* NOLINT */ \ |
| 131 void operator delete(void* pointer) { \ |
| 132 UNREACHABLE(); \ |
| 133 } \ |
| 134 private: /* NOLINT */ \ |
| 130 void* operator new(size_t size); \ | 135 void* operator new(size_t size); \ |
| 131 object(const object& value); \ | 136 object(const object& value); \ |
| 132 void operator=(Raw##super* value); \ | 137 void operator=(Raw##super* value); \ |
| 133 void operator=(const object& value); \ | 138 void operator=(const object& value); \ |
| 134 void operator=(const super& value); \ | 139 void operator=(const super& value); \ |
| 135 | 140 |
| 136 #define SNAPSHOT_READER_SUPPORT(object) \ | 141 #define SNAPSHOT_READER_SUPPORT(object) \ |
| 137 static Raw##object* ReadFrom(SnapshotReader* reader, \ | 142 static Raw##object* ReadFrom(SnapshotReader* reader, \ |
| 138 intptr_t object_id, \ | 143 intptr_t object_id, \ |
| 139 intptr_t tags, \ | 144 intptr_t tags, \ |
| (...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 518 | 523 |
| 519 friend void ClassTable::Register(const Class& cls); | 524 friend void ClassTable::Register(const Class& cls); |
| 520 friend void RawObject::Validate(Isolate* isolate) const; | 525 friend void RawObject::Validate(Isolate* isolate) const; |
| 521 friend class Closure; | 526 friend class Closure; |
| 522 friend class SnapshotReader; | 527 friend class SnapshotReader; |
| 523 friend class OneByteString; | 528 friend class OneByteString; |
| 524 friend class TwoByteString; | 529 friend class TwoByteString; |
| 525 friend class ExternalOneByteString; | 530 friend class ExternalOneByteString; |
| 526 friend class ExternalTwoByteString; | 531 friend class ExternalTwoByteString; |
| 527 | 532 |
| 528 // Disallow allocation. | 533 DISALLOW_ALLOCATION(); |
| 529 void* operator new(size_t size); | |
| 530 // Disallow copy constructor. | |
| 531 DISALLOW_COPY_AND_ASSIGN(Object); | 534 DISALLOW_COPY_AND_ASSIGN(Object); |
| 532 }; | 535 }; |
| 533 | 536 |
| 534 | 537 |
| 535 class Class : public Object { | 538 class Class : public Object { |
| 536 public: | 539 public: |
| 537 intptr_t instance_size() const { | 540 intptr_t instance_size() const { |
| 538 ASSERT(is_finalized() || is_prefinalized()); | 541 ASSERT(is_finalized() || is_prefinalized()); |
| 539 return (raw_ptr()->instance_size_in_words_ * kWordSize); | 542 return (raw_ptr()->instance_size_in_words_ * kWordSize); |
| 540 } | 543 } |
| (...skipping 5121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5662 | 5665 |
| 5663 | 5666 |
| 5664 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, | 5667 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, |
| 5665 intptr_t index) { | 5668 intptr_t index) { |
| 5666 return array.At((index * kEntryLength) + kTargetFunctionIndex); | 5669 return array.At((index * kEntryLength) + kTargetFunctionIndex); |
| 5667 } | 5670 } |
| 5668 | 5671 |
| 5669 } // namespace dart | 5672 } // namespace dart |
| 5670 | 5673 |
| 5671 #endif // VM_OBJECT_H_ | 5674 #endif // VM_OBJECT_H_ |
| OLD | NEW |