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

Side by Side Diff: runtime/vm/snapshot.cc

Issue 392043003: The dart version of typeddata library has changed to be compatible with the dart2js implementation (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 5 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/vm/raw_object.cc ('k') | runtime/vm/symbols.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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 #include "vm/snapshot.h" 5 #include "vm/snapshot.h"
6 6
7 #include "platform/assert.h" 7 #include "platform/assert.h"
8 #include "vm/bigint_operations.h" 8 #include "vm/bigint_operations.h"
9 #include "vm/bootstrap.h" 9 #include "vm/bootstrap.h"
10 #include "vm/class_finalizer.h" 10 #include "vm/class_finalizer.h"
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 49
50 static intptr_t ClassIdFromObjectId(intptr_t object_id) { 50 static intptr_t ClassIdFromObjectId(intptr_t object_id) {
51 ASSERT(object_id > kClassIdsOffset); 51 ASSERT(object_id > kClassIdsOffset);
52 intptr_t class_id = (object_id - kClassIdsOffset); 52 intptr_t class_id = (object_id - kClassIdsOffset);
53 return class_id; 53 return class_id;
54 } 54 }
55 55
56 56
57 static intptr_t ObjectIdFromClassId(intptr_t class_id) { 57 static intptr_t ObjectIdFromClassId(intptr_t class_id) {
58 ASSERT((class_id > kIllegalCid) && (class_id < kNumPredefinedCids)); 58 ASSERT((class_id > kIllegalCid) && (class_id < kNumPredefinedCids));
59 ASSERT(!RawObject::IsTypedDataViewClassId(class_id)); 59 ASSERT(!(RawObject::IsTypedDataViewClassId(class_id) ||
60 (class_id == kByteBufferCid)));
Cutch 2014/07/16 21:34:33 Maybe factor these "== kByteBufferCid" into a stat
siva 2014/07/17 21:36:55 Done.
60 return (class_id + kClassIdsOffset); 61 return (class_id + kClassIdsOffset);
61 } 62 }
62 63
63 64
64 static RawType* GetType(ObjectStore* object_store, intptr_t index) { 65 static RawType* GetType(ObjectStore* object_store, intptr_t index) {
65 switch (index) { 66 switch (index) {
66 case kObjectType: return object_store->object_type(); 67 case kObjectType: return object_store->object_type();
67 case kNullType: return object_store->null_type(); 68 case kNullType: return object_store->null_type();
68 case kFunctionType: return object_store->function_type(); 69 case kFunctionType: return object_store->function_type();
69 case kNumberType: return object_store->number_type(); 70 case kNumberType: return object_store->number_type();
(...skipping 1005 matching lines...) Expand 10 before | Expand all | Expand 10 after
1075 WriteInlinedObjectHeader(object_id); 1076 WriteInlinedObjectHeader(object_id);
1076 1077
1077 // Write out the class information. 1078 // Write out the class information.
1078 WriteIndexedObject(kImmutableArrayCid); 1079 WriteIndexedObject(kImmutableArrayCid);
1079 1080
1080 // Write out the length field. 1081 // Write out the length field.
1081 Write<RawObject*>(rawarray->ptr()->length_); 1082 Write<RawObject*>(rawarray->ptr()->length_);
1082 1083
1083 return; 1084 return;
1084 } 1085 }
1085 if (RawObject::IsTypedDataViewClassId(class_id)) { 1086 if (RawObject::IsTypedDataViewClassId(class_id) ||
1087 (class_id == kByteBufferCid)) {
Cutch 2014/07/16 21:34:33 Maybe factor these "== kByteBufferCid" into a stat
siva 2014/07/17 21:36:55 Done.
1086 WriteInstanceRef(raw, cls); 1088 WriteInstanceRef(raw, cls);
1087 return; 1089 return;
1088 } 1090 }
1089 // Object is being referenced, add it to the forward ref list and mark 1091 // Object is being referenced, add it to the forward ref list and mark
1090 // it so that future references to this object in the snapshot will use 1092 // it so that future references to this object in the snapshot will use
1091 // this object id. Mark it as not having been serialized yet so that we 1093 // this object id. Mark it as not having been serialized yet so that we
1092 // will serialize the object when we go through the forward list. 1094 // will serialize the object when we go through the forward list.
1093 intptr_t object_id = forward_list_.MarkAndAddObject(raw, kIsSerialized); 1095 intptr_t object_id = forward_list_.MarkAndAddObject(raw, kIsSerialized);
1094 switch (class_id) { 1096 switch (class_id) {
1095 #define SNAPSHOT_WRITE(clazz) \ 1097 #define SNAPSHOT_WRITE(clazz) \
(...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after
1605 NoGCScope no_gc; 1607 NoGCScope no_gc;
1606 WriteObject(obj.raw()); 1608 WriteObject(obj.raw());
1607 UnmarkAll(); 1609 UnmarkAll();
1608 } else { 1610 } else {
1609 ThrowException(exception_type(), exception_msg()); 1611 ThrowException(exception_type(), exception_msg());
1610 } 1612 }
1611 } 1613 }
1612 1614
1613 1615
1614 } // namespace dart 1616 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/raw_object.cc ('k') | runtime/vm/symbols.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698