Fix issue with serializing typed array views

This makes the code

void isolate() {
  port.receive(print);
}

main() {
  Uint8List list = new Uint8List(1);
  spawnFunction(isolate).send([1, new Uint8List.view(list.buffer, 0, 1)]);
}

not crash.

R=asiva@google.com

BUG=

Review URL: https://codereview.chromium.org//13866012

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@21200 260f80e4-7a28-3924-810f-c04153c831b5
This commit is contained in:
sgjesse@google.com 2013-04-10 13:41:32 +00:00
parent 7c56d46086
commit 6082783a04

View file

@ -980,6 +980,10 @@ void SnapshotWriter::WriteObjectRef(RawObject* raw) {
return; return;
} }
if (RawObject::IsTypedDataViewClassId(class_id)) {
WriteInstanceRef(raw, cls);
return;
}
// Object is being referenced, add it to the forward ref list and mark // Object is being referenced, add it to the forward ref list and mark
// it so that future references to this object in the snapshot will use // it so that future references to this object in the snapshot will use
// this object id. Mark it as not having been serialized yet so that we // this object id. Mark it as not having been serialized yet so that we
@ -1013,15 +1017,6 @@ void SnapshotWriter::WriteObjectRef(RawObject* raw) {
raw_obj->WriteTo(this, object_id, kind_); raw_obj->WriteTo(this, object_id, kind_);
return; return;
} }
#undef SNAPSHOT_WRITE
#define SNAPSHOT_WRITE(clazz) \
case kTypedData##clazz##ViewCid: \
CLASS_LIST_TYPED_DATA(SNAPSHOT_WRITE)
case kByteDataViewCid: {
WriteInstanceRef(raw, cls);
return;
}
#undef SNAPSHOT_WRITE #undef SNAPSHOT_WRITE
default: break; default: break;
} }
@ -1088,6 +1083,7 @@ intptr_t SnapshotWriter::MarkObject(RawObject* raw, SerializeState state) {
value = SerializedHeaderTag::update(kObjectId, value); value = SerializedHeaderTag::update(kObjectId, value);
value = SerializedHeaderData::update(object_id, value); value = SerializedHeaderData::update(object_id, value);
uword tags = raw->ptr()->tags_; uword tags = raw->ptr()->tags_;
ASSERT(SerializedHeaderTag::decode(tags) != kObjectId);
raw->ptr()->tags_ = value; raw->ptr()->tags_ = value;
ForwardObjectNode* node = new ForwardObjectNode(raw, tags, state); ForwardObjectNode* node = new ForwardObjectNode(raw, tags, state);
ASSERT(node != NULL); ASSERT(node != NULL);