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

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

Issue 11031063: Fix bug 5575: (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 2 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/object_store.cc ('k') | runtime/vm/snapshot_ids.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/exceptions.h" 10 #include "vm/exceptions.h"
(...skipping 18 matching lines...) Expand all
29 29
30 static bool IsObjectStoreClassId(intptr_t class_id) { 30 static bool IsObjectStoreClassId(intptr_t class_id) {
31 // Check if this is a class which is stored in the object store. 31 // Check if this is a class which is stored in the object store.
32 return (class_id == kObjectCid || 32 return (class_id == kObjectCid ||
33 (class_id >= kInstanceCid && class_id <= kWeakPropertyCid)); 33 (class_id >= kInstanceCid && class_id <= kWeakPropertyCid));
34 } 34 }
35 35
36 36
37 static bool IsObjectStoreTypeId(intptr_t index) { 37 static bool IsObjectStoreTypeId(intptr_t index) {
38 // Check if this is a type which is stored in the object store. 38 // Check if this is a type which is stored in the object store.
39 return (index >= kObjectType && index <= kByteArrayInterface); 39 return (index >= kObjectType && index <= kListInterface);
40 } 40 }
41 41
42 42
43 static intptr_t ClassIdFromObjectId(intptr_t object_id) { 43 static intptr_t ClassIdFromObjectId(intptr_t object_id) {
44 ASSERT(object_id > kClassIdsOffset); 44 ASSERT(object_id > kClassIdsOffset);
45 intptr_t class_id = (object_id - kClassIdsOffset); 45 intptr_t class_id = (object_id - kClassIdsOffset);
46 return class_id; 46 return class_id;
47 } 47 }
48 48
49 49
(...skipping 11 matching lines...) Expand all
61 case kVoidType: return object_store->void_type(); 61 case kVoidType: return object_store->void_type();
62 case kFunctionType: return object_store->function_type(); 62 case kFunctionType: return object_store->function_type();
63 case kNumberType: return object_store->number_type(); 63 case kNumberType: return object_store->number_type();
64 case kSmiType: return object_store->smi_type(); 64 case kSmiType: return object_store->smi_type();
65 case kMintType: return object_store->mint_type(); 65 case kMintType: return object_store->mint_type();
66 case kDoubleType: return object_store->double_type(); 66 case kDoubleType: return object_store->double_type();
67 case kIntType: return object_store->int_type(); 67 case kIntType: return object_store->int_type();
68 case kBoolType: return object_store->bool_type(); 68 case kBoolType: return object_store->bool_type();
69 case kStringInterface: return object_store->string_interface(); 69 case kStringInterface: return object_store->string_interface();
70 case kListInterface: return object_store->list_interface(); 70 case kListInterface: return object_store->list_interface();
71 case kByteArrayInterface: return object_store->byte_array_interface();
72 default: break; 71 default: break;
73 } 72 }
74 UNREACHABLE(); 73 UNREACHABLE();
75 return Type::null(); 74 return Type::null();
76 } 75 }
77 76
78 77
79 static int GetTypeIndex(ObjectStore* object_store, const RawType* raw_type) { 78 static int GetTypeIndex(ObjectStore* object_store, const RawType* raw_type) {
80 ASSERT(raw_type->IsHeapObject()); 79 ASSERT(raw_type->IsHeapObject());
81 if (raw_type == object_store->object_type()) { 80 if (raw_type == object_store->object_type()) {
(...skipping 15 matching lines...) Expand all
97 } else if (raw_type == object_store->double_type()) { 96 } else if (raw_type == object_store->double_type()) {
98 return kDoubleType; 97 return kDoubleType;
99 } else if (raw_type == object_store->int_type()) { 98 } else if (raw_type == object_store->int_type()) {
100 return kIntType; 99 return kIntType;
101 } else if (raw_type == object_store->bool_type()) { 100 } else if (raw_type == object_store->bool_type()) {
102 return kBoolType; 101 return kBoolType;
103 } else if (raw_type == object_store->string_interface()) { 102 } else if (raw_type == object_store->string_interface()) {
104 return kStringInterface; 103 return kStringInterface;
105 } else if (raw_type == object_store->list_interface()) { 104 } else if (raw_type == object_store->list_interface()) {
106 return kListInterface; 105 return kListInterface;
107 } else if (raw_type == object_store->byte_array_interface()) {
108 return kByteArrayInterface;
109 } 106 }
110 return kInvalidIndex; 107 return kInvalidIndex;
111 } 108 }
112 109
113 110
114 // TODO(5411462): Temporary setup of snapshot for testing purposes, 111 // TODO(5411462): Temporary setup of snapshot for testing purposes,
115 // the actual creation of a snapshot maybe done differently. 112 // the actual creation of a snapshot maybe done differently.
116 const Snapshot* Snapshot::SetupFromBuffer(const void* raw_memory) { 113 const Snapshot* Snapshot::SetupFromBuffer(const void* raw_memory) {
117 ASSERT(raw_memory != NULL); 114 ASSERT(raw_memory != NULL);
118 ASSERT(kHeaderSize == sizeof(Snapshot)); 115 ASSERT(kHeaderSize == sizeof(Snapshot));
(...skipping 1066 matching lines...) Expand 10 before | Expand all | Expand 10 after
1185 1182
1186 1183
1187 void MessageWriter::WriteMessage(const Object& obj) { 1184 void MessageWriter::WriteMessage(const Object& obj) {
1188 ASSERT(kind() == Snapshot::kMessage); 1185 ASSERT(kind() == Snapshot::kMessage);
1189 WriteObject(obj.raw()); 1186 WriteObject(obj.raw());
1190 UnmarkAll(); 1187 UnmarkAll();
1191 } 1188 }
1192 1189
1193 1190
1194 } // namespace dart 1191 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/object_store.cc ('k') | runtime/vm/snapshot_ids.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698