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

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

Issue 1468933004: Allow in-object properties in JSCollections, JSWeakCollections and JSRegExp. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years 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.cc ('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/objects-body-descriptors.h" 8 #include "src/objects-body-descriptors.h"
9 9
10 namespace v8 { 10 namespace v8 {
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 Heap* heap = obj->GetHeap(); 246 Heap* heap = obj->GetHeap();
247 IteratePointer<StaticVisitor>(heap, obj, kBasePointerOffset); 247 IteratePointer<StaticVisitor>(heap, obj, kBasePointerOffset);
248 } 248 }
249 249
250 static inline int SizeOf(Map* map, HeapObject* object) { 250 static inline int SizeOf(Map* map, HeapObject* object) {
251 return reinterpret_cast<FixedTypedArrayBase*>(object)->size(); 251 return reinterpret_cast<FixedTypedArrayBase*>(object)->size();
252 } 252 }
253 }; 253 };
254 254
255 255
256 class JSWeakCollection::BodyDescriptor final : public BodyDescriptorBase { 256 template <JSWeakCollection::BodyVisitingPolicy body_visiting_policy>
257 class JSWeakCollection::BodyDescriptorImpl final : public BodyDescriptorBase {
257 public: 258 public:
259 STATIC_ASSERT(kTableOffset + kPointerSize == kNextOffset);
260 STATIC_ASSERT(kNextOffset + kPointerSize == kSize);
261
258 static bool IsValidSlot(HeapObject* obj, int offset) { 262 static bool IsValidSlot(HeapObject* obj, int offset) {
259 // TODO(ishell): v8:4531, fix when JSWeakCollections are allowed to have 263 return IsValidSlotImpl(obj, offset);
260 // in-object properties
261 // return IsValidSlotImpl(obj, offset);
262 return true;
263 } 264 }
264 265
265 template <typename ObjectVisitor> 266 template <typename ObjectVisitor>
266 static inline void IterateBody(HeapObject* obj, int object_size, 267 static inline void IterateBody(HeapObject* obj, int object_size,
267 ObjectVisitor* v) { 268 ObjectVisitor* v) {
268 IteratePointers(obj, kPropertiesOffset, kSize, v); 269 if (body_visiting_policy == kVisitStrong) {
269 270 IterateBodyImpl(obj, kPropertiesOffset, object_size, v);
270 // TODO(ishell): v8:4531, fix when JSWeakCollections are allowed to have 271 } else {
271 // in-object properties 272 IteratePointers(obj, kPropertiesOffset, kTableOffset, v);
272 // IterateBodyImpl(obj, kSize, object_size, v); 273 IterateBodyImpl(obj, kSize, object_size, v);
274 }
273 } 275 }
274 276
275 template <typename StaticVisitor> 277 template <typename StaticVisitor>
276 static inline void IterateBody(HeapObject* obj, int object_size) { 278 static inline void IterateBody(HeapObject* obj, int object_size) {
277 Heap* heap = obj->GetHeap(); 279 Heap* heap = obj->GetHeap();
278 IteratePointers<StaticVisitor>(heap, obj, kPropertiesOffset, kSize); 280 if (body_visiting_policy == kVisitStrong) {
279 281 IterateBodyImpl<StaticVisitor>(heap, obj, kPropertiesOffset, object_size);
280 // TODO(ishell): v8:4531, fix when JSWeakCollections are allowed to have 282 } else {
281 // in-object properties 283 IteratePointers<StaticVisitor>(heap, obj, kPropertiesOffset,
282 // IterateBodyImpl<StaticVisitor>(heap, obj, kSize, object_size); 284 kTableOffset);
285 IterateBodyImpl<StaticVisitor>(heap, obj, kSize, object_size);
286 }
283 } 287 }
284 288
285 static inline int SizeOf(Map* map, HeapObject* object) { return kSize; } 289 static inline int SizeOf(Map* map, HeapObject* object) {
290 return map->instance_size();
291 }
286 }; 292 };
287 293
288 294
289 class Foreign::BodyDescriptor final : public BodyDescriptorBase { 295 class Foreign::BodyDescriptor final : public BodyDescriptorBase {
290 public: 296 public:
291 static bool IsValidSlot(HeapObject* obj, int offset) { return false; } 297 static bool IsValidSlot(HeapObject* obj, int offset) { return false; }
292 298
293 template <typename ObjectVisitor> 299 template <typename ObjectVisitor>
294 static inline void IterateBody(HeapObject* obj, int object_size, 300 static inline void IterateBody(HeapObject* obj, int object_size,
295 ObjectVisitor* v) { 301 ObjectVisitor* v) {
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
564 570
565 template <typename ObjectVisitor> 571 template <typename ObjectVisitor>
566 void HeapObject::IterateBodyFast(InstanceType type, int object_size, 572 void HeapObject::IterateBodyFast(InstanceType type, int object_size,
567 ObjectVisitor* v) { 573 ObjectVisitor* v) {
568 BodyDescriptorApply<CallIterateBody, void>(type, this, object_size, v); 574 BodyDescriptorApply<CallIterateBody, void>(type, this, object_size, v);
569 } 575 }
570 } // namespace internal 576 } // namespace internal
571 } // namespace v8 577 } // namespace v8
572 578
573 #endif // V8_OBJECTS_BODY_DESCRIPTORS_INL_H_ 579 #endif // V8_OBJECTS_BODY_DESCRIPTORS_INL_H_
OLDNEW
« no previous file with comments | « src/objects.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698