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

Unified Diff: runtime/vm/object.cc

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/object.h ('k') | runtime/vm/raw_object.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/object.cc
===================================================================
--- runtime/vm/object.cc (revision 23883)
+++ runtime/vm/object.cc (working copy)
@@ -530,7 +530,7 @@
cls = Class::New<Array>();
isolate->object_store()->set_array_class(cls);
cls.set_type_arguments_field_offset(Array::type_arguments_offset());
- cls = Class::New<ImmutableArray>();
+ cls = Class::New<Array>(kImmutableArrayCid);
isolate->object_store()->set_immutable_array_class(cls);
cls.set_type_arguments_field_offset(Array::type_arguments_offset());
cls = Class::NewStringClass(kOneByteStringCid);
@@ -832,10 +832,11 @@
RegisterPrivateClass(cls, Symbols::GrowableObjectArray(), core_lib);
pending_classes.Add(cls, Heap::kOld);
- cls = Class::New<ImmutableArray>();
+ cls = Class::New<Array>(kImmutableArrayCid);
object_store->set_immutable_array_class(cls);
cls.set_type_arguments_field_offset(Array::type_arguments_offset());
ASSERT(object_store->immutable_array_class() != object_store->array_class());
+ cls.set_is_prefinalized();
RegisterPrivateClass(cls, Symbols::ImmutableArray(), core_lib);
pending_classes.Add(cls, Heap::kOld);
@@ -1120,7 +1121,7 @@
cls = Class::New<Array>();
object_store->set_array_class(cls);
- cls = Class::New<ImmutableArray>();
+ cls = Class::New<Array>(kImmutableArrayCid);
object_store->set_immutable_array_class(cls);
cls = Class::New<GrowableObjectArray>();
@@ -12542,9 +12543,10 @@
const char* Array::ToCString() const {
if (IsNull()) {
- return "Array NULL";
+ return IsImmutable() ? "ImmutableArray NULL" : "Array NULL";
}
- const char* format = "Array len:%"Pd"";
+ const char* format = !IsImmutable() ? "Array len:%"Pd"" :
+ "Immutable Array len:%"Pd"";
intptr_t len = OS::SNPrint(NULL, 0, format, Length()) + 1;
char* chars = Isolate::Current()->current_zone()->Alloc<char>(len);
OS::SNPrint(chars, len, format, Length());
@@ -12612,18 +12614,6 @@
}
-const char* ImmutableArray::ToCString() const {
- if (IsNull()) {
- return "ImmutableArray NULL";
- }
- const char* format = "ImmutableArray len:%"Pd"";
- intptr_t len = OS::SNPrint(NULL, 0, format, Length()) + 1;
- char* chars = Isolate::Current()->current_zone()->Alloc<char>(len);
- OS::SNPrint(chars, len, format, Length());
- return chars;
-}
-
-
void GrowableObjectArray::Add(const Object& value, Heap::Space space) const {
ASSERT(!IsNull());
if (Length() == Capacity()) {
« no previous file with comments | « runtime/vm/object.h ('k') | runtime/vm/raw_object.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698