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

Side by Side Diff: src/objects-body-descriptors-inl.h

Issue 2763413007: [heap] Remove size specializations in static object visitors. (Closed)
Patch Set: fast body descriptor for js objects Created 3 years, 9 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 | « src/objects.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef V8_OBJECTS_BODY_DESCRIPTORS_INL_H_ 5 #ifndef V8_OBJECTS_BODY_DESCRIPTORS_INL_H_
6 #define V8_OBJECTS_BODY_DESCRIPTORS_INL_H_ 6 #define V8_OBJECTS_BODY_DESCRIPTORS_INL_H_
7 7
8 #include "src/assembler-inl.h" 8 #include "src/assembler-inl.h"
9 #include "src/objects-body-descriptors.h" 9 #include "src/objects-body-descriptors.h"
10 #include "src/transitions.h" 10 #include "src/transitions.h"
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 static inline void IterateBody(HeapObject* obj, int object_size) { 124 static inline void IterateBody(HeapObject* obj, int object_size) {
125 Heap* heap = obj->GetHeap(); 125 Heap* heap = obj->GetHeap();
126 IterateBodyImpl<StaticVisitor>(heap, obj, kStartOffset, object_size); 126 IterateBodyImpl<StaticVisitor>(heap, obj, kStartOffset, object_size);
127 } 127 }
128 128
129 static inline int SizeOf(Map* map, HeapObject* object) { 129 static inline int SizeOf(Map* map, HeapObject* object) {
130 return map->instance_size(); 130 return map->instance_size();
131 } 131 }
132 }; 132 };
133 133
134 class JSObject::FastBodyDescriptor final : public BodyDescriptorBase {
ulan 2017/03/27 11:23:24 This is the same as FlexibleBodyDescriptor except
135 public:
136 static const int kStartOffset = JSReceiver::kPropertiesOffset;
137
138 static bool IsValidSlot(HeapObject* obj, int offset) {
139 return offset >= kStartOffset;
140 }
141
142 template <typename ObjectVisitor>
143 static inline void IterateBody(HeapObject* obj, int object_size,
144 ObjectVisitor* v) {
145 IteratePointers(obj, kStartOffset, object_size, v);
146 }
147
148 template <typename StaticVisitor>
149 static inline void IterateBody(HeapObject* obj, int object_size) {
150 Heap* heap = obj->GetHeap();
151 IteratePointers<StaticVisitor>(heap, obj, kStartOffset, object_size);
152 }
153
154 static inline int SizeOf(Map* map, HeapObject* object) {
155 return map->instance_size();
156 }
157 };
158
134 // Iterates the function object according to the visiting policy. 159 // Iterates the function object according to the visiting policy.
135 template <JSFunction::BodyVisitingPolicy body_visiting_policy> 160 template <JSFunction::BodyVisitingPolicy body_visiting_policy>
136 class JSFunction::BodyDescriptorImpl final : public BodyDescriptorBase { 161 class JSFunction::BodyDescriptorImpl final : public BodyDescriptorBase {
137 public: 162 public:
138 STATIC_ASSERT(kNonWeakFieldsEndOffset == kCodeEntryOffset); 163 STATIC_ASSERT(kNonWeakFieldsEndOffset == kCodeEntryOffset);
139 STATIC_ASSERT(kCodeEntryOffset + kPointerSize == kNextFunctionLinkOffset); 164 STATIC_ASSERT(kCodeEntryOffset + kPointerSize == kNextFunctionLinkOffset);
140 STATIC_ASSERT(kNextFunctionLinkOffset + kPointerSize == kSize); 165 STATIC_ASSERT(kNextFunctionLinkOffset + kPointerSize == kSize);
141 166
142 static bool IsValidSlot(HeapObject* obj, int offset) { 167 static bool IsValidSlot(HeapObject* obj, int offset) {
143 if (offset < kSize) return true; 168 if (offset < kSize) return true;
(...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after
625 650
626 template <typename ObjectVisitor> 651 template <typename ObjectVisitor>
627 void HeapObject::IterateBodyFast(InstanceType type, int object_size, 652 void HeapObject::IterateBodyFast(InstanceType type, int object_size,
628 ObjectVisitor* v) { 653 ObjectVisitor* v) {
629 BodyDescriptorApply<CallIterateBody, void>(type, this, object_size, v); 654 BodyDescriptorApply<CallIterateBody, void>(type, this, object_size, v);
630 } 655 }
631 } // namespace internal 656 } // namespace internal
632 } // namespace v8 657 } // namespace v8
633 658
634 #endif // V8_OBJECTS_BODY_DESCRIPTORS_INL_H_ 659 #endif // V8_OBJECTS_BODY_DESCRIPTORS_INL_H_
OLDNEW
« no previous file with comments | « src/objects.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698