| 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 557 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 568 fields = Array::New(1); | 568 fields = Array::New(1); |
| 569 name = Symbols::New("@parent_"); | 569 name = Symbols::New("@parent_"); |
| 570 fld = Field::New(name, false, false, false, cls, 0); | 570 fld = Field::New(name, false, false, false, cls, 0); |
| 571 fields.SetAt(0, fld); | 571 fields.SetAt(0, fld); |
| 572 cls.SetFields(fields); | 572 cls.SetFields(fields); |
| 573 } | 573 } |
| 574 | 574 |
| 575 | 575 |
| 576 // Make unused space in an object whose type has been transformed safe | 576 // Make unused space in an object whose type has been transformed safe |
| 577 // for traversing during GC. | 577 // for traversing during GC. |
| 578 // The unused part of the transformed object is marked as an Int8Array | 578 // The unused part of the transformed object is marked as an TypedDataInt8Array |
| 579 // object. | 579 // object. |
| 580 void Object::MakeUnusedSpaceTraversable(const Object& obj, | 580 void Object::MakeUnusedSpaceTraversable(const Object& obj, |
| 581 intptr_t original_size, | 581 intptr_t original_size, |
| 582 intptr_t used_size) { | 582 intptr_t used_size) { |
| 583 ASSERT(Isolate::Current()->no_gc_scope_depth() > 0); | 583 ASSERT(Isolate::Current()->no_gc_scope_depth() > 0); |
| 584 ASSERT(!obj.IsNull()); | 584 ASSERT(!obj.IsNull()); |
| 585 ASSERT(original_size >= used_size); | 585 ASSERT(original_size >= used_size); |
| 586 if (original_size > used_size) { | 586 if (original_size > used_size) { |
| 587 intptr_t leftover_size = original_size - used_size; | 587 intptr_t leftover_size = original_size - used_size; |
| 588 | 588 |
| 589 uword addr = RawObject::ToAddr(obj.raw()) + used_size; | 589 uword addr = RawObject::ToAddr(obj.raw()) + used_size; |
| 590 ASSERT(Int8Array::InstanceSize(0) == Object::InstanceSize()); | 590 ASSERT(TypedData::InstanceSize(0) == Object::InstanceSize()); |
| 591 // Update the leftover space as an Int8Array object. | 591 // Update the leftover space as an TypedDataInt8Array object. |
| 592 RawInt8Array* raw = | 592 RawTypedData* raw = |
| 593 reinterpret_cast<RawInt8Array*>(RawObject::FromAddr(addr)); | 593 reinterpret_cast<RawTypedData*>(RawObject::FromAddr(addr)); |
| 594 uword tags = 0; | 594 uword tags = 0; |
| 595 tags = RawObject::SizeTag::update(leftover_size, tags); | 595 tags = RawObject::SizeTag::update(leftover_size, tags); |
| 596 tags = RawObject::ClassIdTag::update(kInt8ArrayCid, tags); | 596 tags = RawObject::ClassIdTag::update(kTypedDataInt8ArrayCid, tags); |
| 597 raw->ptr()->tags_ = tags; | 597 raw->ptr()->tags_ = tags; |
| 598 intptr_t leftover_len = (leftover_size - Int8Array::InstanceSize(0)); | 598 intptr_t leftover_len = (leftover_size - TypedData::InstanceSize(0)); |
| 599 ASSERT(Int8Array::InstanceSize(leftover_len) == leftover_size); | 599 ASSERT(TypedData::InstanceSize(leftover_len) == leftover_size); |
| 600 raw->ptr()->length_ = Smi::New(leftover_len); | 600 raw->ptr()->length_ = Smi::New(leftover_len); |
| 601 } | 601 } |
| 602 } | 602 } |
| 603 | 603 |
| 604 | 604 |
| 605 void Object::VerifyBuiltinVtables() { | 605 void Object::VerifyBuiltinVtables() { |
| 606 #if defined(DEBUG) | 606 #if defined(DEBUG) |
| 607 Isolate* isolate = Isolate::Current(); | 607 Isolate* isolate = Isolate::Current(); |
| 608 ASSERT(isolate != NULL); | 608 ASSERT(isolate != NULL); |
| 609 Class& cls = Class::Handle(isolate, Class::null()); | 609 Class& cls = Class::Handle(isolate, Class::null()); |
| (...skipping 13066 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13676 } | 13676 } |
| 13677 return result.raw(); | 13677 return result.raw(); |
| 13678 } | 13678 } |
| 13679 | 13679 |
| 13680 | 13680 |
| 13681 const char* WeakProperty::ToCString() const { | 13681 const char* WeakProperty::ToCString() const { |
| 13682 return "_WeakProperty"; | 13682 return "_WeakProperty"; |
| 13683 } | 13683 } |
| 13684 | 13684 |
| 13685 } // namespace dart | 13685 } // namespace dart |
| OLD | NEW |