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

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

Issue 10832401: Gentle start with removing explicit interfaces (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 4 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
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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 return (class_id + kClassIdsOffset); 52 return (class_id + kClassIdsOffset);
53 } 53 }
54 54
55 55
56 static RawType* GetType(ObjectStore* object_store, int index) { 56 static RawType* GetType(ObjectStore* object_store, int index) {
57 switch (index) { 57 switch (index) {
58 case kObjectType: return object_store->object_type(); 58 case kObjectType: return object_store->object_type();
59 case kNullType: return object_store->null_type(); 59 case kNullType: return object_store->null_type();
60 case kDynamicType: return object_store->dynamic_type(); 60 case kDynamicType: return object_store->dynamic_type();
61 case kVoidType: return object_store->void_type(); 61 case kVoidType: return object_store->void_type();
62 case kFunctionInterface: return object_store->function_interface(); 62 case kFunctionType: return object_store->function_type();
63 case kNumberInterface: return object_store->number_interface(); 63 case kNumberType: return object_store->number_type();
64 case kDoubleInterface: return object_store->double_interface(); 64 case kDoubleInterface: return object_store->double_interface();
65 case kIntInterface: return object_store->int_interface(); 65 case kIntInterface: return object_store->int_interface();
66 case kBoolInterface: return object_store->bool_interface(); 66 case kBoolInterface: return object_store->bool_interface();
67 case kStringInterface: return object_store->string_interface(); 67 case kStringInterface: return object_store->string_interface();
68 case kListInterface: return object_store->list_interface(); 68 case kListInterface: return object_store->list_interface();
69 case kByteArrayInterface: return object_store->byte_array_interface(); 69 case kByteArrayInterface: return object_store->byte_array_interface();
70 default: break; 70 default: break;
71 } 71 }
72 UNREACHABLE(); 72 UNREACHABLE();
73 return Type::null(); 73 return Type::null();
74 } 74 }
75 75
76 76
77 static int GetTypeIndex(ObjectStore* object_store, const RawType* raw_type) { 77 static int GetTypeIndex(ObjectStore* object_store, const RawType* raw_type) {
78 ASSERT(raw_type->IsHeapObject()); 78 ASSERT(raw_type->IsHeapObject());
79 if (raw_type == object_store->object_type()) { 79 if (raw_type == object_store->object_type()) {
80 return kObjectType; 80 return kObjectType;
81 } else if (raw_type == object_store->null_type()) { 81 } else if (raw_type == object_store->null_type()) {
82 return kNullType; 82 return kNullType;
83 } else if (raw_type == object_store->dynamic_type()) { 83 } else if (raw_type == object_store->dynamic_type()) {
84 return kDynamicType; 84 return kDynamicType;
85 } else if (raw_type == object_store->void_type()) { 85 } else if (raw_type == object_store->void_type()) {
86 return kVoidType; 86 return kVoidType;
87 } else if (raw_type == object_store->function_interface()) { 87 } else if (raw_type == object_store->function_type()) {
88 return kFunctionInterface; 88 return kFunctionType;
89 } else if (raw_type == object_store->number_interface()) { 89 } else if (raw_type == object_store->number_type()) {
90 return kNumberInterface; 90 return kNumberType;
91 } else if (raw_type == object_store->double_interface()) { 91 } else if (raw_type == object_store->double_interface()) {
92 return kDoubleInterface; 92 return kDoubleInterface;
93 } else if (raw_type == object_store->int_interface()) { 93 } else if (raw_type == object_store->int_interface()) {
94 return kIntInterface; 94 return kIntInterface;
95 } else if (raw_type == object_store->bool_interface()) { 95 } else if (raw_type == object_store->bool_interface()) {
96 return kBoolInterface; 96 return kBoolInterface;
97 } else if (raw_type == object_store->string_interface()) { 97 } else if (raw_type == object_store->string_interface()) {
98 return kStringInterface; 98 return kStringInterface;
99 } else if (raw_type == object_store->list_interface()) { 99 } else if (raw_type == object_store->list_interface()) {
100 return kListInterface; 100 return kListInterface;
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after
407 AllocateUninitialized(cls_, Context::InstanceSize(num_variables))); 407 AllocateUninitialized(cls_, Context::InstanceSize(num_variables)));
408 obj->ptr()->num_variables_ = num_variables; 408 obj->ptr()->num_variables_ = num_variables;
409 return obj; 409 return obj;
410 } 410 }
411 411
412 412
413 RawClass* SnapshotReader::NewClass(intptr_t class_id, bool is_signature_class) { 413 RawClass* SnapshotReader::NewClass(intptr_t class_id, bool is_signature_class) {
414 ASSERT(kind_ == Snapshot::kFull); 414 ASSERT(kind_ == Snapshot::kFull);
415 ASSERT(isolate()->no_gc_scope_depth() != 0); 415 ASSERT(isolate()->no_gc_scope_depth() != 0);
416 if (class_id < kNumPredefinedCids) { 416 if (class_id < kNumPredefinedCids) {
417 ASSERT((class_id >= kInstanceCid) && (class_id <= kWeakPropertyCid)); 417 ASSERT((class_id >= kInstanceCid) && (class_id <= kDartFunctionCid));
418 return isolate()->class_table()->At(class_id); 418 return isolate()->class_table()->At(class_id);
419 } 419 }
420 cls_ = Object::class_class(); 420 cls_ = Object::class_class();
421 RawClass* obj = reinterpret_cast<RawClass*>( 421 RawClass* obj = reinterpret_cast<RawClass*>(
422 AllocateUninitialized(cls_, Class::InstanceSize())); 422 AllocateUninitialized(cls_, Class::InstanceSize()));
423 if (is_signature_class) { 423 if (is_signature_class) {
424 Closure fake; 424 Closure fake;
425 obj->ptr()->handle_vtable_ = fake.vtable(); 425 obj->ptr()->handle_vtable_ = fake.vtable();
426 } else { 426 } else {
427 Instance fake; 427 Instance fake;
(...skipping 693 matching lines...) Expand 10 before | Expand all | Expand 10 after
1121 RawObject* raw_obj = *current; 1121 RawObject* raw_obj = *current;
1122 if (as_references_) { 1122 if (as_references_) {
1123 writer_->WriteObjectRef(raw_obj); 1123 writer_->WriteObjectRef(raw_obj);
1124 } else { 1124 } else {
1125 writer_->WriteObjectImpl(raw_obj); 1125 writer_->WriteObjectImpl(raw_obj);
1126 } 1126 }
1127 } 1127 }
1128 } 1128 }
1129 1129
1130 } // namespace dart 1130 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698