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

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

Issue 11299020: Make creation of list literal more resilient to changes in the underlying (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 1 month 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
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 20 matching lines...) Expand all
31 static bool IsObjectStoreClassId(intptr_t class_id) { 31 static bool IsObjectStoreClassId(intptr_t class_id) {
32 // Check if this is a class which is stored in the object store. 32 // Check if this is a class which is stored in the object store.
33 return (class_id == kObjectCid || 33 return (class_id == kObjectCid ||
34 (class_id >= kInstanceCid && class_id <= kWeakPropertyCid) || 34 (class_id >= kInstanceCid && class_id <= kWeakPropertyCid) ||
35 RawObject::IsStringClassId(class_id)); 35 RawObject::IsStringClassId(class_id));
36 } 36 }
37 37
38 38
39 static bool IsObjectStoreTypeId(intptr_t index) { 39 static bool IsObjectStoreTypeId(intptr_t index) {
40 // Check if this is a type which is stored in the object store. 40 // Check if this is a type which is stored in the object store.
41 return (index >= kObjectType && index <= kListInterface); 41 return (index >= kObjectType && index <= kArrayType);
42 } 42 }
43 43
44 44
45 static intptr_t ClassIdFromObjectId(intptr_t object_id) { 45 static intptr_t ClassIdFromObjectId(intptr_t object_id) {
46 ASSERT(object_id > kClassIdsOffset); 46 ASSERT(object_id > kClassIdsOffset);
47 intptr_t class_id = (object_id - kClassIdsOffset); 47 intptr_t class_id = (object_id - kClassIdsOffset);
48 return class_id; 48 return class_id;
49 } 49 }
50 50
51 51
(...skipping 10 matching lines...) Expand all
62 case kDynamicType: return object_store->dynamic_type(); 62 case kDynamicType: return object_store->dynamic_type();
63 case kVoidType: return object_store->void_type(); 63 case kVoidType: return object_store->void_type();
64 case kFunctionType: return object_store->function_type(); 64 case kFunctionType: return object_store->function_type();
65 case kNumberType: return object_store->number_type(); 65 case kNumberType: return object_store->number_type();
66 case kSmiType: return object_store->smi_type(); 66 case kSmiType: return object_store->smi_type();
67 case kMintType: return object_store->mint_type(); 67 case kMintType: return object_store->mint_type();
68 case kDoubleType: return object_store->double_type(); 68 case kDoubleType: return object_store->double_type();
69 case kIntType: return object_store->int_type(); 69 case kIntType: return object_store->int_type();
70 case kBoolType: return object_store->bool_type(); 70 case kBoolType: return object_store->bool_type();
71 case kStringType: return object_store->string_type(); 71 case kStringType: return object_store->string_type();
72 case kListInterface: return object_store->list_interface(); 72 case kArrayType: return object_store->array_type();
73 default: break; 73 default: break;
74 } 74 }
75 UNREACHABLE(); 75 UNREACHABLE();
76 return Type::null(); 76 return Type::null();
77 } 77 }
78 78
79 79
80 static int GetTypeIndex(ObjectStore* object_store, const RawType* raw_type) { 80 static int GetTypeIndex(ObjectStore* object_store, const RawType* raw_type) {
81 ASSERT(raw_type->IsHeapObject()); 81 ASSERT(raw_type->IsHeapObject());
82 if (raw_type == object_store->object_type()) { 82 if (raw_type == object_store->object_type()) {
(...skipping 13 matching lines...) Expand all
96 } else if (raw_type == object_store->mint_type()) { 96 } else if (raw_type == object_store->mint_type()) {
97 return kMintType; 97 return kMintType;
98 } else if (raw_type == object_store->double_type()) { 98 } else if (raw_type == object_store->double_type()) {
99 return kDoubleType; 99 return kDoubleType;
100 } else if (raw_type == object_store->int_type()) { 100 } else if (raw_type == object_store->int_type()) {
101 return kIntType; 101 return kIntType;
102 } else if (raw_type == object_store->bool_type()) { 102 } else if (raw_type == object_store->bool_type()) {
103 return kBoolType; 103 return kBoolType;
104 } else if (raw_type == object_store->string_type()) { 104 } else if (raw_type == object_store->string_type()) {
105 return kStringType; 105 return kStringType;
106 } else if (raw_type == object_store->list_interface()) { 106 } else if (raw_type == object_store->array_type()) {
107 return kListInterface; 107 return kArrayType;
108 } 108 }
109 return kInvalidIndex; 109 return kInvalidIndex;
110 } 110 }
111 111
112 112
113 // TODO(5411462): Temporary setup of snapshot for testing purposes, 113 // TODO(5411462): Temporary setup of snapshot for testing purposes,
114 // the actual creation of a snapshot maybe done differently. 114 // the actual creation of a snapshot maybe done differently.
115 const Snapshot* Snapshot::SetupFromBuffer(const void* raw_memory) { 115 const Snapshot* Snapshot::SetupFromBuffer(const void* raw_memory) {
116 ASSERT(raw_memory != NULL); 116 ASSERT(raw_memory != NULL);
117 ASSERT(kHeaderSize == sizeof(Snapshot)); 117 ASSERT(kHeaderSize == sizeof(Snapshot));
(...skipping 1152 matching lines...) Expand 10 before | Expand all | Expand 10 after
1270 UnmarkAll(); 1270 UnmarkAll();
1271 isolate->set_long_jump_base(base); 1271 isolate->set_long_jump_base(base);
1272 } else { 1272 } else {
1273 isolate->set_long_jump_base(base); 1273 isolate->set_long_jump_base(base);
1274 ThrowException(exception_type(), exception_msg()); 1274 ThrowException(exception_type(), exception_msg());
1275 } 1275 }
1276 } 1276 }
1277 1277
1278 1278
1279 } // namespace dart 1279 } // namespace dart
OLDNEW
« runtime/vm/parser.cc ('K') | « runtime/vm/parser.cc ('k') | runtime/vm/snapshot_ids.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698