| 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 #ifndef VM_OBJECT_H_ | 5 #ifndef VM_OBJECT_H_ |
| 6 #define VM_OBJECT_H_ | 6 #define VM_OBJECT_H_ |
| 7 | 7 |
| 8 #include "include/dart_api.h" | 8 #include "include/dart_api.h" |
| 9 #include "platform/assert.h" | 9 #include "platform/assert.h" |
| 10 #include "platform/utils.h" | 10 #include "platform/utils.h" |
| 11 #include "vm/json_stream.h" | 11 #include "vm/json_stream.h" |
| 12 #include "vm/bitmap.h" | 12 #include "vm/bitmap.h" |
| 13 #include "vm/dart.h" | 13 #include "vm/dart.h" |
| 14 #include "vm/globals.h" | 14 #include "vm/globals.h" |
| 15 #include "vm/handles.h" | 15 #include "vm/handles.h" |
| 16 #include "vm/heap.h" | 16 #include "vm/heap.h" |
| 17 #include "vm/isolate.h" | 17 #include "vm/isolate.h" |
| 18 #include "vm/method_recognizer.h" | 18 #include "vm/method_recognizer.h" |
| 19 #include "vm/os.h" | 19 #include "vm/os.h" |
| 20 #include "vm/raw_object.h" | 20 #include "vm/raw_object.h" |
| 21 #include "vm/report.h" | 21 #include "vm/report.h" |
| 22 #include "vm/scanner.h" | 22 #include "vm/scanner.h" |
| 23 #include "vm/tags.h" | 23 #include "vm/tags.h" |
| 24 #include "vm/verified_memory.h" |
| 24 | 25 |
| 25 namespace dart { | 26 namespace dart { |
| 26 | 27 |
| 27 // Forward declarations. | 28 // Forward declarations. |
| 28 #define DEFINE_FORWARD_DECLARATION(clazz) \ | 29 #define DEFINE_FORWARD_DECLARATION(clazz) \ |
| 29 class clazz; | 30 class clazz; |
| 30 CLASS_LIST(DEFINE_FORWARD_DECLARATION) | 31 CLASS_LIST(DEFINE_FORWARD_DECLARATION) |
| 31 #undef DEFINE_FORWARD_DECLARATION | 32 #undef DEFINE_FORWARD_DECLARATION |
| 32 class Api; | 33 class Api; |
| 33 class ArgumentsDescriptor; | 34 class ArgumentsDescriptor; |
| (...skipping 569 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 603 } | 604 } |
| 604 | 605 |
| 605 // Store a range of pointers [from, from + count) into [to, to + count). | 606 // Store a range of pointers [from, from + count) into [to, to + count). |
| 606 // TODO(koda): Use this to fix Object::Clone's broken store buffer logic. | 607 // TODO(koda): Use this to fix Object::Clone's broken store buffer logic. |
| 607 void StorePointers(RawObject* const* to, | 608 void StorePointers(RawObject* const* to, |
| 608 RawObject* const* from, | 609 RawObject* const* from, |
| 609 intptr_t count) { | 610 intptr_t count) { |
| 610 ASSERT(Contains(reinterpret_cast<uword>(to))); | 611 ASSERT(Contains(reinterpret_cast<uword>(to))); |
| 611 if (raw()->IsNewObject()) { | 612 if (raw()->IsNewObject()) { |
| 612 memmove(const_cast<RawObject**>(to), from, count * kWordSize); | 613 memmove(const_cast<RawObject**>(to), from, count * kWordSize); |
| 614 VerifiedMemory::Accept(reinterpret_cast<uword>(to), count * kWordSize); |
| 613 } else { | 615 } else { |
| 614 for (intptr_t i = 0; i < count; ++i) { | 616 for (intptr_t i = 0; i < count; ++i) { |
| 615 StorePointer(&to[i], from[i]); | 617 StorePointer(&to[i], from[i]); |
| 616 } | 618 } |
| 617 } | 619 } |
| 618 } | 620 } |
| 619 | 621 |
| 620 // Use for storing into an explicitly Smi-typed field of an object | 622 // Use for storing into an explicitly Smi-typed field of an object |
| 621 // (i.e., both the previous and new value are Smis). | 623 // (i.e., both the previous and new value are Smis). |
| 622 void StoreSmi(RawSmi* const* addr, RawSmi* value) const { | 624 void StoreSmi(RawSmi* const* addr, RawSmi* value) const { |
| (...skipping 956 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1579 // Return the number of cached instantiations for this type argument vector. | 1581 // Return the number of cached instantiations for this type argument vector. |
| 1580 intptr_t NumInstantiations() const; | 1582 intptr_t NumInstantiations() const; |
| 1581 | 1583 |
| 1582 static intptr_t instantiations_offset() { | 1584 static intptr_t instantiations_offset() { |
| 1583 return OFFSET_OF(RawTypeArguments, instantiations_); | 1585 return OFFSET_OF(RawTypeArguments, instantiations_); |
| 1584 } | 1586 } |
| 1585 | 1587 |
| 1586 static const intptr_t kBytesPerElement = kWordSize; | 1588 static const intptr_t kBytesPerElement = kWordSize; |
| 1587 static const intptr_t kMaxElements = kSmiMax / kBytesPerElement; | 1589 static const intptr_t kMaxElements = kSmiMax / kBytesPerElement; |
| 1588 | 1590 |
| 1589 static intptr_t length_offset() { | |
| 1590 return OFFSET_OF(RawTypeArguments, length_); | |
| 1591 } | |
| 1592 | |
| 1593 static intptr_t InstanceSize() { | 1591 static intptr_t InstanceSize() { |
| 1594 ASSERT(sizeof(RawTypeArguments) == | 1592 ASSERT(sizeof(RawTypeArguments) == |
| 1595 OFFSET_OF_RETURNED_VALUE(RawTypeArguments, types)); | 1593 OFFSET_OF_RETURNED_VALUE(RawTypeArguments, types)); |
| 1596 return 0; | 1594 return 0; |
| 1597 } | 1595 } |
| 1598 | 1596 |
| 1599 static intptr_t InstanceSize(intptr_t len) { | 1597 static intptr_t InstanceSize(intptr_t len) { |
| 1600 // Ensure that the types() is not adding to the object size, which includes | 1598 // Ensure that the types() is not adding to the object size, which includes |
| 1601 // 2 fields: instantiations_ and length_. | 1599 // 2 fields: instantiations_ and length_. |
| 1602 ASSERT(sizeof(RawTypeArguments) == (sizeof(RawObject) + (2 * kWordSize))); | 1600 ASSERT(sizeof(RawTypeArguments) == (sizeof(RawObject) + (2 * kWordSize))); |
| (...skipping 5931 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7534 | 7532 |
| 7535 | 7533 |
| 7536 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, | 7534 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, |
| 7537 intptr_t index) { | 7535 intptr_t index) { |
| 7538 return array.At((index * kEntryLength) + kTargetFunctionIndex); | 7536 return array.At((index * kEntryLength) + kTargetFunctionIndex); |
| 7539 } | 7537 } |
| 7540 | 7538 |
| 7541 } // namespace dart | 7539 } // namespace dart |
| 7542 | 7540 |
| 7543 #endif // VM_OBJECT_H_ | 7541 #endif // VM_OBJECT_H_ |
| OLD | NEW |