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

Unified Diff: runtime/vm/object.h

Issue 16390002: Make ImmutableArray a sub class of AllStatic. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 6 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/dart_api_impl.cc ('k') | runtime/vm/object.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/object.h
===================================================================
--- runtime/vm/object.h (revision 23883)
+++ runtime/vm/object.h (working copy)
@@ -4932,6 +4932,10 @@
StorePointer(ObjectAddr(index), value.raw());
}
+ bool IsImmutable() const {
+ return raw()->GetClassId() == kImmutableArrayCid;
+ }
+
virtual RawAbstractTypeArguments* GetTypeArguments() const {
return raw_ptr()->type_arguments_;
}
@@ -5005,19 +5009,38 @@
raw_ptr()->length_ = Smi::New(value);
}
- HEAP_OBJECT_IMPLEMENTATION(Array, Instance);
+ FINAL_HEAP_OBJECT_IMPLEMENTATION(Array, Instance);
friend class Class;
+ friend class ImmutableArray;
friend class Object;
friend class String;
};
-class ImmutableArray : public Array {
+class ImmutableArray : public AllStatic {
public:
static RawImmutableArray* New(intptr_t len, Heap::Space space = Heap::kNew);
+ static RawImmutableArray* ReadFrom(SnapshotReader* reader,
+ intptr_t object_id,
+ intptr_t tags,
+ Snapshot::Kind kind);
+
+ static const ClassId kClassId = kImmutableArrayCid;
+
+ static intptr_t InstanceSize() {
+ return Array::InstanceSize();
+ }
+
+ static intptr_t InstanceSize(intptr_t len) {
+ return Array::InstanceSize(len);
+ }
+
private:
- FINAL_HEAP_OBJECT_IMPLEMENTATION(ImmutableArray, Array);
+ static RawImmutableArray* raw(const Array& array) {
+ return reinterpret_cast<RawImmutableArray*>(array.raw());
+ }
+
friend class Class;
};
« no previous file with comments | « runtime/vm/dart_api_impl.cc ('k') | runtime/vm/object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698