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

Unified Diff: vm/object.cc

Issue 9139067: Use special allocation functions for object creation while deserializing from a full snapshot in ... (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: '' Created 8 years, 11 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 | « vm/object.h ('k') | vm/raw_object.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: vm/object.cc
===================================================================
--- vm/object.cc (revision 3378)
+++ vm/object.cc (working copy)
@@ -2667,9 +2667,6 @@
result ^= raw;
// Length must be set before we start storing into the array.
result.SetLength(len);
- for (intptr_t i = 0; i < len; i++) {
- *result.TypeAddr(i) = Type::null();
- }
}
return result.raw();
}
@@ -7198,20 +7195,19 @@
}
-RawArray* Array::New(word len, bool immutable, Heap::Space space) {
+RawArray* Array::New(intptr_t len, Heap::Space space) {
+ ObjectStore* object_store = Isolate::Current()->object_store();
+ Class& cls = Class::Handle(object_store->array_class());
+ return New(cls, len, space);
+}
+
+
+RawArray* Array::New(const Class& cls, intptr_t len, Heap::Space space) {
if ((len < 0) || (len > kMaxArrayElements)) {
// TODO(iposva): Should we throw an illegal parameter exception?
UNIMPLEMENTED();
return null();
}
-
- Isolate* isolate = Isolate::Current();
- Class& cls = Class::Handle();
- if (immutable) {
- cls = isolate->object_store()->immutable_array_class();
- } else {
- cls = isolate->object_store()->array_class();
- }
Array& result = Array::Handle();
{
RawObject* raw = Object::Allocate(cls,
@@ -7255,6 +7251,14 @@
}
+RawImmutableArray* ImmutableArray::New(intptr_t len,
+ Heap::Space space) {
+ ObjectStore* object_store = Isolate::Current()->object_store();
+ Class& cls = Class::Handle(object_store->immutable_array_class());
+ return reinterpret_cast<RawImmutableArray*>(Array::New(cls, len, space));
+}
+
+
const char* ImmutableArray::ToCString() const {
return "ImmutableArray";
}
« no previous file with comments | « vm/object.h ('k') | vm/raw_object.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698