Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(65)

Side by Side Diff: runtime/vm/raw_object.h

Issue 1175523002: Object pool with support for untagged entries. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « runtime/vm/object.cc ('k') | runtime/vm/raw_object.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_RAW_OBJECT_H_ 5 #ifndef VM_RAW_OBJECT_H_
6 #define VM_RAW_OBJECT_H_ 6 #define VM_RAW_OBJECT_H_
7 7
8 #include "platform/assert.h" 8 #include "platform/assert.h"
9 #include "vm/atomic.h" 9 #include "vm/atomic.h"
10 #include "vm/globals.h" 10 #include "vm/globals.h"
(...skipping 13 matching lines...) Expand all
24 V(ClosureData) \ 24 V(ClosureData) \
25 V(RedirectionData) \ 25 V(RedirectionData) \
26 V(Field) \ 26 V(Field) \
27 V(LiteralToken) \ 27 V(LiteralToken) \
28 V(TokenStream) \ 28 V(TokenStream) \
29 V(Script) \ 29 V(Script) \
30 V(Library) \ 30 V(Library) \
31 V(Namespace) \ 31 V(Namespace) \
32 V(Code) \ 32 V(Code) \
33 V(Instructions) \ 33 V(Instructions) \
34 V(ObjectPool) \
34 V(PcDescriptors) \ 35 V(PcDescriptors) \
35 V(Stackmap) \ 36 V(Stackmap) \
36 V(LocalVarDescriptors) \ 37 V(LocalVarDescriptors) \
37 V(ExceptionHandlers) \ 38 V(ExceptionHandlers) \
38 V(Context) \ 39 V(Context) \
39 V(ContextScope) \ 40 V(ContextScope) \
40 V(ICData) \ 41 V(ICData) \
41 V(MegamorphicCache) \ 42 V(MegamorphicCache) \
42 V(SubtypeTestCache) \ 43 V(SubtypeTestCache) \
43 V(Error) \ 44 V(Error) \
(...skipping 951 matching lines...) Expand 10 before | Expand all | Expand 10 after
995 // Variable length data follows here. 996 // Variable length data follows here.
996 int32_t* data() { OPEN_ARRAY_START(int32_t, int32_t); } 997 int32_t* data() { OPEN_ARRAY_START(int32_t, int32_t); }
997 const int32_t* data() const { OPEN_ARRAY_START(int32_t, int32_t); } 998 const int32_t* data() const { OPEN_ARRAY_START(int32_t, int32_t); }
998 999
999 friend class Function; 1000 friend class Function;
1000 friend class MarkingVisitor; 1001 friend class MarkingVisitor;
1001 friend class StackFrame; 1002 friend class StackFrame;
1002 }; 1003 };
1003 1004
1004 1005
1006 class RawObjectPool : public RawObject {
1007 RAW_HEAP_OBJECT_IMPLEMENTATION(ObjectPool);
1008
1009 intptr_t length_;
1010 RawTypedData* info_array_;
1011
1012 struct Entry {
1013 union {
1014 RawObject* raw_obj_;
1015 uword raw_value_;
1016 };
1017 };
1018 Entry* data() { OPEN_ARRAY_START(Entry, Entry); }
1019 Entry const* data() const { OPEN_ARRAY_START(Entry, Entry); }
1020
1021 Entry* first_entry() { return &ptr()->data()[0]; }
1022
1023 friend class Object;
1024 };
1025
1026
1005 class RawInstructions : public RawObject { 1027 class RawInstructions : public RawObject {
1006 RAW_HEAP_OBJECT_IMPLEMENTATION(Instructions); 1028 RAW_HEAP_OBJECT_IMPLEMENTATION(Instructions);
1007 1029
1008 RawObject** from() { 1030 RawObject** from() {
1009 return reinterpret_cast<RawObject**>(&ptr()->code_); 1031 return reinterpret_cast<RawObject**>(&ptr()->code_);
1010 } 1032 }
1011 RawCode* code_; 1033 RawCode* code_;
1012 RawArray* object_pool_; 1034 RawObjectPool* object_pool_;
1013 RawObject** to() { 1035 RawObject** to() {
1014 return reinterpret_cast<RawObject**>(&ptr()->object_pool_); 1036 return reinterpret_cast<RawObject**>(&ptr()->object_pool_);
1015 } 1037 }
1016 int32_t size_; 1038 int32_t size_;
1017 1039
1018 // Variable length data follows here. 1040 // Variable length data follows here.
1019 uint8_t* data() { OPEN_ARRAY_START(uint8_t, uint8_t); } 1041 uint8_t* data() { OPEN_ARRAY_START(uint8_t, uint8_t); }
1020 1042
1021 // Private helper function used while visiting stack frames. The 1043 // Private helper function used while visiting stack frames. The
1022 // code which iterates over dart frames is also called during GC and 1044 // code which iterates over dart frames is also called during GC and
(...skipping 750 matching lines...) Expand 10 before | Expand all | Expand 10 after
1773 RawSmi* length_; 1795 RawSmi* length_;
1774 // Variable length data follows here. 1796 // Variable length data follows here.
1775 uint8_t* data() { OPEN_ARRAY_START(uint8_t, uint8_t); } 1797 uint8_t* data() { OPEN_ARRAY_START(uint8_t, uint8_t); }
1776 const uint8_t* data() const { OPEN_ARRAY_START(uint8_t, uint8_t); } 1798 const uint8_t* data() const { OPEN_ARRAY_START(uint8_t, uint8_t); }
1777 RawObject** to() { return reinterpret_cast<RawObject**>(&ptr()->length_); } 1799 RawObject** to() { return reinterpret_cast<RawObject**>(&ptr()->length_); }
1778 1800
1779 friend class Api; 1801 friend class Api;
1780 friend class Object; 1802 friend class Object;
1781 friend class Instance; 1803 friend class Instance;
1782 friend class SnapshotReader; 1804 friend class SnapshotReader;
1805 friend class ObjectPool;
1806 friend class RawObjectPool;
1783 }; 1807 };
1784 1808
1785 1809
1786 class RawExternalTypedData : public RawInstance { 1810 class RawExternalTypedData : public RawInstance {
1787 RAW_HEAP_OBJECT_IMPLEMENTATION(ExternalTypedData); 1811 RAW_HEAP_OBJECT_IMPLEMENTATION(ExternalTypedData);
1788 1812
1789 protected: 1813 protected:
1790 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->length_); } 1814 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->length_); }
1791 RawSmi* length_; 1815 RawSmi* length_;
1792 RawObject** to() { return reinterpret_cast<RawObject**>(&ptr()->length_); } 1816 RawObject** to() { return reinterpret_cast<RawObject**>(&ptr()->length_); }
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after
2105 2129
2106 inline bool RawObject::IsVariableSizeClassId(intptr_t index) { 2130 inline bool RawObject::IsVariableSizeClassId(intptr_t index) {
2107 return (index == kArrayCid) || 2131 return (index == kArrayCid) ||
2108 (index == kImmutableArrayCid) || 2132 (index == kImmutableArrayCid) ||
2109 RawObject::IsOneByteStringClassId(index) || 2133 RawObject::IsOneByteStringClassId(index) ||
2110 RawObject::IsTwoByteStringClassId(index) || 2134 RawObject::IsTwoByteStringClassId(index) ||
2111 RawObject::IsTypedDataClassId(index) || 2135 RawObject::IsTypedDataClassId(index) ||
2112 (index == kContextCid) || 2136 (index == kContextCid) ||
2113 (index == kTypeArgumentsCid) || 2137 (index == kTypeArgumentsCid) ||
2114 (index == kInstructionsCid) || 2138 (index == kInstructionsCid) ||
2139 (index == kObjectPoolCid) ||
2115 (index == kPcDescriptorsCid) || 2140 (index == kPcDescriptorsCid) ||
2116 (index == kStackmapCid) || 2141 (index == kStackmapCid) ||
2117 (index == kLocalVarDescriptorsCid) || 2142 (index == kLocalVarDescriptorsCid) ||
2118 (index == kExceptionHandlersCid) || 2143 (index == kExceptionHandlersCid) ||
2119 (index == kCodeCid) || 2144 (index == kCodeCid) ||
2120 (index == kContextScopeCid) || 2145 (index == kContextScopeCid) ||
2121 (index == kInstanceCid) || 2146 (index == kInstanceCid) ||
2122 (index == kJSRegExpCid); 2147 (index == kJSRegExpCid);
2123 } 2148 }
2124 2149
(...skipping 12 matching lines...) Expand all
2137 COMPILE_ASSERT(kExternalTypedDataInt8ArrayCid == 2162 COMPILE_ASSERT(kExternalTypedDataInt8ArrayCid ==
2138 kTypedDataInt8ArrayViewCid + 15); 2163 kTypedDataInt8ArrayViewCid + 15);
2139 COMPILE_ASSERT(kByteBufferCid == kExternalTypedDataInt8ArrayCid + 14); 2164 COMPILE_ASSERT(kByteBufferCid == kExternalTypedDataInt8ArrayCid + 14);
2140 COMPILE_ASSERT(kNullCid == kByteBufferCid + 1); 2165 COMPILE_ASSERT(kNullCid == kByteBufferCid + 1);
2141 return (kNullCid - kTypedDataInt8ArrayCid); 2166 return (kNullCid - kTypedDataInt8ArrayCid);
2142 } 2167 }
2143 2168
2144 } // namespace dart 2169 } // namespace dart
2145 2170
2146 #endif // VM_RAW_OBJECT_H_ 2171 #endif // VM_RAW_OBJECT_H_
OLDNEW
« no previous file with comments | « runtime/vm/object.cc ('k') | runtime/vm/raw_object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698