| 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 524 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 535 tags = RawObject::SizeTag::update(leftover_size, tags); | 535 tags = RawObject::SizeTag::update(leftover_size, tags); |
| 536 tags = RawObject::ClassIdTag::update(kInt8ArrayCid, tags); | 536 tags = RawObject::ClassIdTag::update(kInt8ArrayCid, tags); |
| 537 raw->ptr()->tags_ = tags; | 537 raw->ptr()->tags_ = tags; |
| 538 intptr_t leftover_len = (leftover_size - Int8Array::InstanceSize(0)); | 538 intptr_t leftover_len = (leftover_size - Int8Array::InstanceSize(0)); |
| 539 ASSERT(Int8Array::InstanceSize(leftover_len) == leftover_size); | 539 ASSERT(Int8Array::InstanceSize(leftover_len) == leftover_size); |
| 540 raw->ptr()->length_ = Smi::New(leftover_len); | 540 raw->ptr()->length_ = Smi::New(leftover_len); |
| 541 } | 541 } |
| 542 } | 542 } |
| 543 | 543 |
| 544 | 544 |
| 545 void Object::VerifyBuiltinVtables() { |
| 546 #if defined(DEBUG) |
| 547 Isolate* isolate = Isolate::Current(); |
| 548 ASSERT(isolate != NULL); |
| 549 Class& cls = Class::Handle(isolate, Class::null()); |
| 550 for (intptr_t cid = (kIllegalCid + 1); cid < kNumPredefinedCids; cid++) { |
| 551 if (isolate->class_table()->HasValidClassAt(cid)) { |
| 552 cls |= isolate->class_table()->At(cid); |
| 553 ASSERT(builtin_vtables_[cid] == cls.raw_ptr()->handle_vtable_); |
| 554 } |
| 555 } |
| 556 #endif |
| 557 } |
| 558 |
| 559 |
| 545 void Object::RegisterClass(const Class& cls, | 560 void Object::RegisterClass(const Class& cls, |
| 546 const String& name, | 561 const String& name, |
| 547 const Library& lib) { | 562 const Library& lib) { |
| 548 ASSERT(name.Length() > 0); | 563 ASSERT(name.Length() > 0); |
| 549 ASSERT(name.CharAt(0) != '_'); | 564 ASSERT(name.CharAt(0) != '_'); |
| 550 cls.set_name(name); | 565 cls.set_name(name); |
| 551 lib.AddClass(cls); | 566 lib.AddClass(cls); |
| 552 } | 567 } |
| 553 | 568 |
| 554 | 569 |
| (...skipping 637 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1192 if (raw_ != Object::null()) { | 1207 if (raw_ != Object::null()) { |
| 1193 if ((reinterpret_cast<uword>(raw_) & kSmiTagMask) == kSmiTag) { | 1208 if ((reinterpret_cast<uword>(raw_) & kSmiTagMask) == kSmiTag) { |
| 1194 ASSERT(vtable() == Smi::handle_vtable_); | 1209 ASSERT(vtable() == Smi::handle_vtable_); |
| 1195 return; | 1210 return; |
| 1196 } | 1211 } |
| 1197 intptr_t cid = raw_->GetClassId(); | 1212 intptr_t cid = raw_->GetClassId(); |
| 1198 if (cid >= kNumPredefinedCids) { | 1213 if (cid >= kNumPredefinedCids) { |
| 1199 cid = kInstanceCid; | 1214 cid = kInstanceCid; |
| 1200 } | 1215 } |
| 1201 ASSERT(vtable() == builtin_vtables_[cid]); | 1216 ASSERT(vtable() == builtin_vtables_[cid]); |
| 1202 Isolate* isolate = Isolate::Current(); | |
| 1203 if (FLAG_verify_handles) { | 1217 if (FLAG_verify_handles) { |
| 1218 Isolate* isolate = Isolate::Current(); |
| 1204 Heap* isolate_heap = isolate->heap(); | 1219 Heap* isolate_heap = isolate->heap(); |
| 1205 Heap* vm_isolate_heap = Dart::vm_isolate()->heap(); | 1220 Heap* vm_isolate_heap = Dart::vm_isolate()->heap(); |
| 1206 ASSERT(isolate_heap->Contains(RawObject::ToAddr(raw_)) || | 1221 ASSERT(isolate_heap->Contains(RawObject::ToAddr(raw_)) || |
| 1207 vm_isolate_heap->Contains(RawObject::ToAddr(raw_))); | 1222 vm_isolate_heap->Contains(RawObject::ToAddr(raw_))); |
| 1208 } | 1223 } |
| 1209 ASSERT(builtin_vtables_[cid] == | |
| 1210 isolate->class_table()->At(cid)->ptr()->handle_vtable_); | |
| 1211 } | 1224 } |
| 1212 #endif | 1225 #endif |
| 1213 } | 1226 } |
| 1214 | 1227 |
| 1215 | 1228 |
| 1216 RawObject* Object::Allocate(intptr_t cls_id, | 1229 RawObject* Object::Allocate(intptr_t cls_id, |
| 1217 intptr_t size, | 1230 intptr_t size, |
| 1218 Heap::Space space) { | 1231 Heap::Space space) { |
| 1219 ASSERT(Utils::IsAligned(size, kObjectAlignment)); | 1232 ASSERT(Utils::IsAligned(size, kObjectAlignment)); |
| 1220 Isolate* isolate = Isolate::Current(); | 1233 Isolate* isolate = Isolate::Current(); |
| (...skipping 11400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12621 } | 12634 } |
| 12622 return result.raw(); | 12635 return result.raw(); |
| 12623 } | 12636 } |
| 12624 | 12637 |
| 12625 | 12638 |
| 12626 const char* WeakProperty::ToCString() const { | 12639 const char* WeakProperty::ToCString() const { |
| 12627 return "_WeakProperty"; | 12640 return "_WeakProperty"; |
| 12628 } | 12641 } |
| 12629 | 12642 |
| 12630 } // namespace dart | 12643 } // namespace dart |
| OLD | NEW |