| OLD | NEW |
| 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 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 427 ASSERT(kind_ == Snapshot::kFull); | 427 ASSERT(kind_ == Snapshot::kFull); |
| 428 ASSERT(isolate()->no_gc_scope_depth() != 0); | 428 ASSERT(isolate()->no_gc_scope_depth() != 0); |
| 429 cls_ = Object::context_class(); | 429 cls_ = Object::context_class(); |
| 430 RawContext* obj = reinterpret_cast<RawContext*>( | 430 RawContext* obj = reinterpret_cast<RawContext*>( |
| 431 AllocateUninitialized(cls_, Context::InstanceSize(num_variables))); | 431 AllocateUninitialized(cls_, Context::InstanceSize(num_variables))); |
| 432 obj->ptr()->num_variables_ = num_variables; | 432 obj->ptr()->num_variables_ = num_variables; |
| 433 return obj; | 433 return obj; |
| 434 } | 434 } |
| 435 | 435 |
| 436 | 436 |
| 437 RawClass* SnapshotReader::NewClass(intptr_t class_id, bool is_signature_class) { | 437 RawClass* SnapshotReader::NewClass(intptr_t class_id) { |
| 438 ASSERT(kind_ == Snapshot::kFull); | 438 ASSERT(kind_ == Snapshot::kFull); |
| 439 ASSERT(isolate()->no_gc_scope_depth() != 0); | 439 ASSERT(isolate()->no_gc_scope_depth() != 0); |
| 440 if (class_id < kNumPredefinedCids) { | 440 if (class_id < kNumPredefinedCids) { |
| 441 ASSERT((class_id >= kInstanceCid) && (class_id <= kDartFunctionCid)); | 441 ASSERT((class_id >= kInstanceCid) && (class_id <= kDartFunctionCid)); |
| 442 return isolate()->class_table()->At(class_id); | 442 return isolate()->class_table()->At(class_id); |
| 443 } | 443 } |
| 444 cls_ = Object::class_class(); | 444 cls_ = Object::class_class(); |
| 445 RawClass* obj = reinterpret_cast<RawClass*>( | 445 RawClass* obj = reinterpret_cast<RawClass*>( |
| 446 AllocateUninitialized(cls_, Class::InstanceSize())); | 446 AllocateUninitialized(cls_, Class::InstanceSize())); |
| 447 if (is_signature_class) { | 447 Instance fake; |
| 448 Closure fake; | 448 obj->ptr()->handle_vtable_ = fake.vtable(); |
| 449 obj->ptr()->handle_vtable_ = fake.vtable(); | |
| 450 } else { | |
| 451 Instance fake; | |
| 452 obj->ptr()->handle_vtable_ = fake.vtable(); | |
| 453 } | |
| 454 cls_ = obj; | 449 cls_ = obj; |
| 455 cls_.set_id(kIllegalCid); | 450 cls_.set_id(kIllegalCid); |
| 456 isolate()->class_table()->Register(cls_); | 451 isolate()->class_table()->Register(cls_); |
| 457 return cls_.raw(); | 452 return cls_.raw(); |
| 458 } | 453 } |
| 459 | 454 |
| 460 | 455 |
| 461 RawMint* SnapshotReader::NewMint(int64_t value) { | 456 RawMint* SnapshotReader::NewMint(int64_t value) { |
| 462 ASSERT(kind_ == Snapshot::kFull); | 457 ASSERT(kind_ == Snapshot::kFull); |
| 463 ASSERT(isolate()->no_gc_scope_depth() != 0); | 458 ASSERT(isolate()->no_gc_scope_depth() != 0); |
| (...skipping 718 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1182 | 1177 |
| 1183 | 1178 |
| 1184 void MessageWriter::WriteMessage(const Object& obj) { | 1179 void MessageWriter::WriteMessage(const Object& obj) { |
| 1185 ASSERT(kind() == Snapshot::kMessage); | 1180 ASSERT(kind() == Snapshot::kMessage); |
| 1186 WriteObject(obj.raw()); | 1181 WriteObject(obj.raw()); |
| 1187 UnmarkAll(); | 1182 UnmarkAll(); |
| 1188 } | 1183 } |
| 1189 | 1184 |
| 1190 | 1185 |
| 1191 } // namespace dart | 1186 } // namespace dart |
| OLD | NEW |