| 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/class_finalizer.h" | 10 #include "vm/class_finalizer.h" |
| (...skipping 1300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1311 // Write out the individual object ids. | 1311 // Write out the individual object ids. |
| 1312 for (intptr_t i = 0; i < len; i++) { | 1312 for (intptr_t i = 0; i < len; i++) { |
| 1313 WriteObjectRef(data[i]); | 1313 WriteObjectRef(data[i]); |
| 1314 } | 1314 } |
| 1315 } | 1315 } |
| 1316 | 1316 |
| 1317 | 1317 |
| 1318 void SnapshotWriter::CheckIfSerializable(RawClass* cls) { | 1318 void SnapshotWriter::CheckIfSerializable(RawClass* cls) { |
| 1319 if (Class::IsSignatureClass(cls)) { | 1319 if (Class::IsSignatureClass(cls)) { |
| 1320 // We do not allow closure objects in an isolate message. | 1320 // We do not allow closure objects in an isolate message. |
| 1321 set_exception_type(Exceptions::kArgument); | 1321 SetWriteException(Exceptions::kArgument, |
| 1322 // TODO(6726): Allocate these constant strings once in the VM isolate. | 1322 "Illegal argument in isolate message" |
| 1323 set_exception_msg("Illegal argument in isolate message" | |
| 1324 " : (object is a closure)"); | 1323 " : (object is a closure)"); |
| 1325 Isolate::Current()->long_jump_base()->Jump(1, *ErrorHandle()); | |
| 1326 } | 1324 } |
| 1327 if (cls->ptr()->num_native_fields_ != 0) { | 1325 if (cls->ptr()->num_native_fields_ != 0) { |
| 1328 // We do not allow objects with native fields in an isolate message. | 1326 // We do not allow objects with native fields in an isolate message. |
| 1329 set_exception_type(Exceptions::kArgument); | 1327 SetWriteException(Exceptions::kArgument, |
| 1330 // TODO(6726): Allocate these constant strings once in the VM isolate. | 1328 "Illegal argument in isolate message" |
| 1331 set_exception_msg("Illegal argument in isolate message" | |
| 1332 " : (object extends NativeWrapper)"); | 1329 " : (object extends NativeWrapper)"); |
| 1330 } |
| 1331 } |
| 1333 | 1332 |
| 1334 Isolate::Current()->long_jump_base()->Jump(1, *ErrorHandle()); | 1333 |
| 1335 } | 1334 void SnapshotWriter::SetWriteException(Exceptions::ExceptionType type, |
| 1335 const char* msg) { |
| 1336 set_exception_type(type); |
| 1337 // TODO(6726): Allocate these constant strings once in the VM isolate. |
| 1338 set_exception_msg(msg); |
| 1339 Isolate::Current()->long_jump_base()->Jump(1, *ErrorHandle()); |
| 1336 } | 1340 } |
| 1337 | 1341 |
| 1338 | 1342 |
| 1339 void SnapshotWriter::WriteInstance(intptr_t object_id, | 1343 void SnapshotWriter::WriteInstance(intptr_t object_id, |
| 1340 RawObject* raw, | 1344 RawObject* raw, |
| 1341 RawClass* cls, | 1345 RawClass* cls, |
| 1342 intptr_t tags) { | 1346 intptr_t tags) { |
| 1343 // First check if object is a closure or has native fields. | 1347 // First check if object is a closure or has native fields. |
| 1344 CheckIfSerializable(cls); | 1348 CheckIfSerializable(cls); |
| 1345 | 1349 |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1462 UnmarkAll(); | 1466 UnmarkAll(); |
| 1463 isolate->set_long_jump_base(base); | 1467 isolate->set_long_jump_base(base); |
| 1464 } else { | 1468 } else { |
| 1465 isolate->set_long_jump_base(base); | 1469 isolate->set_long_jump_base(base); |
| 1466 ThrowException(exception_type(), exception_msg()); | 1470 ThrowException(exception_type(), exception_msg()); |
| 1467 } | 1471 } |
| 1468 } | 1472 } |
| 1469 | 1473 |
| 1470 | 1474 |
| 1471 } // namespace dart | 1475 } // namespace dart |
| OLD | NEW |