| 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/object.h" | 5 #include "vm/object.h" |
| 6 | 6 |
| 7 #include "include/dart_api.h" | 7 #include "include/dart_api.h" |
| 8 #include "platform/assert.h" | 8 #include "platform/assert.h" |
| 9 #include "vm/assembler.h" | 9 #include "vm/assembler.h" |
| 10 #include "vm/bigint_operations.h" | 10 #include "vm/bigint_operations.h" |
| (...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 586 void Object::MakeUnusedSpaceTraversable(const Object& obj, | 586 void Object::MakeUnusedSpaceTraversable(const Object& obj, |
| 587 intptr_t original_size, | 587 intptr_t original_size, |
| 588 intptr_t used_size) { | 588 intptr_t used_size) { |
| 589 ASSERT(Isolate::Current()->no_gc_scope_depth() > 0); | 589 ASSERT(Isolate::Current()->no_gc_scope_depth() > 0); |
| 590 ASSERT(!obj.IsNull()); | 590 ASSERT(!obj.IsNull()); |
| 591 ASSERT(original_size >= used_size); | 591 ASSERT(original_size >= used_size); |
| 592 if (original_size > used_size) { | 592 if (original_size > used_size) { |
| 593 intptr_t leftover_size = original_size - used_size; | 593 intptr_t leftover_size = original_size - used_size; |
| 594 | 594 |
| 595 uword addr = RawObject::ToAddr(obj.raw()) + used_size; | 595 uword addr = RawObject::ToAddr(obj.raw()) + used_size; |
| 596 ASSERT(TypedData::InstanceSize(0) == Object::InstanceSize()); | 596 if (leftover_size >= TypedData::InstanceSize(0)) { |
| 597 // Update the leftover space as an TypedDataInt8Array object. | 597 // Update the leftover space as an TypedDataInt8Array object. |
| 598 RawTypedData* raw = | 598 RawTypedData* raw = |
| 599 reinterpret_cast<RawTypedData*>(RawObject::FromAddr(addr)); | 599 reinterpret_cast<RawTypedData*>(RawObject::FromAddr(addr)); |
| 600 uword tags = 0; | 600 uword tags = 0; |
| 601 tags = RawObject::SizeTag::update(leftover_size, tags); | 601 tags = RawObject::SizeTag::update(leftover_size, tags); |
| 602 tags = RawObject::ClassIdTag::update(kTypedDataInt8ArrayCid, tags); | 602 tags = RawObject::ClassIdTag::update(kTypedDataInt8ArrayCid, tags); |
| 603 raw->ptr()->tags_ = tags; | 603 raw->ptr()->tags_ = tags; |
| 604 intptr_t leftover_len = (leftover_size - TypedData::InstanceSize(0)); | 604 intptr_t leftover_len = (leftover_size - TypedData::InstanceSize(0)); |
| 605 ASSERT(TypedData::InstanceSize(leftover_len) == leftover_size); | 605 ASSERT(TypedData::InstanceSize(leftover_len) == leftover_size); |
| 606 raw->ptr()->length_ = Smi::New(leftover_len); | 606 raw->ptr()->length_ = Smi::New(leftover_len); |
| 607 } else { |
| 608 // Update the leftover space as a basic object. |
| 609 ASSERT(leftover_size == Object::InstanceSize()); |
| 610 RawObject* raw = reinterpret_cast<RawObject*>(RawObject::FromAddr(addr)); |
| 611 uword tags = 0; |
| 612 tags = RawObject::SizeTag::update(leftover_size, tags); |
| 613 tags = RawObject::ClassIdTag::update(kInstanceCid, tags); |
| 614 raw->ptr()->tags_ = tags; |
| 615 } |
| 607 } | 616 } |
| 608 } | 617 } |
| 609 | 618 |
| 610 | 619 |
| 611 void Object::VerifyBuiltinVtables() { | 620 void Object::VerifyBuiltinVtables() { |
| 612 #if defined(DEBUG) | 621 #if defined(DEBUG) |
| 613 Isolate* isolate = Isolate::Current(); | 622 Isolate* isolate = Isolate::Current(); |
| 614 ASSERT(isolate != NULL); | 623 ASSERT(isolate != NULL); |
| 615 Class& cls = Class::Handle(isolate, Class::null()); | 624 Class& cls = Class::Handle(isolate, Class::null()); |
| 616 for (intptr_t cid = (kIllegalCid + 1); cid < kNumPredefinedCids; cid++) { | 625 for (intptr_t cid = (kIllegalCid + 1); cid < kNumPredefinedCids; cid++) { |
| (...skipping 12472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13089 } | 13098 } |
| 13090 return result.raw(); | 13099 return result.raw(); |
| 13091 } | 13100 } |
| 13092 | 13101 |
| 13093 | 13102 |
| 13094 const char* WeakProperty::ToCString() const { | 13103 const char* WeakProperty::ToCString() const { |
| 13095 return "_WeakProperty"; | 13104 return "_WeakProperty"; |
| 13096 } | 13105 } |
| 13097 | 13106 |
| 13098 } // namespace dart | 13107 } // namespace dart |
| OLD | NEW |