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/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 495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
506 ASSERT(next_field_offset > 0); | 506 ASSERT(next_field_offset > 0); |
507 // Instance::NextFieldOffset() returns the offset of the first field in | 507 // Instance::NextFieldOffset() returns the offset of the first field in |
508 // a Dart object. | 508 // a Dart object. |
509 bool read_as_reference = RawObject::IsCanonical(tags) ? false : true; | 509 bool read_as_reference = RawObject::IsCanonical(tags) ? false : true; |
510 intptr_t offset = Instance::NextFieldOffset(); | 510 intptr_t offset = Instance::NextFieldOffset(); |
511 intptr_t result_cid = result->GetClassId(); | 511 intptr_t result_cid = result->GetClassId(); |
512 while (offset < next_field_offset) { | 512 while (offset < next_field_offset) { |
513 pobj_ = ReadObjectImpl(read_as_reference); | 513 pobj_ = ReadObjectImpl(read_as_reference); |
514 result->SetFieldAtOffset(offset, pobj_); | 514 result->SetFieldAtOffset(offset, pobj_); |
515 if ((offset != type_argument_field_offset) && | 515 if ((offset != type_argument_field_offset) && |
516 (kind_ == Snapshot::kMessage) && FLAG_use_field_guards) { | 516 (kind_ == Snapshot::kMessage) && isolate()->use_field_guards()) { |
517 // TODO(fschneider): Consider hoisting these lookups out of the loop. | 517 // TODO(fschneider): Consider hoisting these lookups out of the loop. |
518 // This would involve creating a handle, since cls_ can't be reused | 518 // This would involve creating a handle, since cls_ can't be reused |
519 // across the call to ReadObjectImpl. | 519 // across the call to ReadObjectImpl. |
520 cls_ = isolate()->class_table()->At(result_cid); | 520 cls_ = isolate()->class_table()->At(result_cid); |
521 array_ = cls_.OffsetToFieldMap(); | 521 array_ = cls_.OffsetToFieldMap(); |
522 field_ ^= array_.At(offset >> kWordSizeLog2); | 522 field_ ^= array_.At(offset >> kWordSizeLog2); |
523 ASSERT(!field_.IsNull()); | 523 ASSERT(!field_.IsNull()); |
524 ASSERT(field_.Offset() == offset); | 524 ASSERT(field_.Offset() == offset); |
525 obj_ = pobj_.raw(); | 525 obj_ = pobj_.raw(); |
526 field_.RecordStore(obj_); | 526 field_.RecordStore(obj_); |
(...skipping 1412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1939 *buffer_len_ = BytesWritten(); | 1939 *buffer_len_ = BytesWritten(); |
1940 } | 1940 } |
1941 } else { | 1941 } else { |
1942 FreeBuffer(); | 1942 FreeBuffer(); |
1943 ThrowException(exception_type(), exception_msg()); | 1943 ThrowException(exception_type(), exception_msg()); |
1944 } | 1944 } |
1945 } | 1945 } |
1946 | 1946 |
1947 | 1947 |
1948 } // namespace dart | 1948 } // namespace dart |
OLD | NEW |