Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(289)

Side by Side Diff: vm/object.h

Issue 8772061: First step towards generation of application script snapshots (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: '' Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « vm/dart_api_impl.cc ('k') | vm/raw_object.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 2460 matching lines...) Expand 10 before | Expand all | Expand 10 after
2572 2572
2573 void SetHash(intptr_t value) const { 2573 void SetHash(intptr_t value) const {
2574 // This is only safe because we create a new Smi, which does not cause 2574 // This is only safe because we create a new Smi, which does not cause
2575 // heap allocation. 2575 // heap allocation.
2576 raw_ptr()->hash_ = Smi::New(value); 2576 raw_ptr()->hash_ = Smi::New(value);
2577 } 2577 }
2578 2578
2579 template<typename HandleType, typename ElementType> 2579 template<typename HandleType, typename ElementType>
2580 static RawString* ReadFromImpl(SnapshotReader* reader, 2580 static RawString* ReadFromImpl(SnapshotReader* reader,
2581 intptr_t object_id, 2581 intptr_t object_id,
2582 bool classes_serialized); 2582 Snapshot::Kind kind);
2583 2583
2584 HEAP_OBJECT_IMPLEMENTATION(String, Instance); 2584 HEAP_OBJECT_IMPLEMENTATION(String, Instance);
2585 }; 2585 };
2586 2586
2587 2587
2588 class OneByteString : public String { 2588 class OneByteString : public String {
2589 public: 2589 public:
2590 virtual int32_t CharAt(intptr_t index) const { 2590 virtual int32_t CharAt(intptr_t index) const {
2591 return *CharAddr(index); 2591 return *CharAddr(index);
2592 } 2592 }
(...skipping 675 matching lines...) Expand 10 before | Expand all | Expand 10 after
3268 } 3268 }
3269 3269
3270 3270
3271 void Context::SetAt(intptr_t index, const Instance& value) const { 3271 void Context::SetAt(intptr_t index, const Instance& value) const {
3272 StorePointer(InstanceAddr(index), value.raw()); 3272 StorePointer(InstanceAddr(index), value.raw());
3273 } 3273 }
3274 3274
3275 } // namespace dart 3275 } // namespace dart
3276 3276
3277 #endif // VM_OBJECT_H_ 3277 #endif // VM_OBJECT_H_
OLDNEW
« no previous file with comments | « vm/dart_api_impl.cc ('k') | vm/raw_object.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698