| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 "vm/assert.h" | 8 #include "vm/assert.h" |
| 9 #include "vm/dart.h" | 9 #include "vm/dart.h" |
| 10 #include "vm/globals.h" | 10 #include "vm/globals.h" |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 } \ | 91 } \ |
| 92 /* Disallow allocation, copy constructors and override super assignment. */ \ | 92 /* Disallow allocation, copy constructors and override super assignment. */ \ |
| 93 void* operator new(size_t size); \ | 93 void* operator new(size_t size); \ |
| 94 object(const object& value); \ | 94 object(const object& value); \ |
| 95 void operator=(Raw##super* value); \ | 95 void operator=(Raw##super* value); \ |
| 96 void operator=(const object& value); \ | 96 void operator=(const object& value); \ |
| 97 void operator=(const super& value); \ | 97 void operator=(const super& value); \ |
| 98 | 98 |
| 99 #define SNAPSHOT_READER_SUPPORT(object) \ | 99 #define SNAPSHOT_READER_SUPPORT(object) \ |
| 100 static Raw##object* ReadFrom( \ | 100 static Raw##object* ReadFrom( \ |
| 101 SnapshotReader* reader, intptr_t object_id, bool classes_serialized); \ | 101 SnapshotReader* reader, intptr_t object_id, Snapshot::Kind); \ |
| 102 friend class SnapshotReader; \ | 102 friend class SnapshotReader; \ |
| 103 | 103 |
| 104 #define HEAP_OBJECT_IMPLEMENTATION(object, super) \ | 104 #define HEAP_OBJECT_IMPLEMENTATION(object, super) \ |
| 105 OBJECT_IMPLEMENTATION(object, super); \ | 105 OBJECT_IMPLEMENTATION(object, super); \ |
| 106 Raw##object* raw_ptr() const { \ | 106 Raw##object* raw_ptr() const { \ |
| 107 ASSERT(raw() != null()); \ | 107 ASSERT(raw() != null()); \ |
| 108 return raw()->ptr(); \ | 108 return raw()->ptr(); \ |
| 109 } \ | 109 } \ |
| 110 SNAPSHOT_READER_SUPPORT(object) \ | 110 SNAPSHOT_READER_SUPPORT(object) \ |
| 111 | 111 |
| (...skipping 2454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2566 | 2566 |
| 2567 void SetHash(intptr_t value) const { | 2567 void SetHash(intptr_t value) const { |
| 2568 // This is only safe because we create a new Smi, which does not cause | 2568 // This is only safe because we create a new Smi, which does not cause |
| 2569 // heap allocation. | 2569 // heap allocation. |
| 2570 raw_ptr()->hash_ = Smi::New(value); | 2570 raw_ptr()->hash_ = Smi::New(value); |
| 2571 } | 2571 } |
| 2572 | 2572 |
| 2573 template<typename HandleType, typename ElementType> | 2573 template<typename HandleType, typename ElementType> |
| 2574 static RawString* ReadFromImpl(SnapshotReader* reader, | 2574 static RawString* ReadFromImpl(SnapshotReader* reader, |
| 2575 intptr_t object_id, | 2575 intptr_t object_id, |
| 2576 bool classes_serialized); | 2576 Snapshot::Kind kind); |
| 2577 | 2577 |
| 2578 HEAP_OBJECT_IMPLEMENTATION(String, Instance); | 2578 HEAP_OBJECT_IMPLEMENTATION(String, Instance); |
| 2579 }; | 2579 }; |
| 2580 | 2580 |
| 2581 | 2581 |
| 2582 class OneByteString : public String { | 2582 class OneByteString : public String { |
| 2583 public: | 2583 public: |
| 2584 virtual int32_t CharAt(intptr_t index) const { | 2584 virtual int32_t CharAt(intptr_t index) const { |
| 2585 return *CharAddr(index); | 2585 return *CharAddr(index); |
| 2586 } | 2586 } |
| (...skipping 660 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3247 } | 3247 } |
| 3248 | 3248 |
| 3249 | 3249 |
| 3250 void Context::SetAt(intptr_t index, const Instance& value) const { | 3250 void Context::SetAt(intptr_t index, const Instance& value) const { |
| 3251 StorePointer(InstanceAddr(index), value.raw()); | 3251 StorePointer(InstanceAddr(index), value.raw()); |
| 3252 } | 3252 } |
| 3253 | 3253 |
| 3254 } // namespace dart | 3254 } // namespace dart |
| 3255 | 3255 |
| 3256 #endif // VM_OBJECT_H_ | 3256 #endif // VM_OBJECT_H_ |
| OLD | NEW |