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

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

Issue 1323813004: Changes to prepare for allowing script snapshots to be taken after running the main application (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: fix-long-line Created 5 years, 3 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
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/bootstrap.h" 8 #include "vm/bootstrap.h"
9 #include "vm/class_finalizer.h" 9 #include "vm/class_finalizer.h"
10 #include "vm/dart.h" 10 #include "vm/dart.h"
(...skipping 1126 matching lines...) Expand 10 before | Expand all | Expand 10 after
1137 } 1137 }
1138 if (object_id == kVoidType) { 1138 if (object_id == kVoidType) {
1139 return Object::void_type(); 1139 return Object::void_type();
1140 } 1140 }
1141 if (object_id == kTrueValue) { 1141 if (object_id == kTrueValue) {
1142 return Bool::True().raw(); 1142 return Bool::True().raw();
1143 } 1143 }
1144 if (object_id == kFalseValue) { 1144 if (object_id == kFalseValue) {
1145 return Bool::False().raw(); 1145 return Bool::False().raw();
1146 } 1146 }
1147 if (object_id == kExtractorParameterTypes) {
1148 return Object::extractor_parameter_types().raw();
1149 }
1150 if (object_id == kExtractorParameterNames) {
1151 return Object::extractor_parameter_names().raw();
1152 }
1153 if (object_id == kEmptyContextScopeObject) {
1154 return Object::empty_context_scope().raw();
1155 }
1147 if (object_id == kDoubleObject) { 1156 if (object_id == kDoubleObject) {
1148 ASSERT(kind_ == Snapshot::kMessage); 1157 ASSERT(kind_ == Snapshot::kMessage);
1149 return Double::New(ReadDouble()); 1158 return Double::New(ReadDouble());
1150 } 1159 }
1151 intptr_t class_id = ClassIdFromObjectId(object_id); 1160 intptr_t class_id = ClassIdFromObjectId(object_id);
1152 if (IsSingletonClassId(class_id)) { 1161 if (IsSingletonClassId(class_id)) {
1153 return isolate()->class_table()->At(class_id); // get singleton class. 1162 return isolate()->class_table()->At(class_id); // get singleton class.
1154 } else { 1163 } else {
1155 ASSERT(Symbols::IsVMSymbolId(object_id)); 1164 ASSERT(Symbols::IsVMSymbolId(object_id));
1156 return Symbols::GetVMSymbol(object_id); // return VM symbol. 1165 return Symbols::GetVMSymbol(object_id); // return VM symbol.
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
1410 void SnapshotWriter::WriteObject(RawObject* rawobj) { 1419 void SnapshotWriter::WriteObject(RawObject* rawobj) {
1411 WriteObjectImpl(rawobj, kAsInlinedObject); 1420 WriteObjectImpl(rawobj, kAsInlinedObject);
1412 WriteForwardedObjects(); 1421 WriteForwardedObjects();
1413 } 1422 }
1414 1423
1415 #define VM_OBJECT_CLASS_LIST(V) \ 1424 #define VM_OBJECT_CLASS_LIST(V) \
1416 V(OneByteString) \ 1425 V(OneByteString) \
1417 V(Mint) \ 1426 V(Mint) \
1418 V(Bigint) \ 1427 V(Bigint) \
1419 V(Double) \ 1428 V(Double) \
1429 V(ImmutableArray) \
1420 1430
1421 #define VM_OBJECT_WRITE(clazz) \ 1431 #define VM_OBJECT_WRITE(clazz) \
1422 case clazz::kClassId: { \ 1432 case clazz::kClassId: { \
1423 object_id = forward_list_->AddObject(rawobj, kIsSerialized); \ 1433 object_id = forward_list_->AddObject(rawobj, kIsSerialized); \
1424 Raw##clazz* raw_obj = reinterpret_cast<Raw##clazz*>(rawobj); \ 1434 Raw##clazz* raw_obj = reinterpret_cast<Raw##clazz*>(rawobj); \
1425 raw_obj->WriteTo(this, object_id, kind()); \ 1435 raw_obj->WriteTo(this, object_id, kind()); \
1426 return; \ 1436 return; \
1427 } \ 1437 } \
1428 1438
1429 void SnapshotWriter::HandleVMIsolateObject(RawObject* rawobj) { 1439 void SnapshotWriter::HandleVMIsolateObject(RawObject* rawobj) {
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
1474 WriteVMIsolateObject(kTrueValue); 1484 WriteVMIsolateObject(kTrueValue);
1475 return; 1485 return;
1476 } 1486 }
1477 1487
1478 // Check if it is a singleton boolean false object. 1488 // Check if it is a singleton boolean false object.
1479 if (rawobj == Bool::False().raw()) { 1489 if (rawobj == Bool::False().raw()) {
1480 WriteVMIsolateObject(kFalseValue); 1490 WriteVMIsolateObject(kFalseValue);
1481 return; 1491 return;
1482 } 1492 }
1483 1493
1494 // Check if it is a singleton extractor parameter types array.
1495 if (rawobj == Object::extractor_parameter_types().raw()) {
1496 WriteVMIsolateObject(kExtractorParameterTypes);
1497 return;
1498 }
1499
1500 // Check if it is a singleton extractor parameter names array.
1501 if (rawobj == Object::extractor_parameter_names().raw()) {
1502 WriteVMIsolateObject(kExtractorParameterNames);
1503 return;
1504 }
1505
1506 // Check if it is a singleton empty context scope object.
1507 if (rawobj == Object::empty_context_scope().raw()) {
1508 WriteVMIsolateObject(kEmptyContextScopeObject);
1509 return;
1510 }
1511
1484 // Check if it is a singleton class object which is shared by 1512 // Check if it is a singleton class object which is shared by
1485 // all isolates. 1513 // all isolates.
1486 intptr_t id = rawobj->GetClassId(); 1514 intptr_t id = rawobj->GetClassId();
1487 if (id == kClassCid) { 1515 if (id == kClassCid) {
1488 RawClass* raw_class = reinterpret_cast<RawClass*>(rawobj); 1516 RawClass* raw_class = reinterpret_cast<RawClass*>(rawobj);
1489 intptr_t class_id = raw_class->ptr()->id_; 1517 intptr_t class_id = raw_class->ptr()->id_;
1490 if (IsSingletonClassId(class_id)) { 1518 if (IsSingletonClassId(class_id)) {
1491 intptr_t object_id = ObjectIdFromClassId(class_id); 1519 intptr_t object_id = ObjectIdFromClassId(class_id);
1492 WriteVMIsolateObject(object_id); 1520 WriteVMIsolateObject(object_id);
1493 return; 1521 return;
(...skipping 970 matching lines...) Expand 10 before | Expand all | Expand 10 after
2464 NoSafepointScope no_safepoint; 2492 NoSafepointScope no_safepoint;
2465 WriteObject(obj.raw()); 2493 WriteObject(obj.raw());
2466 UnmarkAll(); 2494 UnmarkAll();
2467 } else { 2495 } else {
2468 ThrowException(exception_type(), exception_msg()); 2496 ThrowException(exception_type(), exception_msg());
2469 } 2497 }
2470 } 2498 }
2471 2499
2472 2500
2473 } // namespace dart 2501 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698