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

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

Issue 1479483004: Allow in-object properties in JSArrayBuffer. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@in-obj-data-view-and-array-buffer-view
Patch Set: Test updated 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-body-descriptors.h ('k') | test/mjsunit/es6/classes-subclass-builtins.js » ('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 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 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 159
160 class JSArrayBuffer::BodyDescriptor final : public BodyDescriptorBase { 160 class JSArrayBuffer::BodyDescriptor final : public BodyDescriptorBase {
161 public: 161 public:
162 STATIC_ASSERT(kByteLengthOffset + kPointerSize == kBackingStoreOffset); 162 STATIC_ASSERT(kByteLengthOffset + kPointerSize == kBackingStoreOffset);
163 STATIC_ASSERT(kBackingStoreOffset + kPointerSize == kBitFieldSlot); 163 STATIC_ASSERT(kBackingStoreOffset + kPointerSize == kBitFieldSlot);
164 STATIC_ASSERT(kBitFieldSlot + kPointerSize == kSize); 164 STATIC_ASSERT(kBitFieldSlot + kPointerSize == kSize);
165 165
166 static bool IsValidSlot(HeapObject* obj, int offset) { 166 static bool IsValidSlot(HeapObject* obj, int offset) {
167 if (offset < kBackingStoreOffset) return true; 167 if (offset < kBackingStoreOffset) return true;
168 if (offset < kSize) return false; 168 if (offset < kSize) return false;
169 if (offset < kSizeWithInternalFields) return true; 169 return IsValidSlotImpl(obj, offset);
170 // TODO(ishell): v8:4531, fix when JSArrayBuffers are allowed to have
171 // in-object properties
172 // return IsValidSlotImpl(obj, offset);
173 return true;
174 } 170 }
175 171
176 template <typename ObjectVisitor> 172 template <typename ObjectVisitor>
177 static inline void IterateBody(HeapObject* obj, int object_size, 173 static inline void IterateBody(HeapObject* obj, int object_size,
178 ObjectVisitor* v) { 174 ObjectVisitor* v) {
179 IteratePointers(obj, kPropertiesOffset, kBackingStoreOffset, v); 175 IteratePointers(obj, kPropertiesOffset, kBackingStoreOffset, v);
180 IteratePointers(obj, kSize, kSizeWithInternalFields, v); 176 IterateBodyImpl(obj, kSize, object_size, v);
181
182 // TODO(ishell): v8:4531, fix when JSArrayBuffers are allowed to have
183 // in-object properties
184 // IterateBodyImpl(obj, kSize, object_size, v);
185 } 177 }
186 178
187 template <typename StaticVisitor> 179 template <typename StaticVisitor>
188 static inline void IterateBody(HeapObject* obj, int object_size) { 180 static inline void IterateBody(HeapObject* obj, int object_size) {
189 Heap* heap = obj->GetHeap(); 181 Heap* heap = obj->GetHeap();
190 IteratePointers<StaticVisitor>(heap, obj, kPropertiesOffset, 182 IteratePointers<StaticVisitor>(heap, obj, kPropertiesOffset,
191 kBackingStoreOffset); 183 kBackingStoreOffset);
192 IteratePointers<StaticVisitor>(heap, obj, kSize, kSizeWithInternalFields); 184 IterateBodyImpl<StaticVisitor>(heap, obj, kSize, object_size);
193
194 // TODO(ishell): v8:4531, fix when JSArrayBuffers are allowed to have
195 // in-object properties
196 // IterateBodyImpl<StaticVisitor>(heap, obj, kSize, object_size);
197 } 185 }
198 186
199 static inline int SizeOf(Map* map, HeapObject* object) { 187 static inline int SizeOf(Map* map, HeapObject* object) {
200 // TODO(ishell): v8:4531, fix when JSArrayBuffers are allowed to have 188 return map->instance_size();
201 // in-object properties
202 // return map->instance_size();
203 return kSizeWithInternalFields;
204 } 189 }
205 }; 190 };
206 191
207 192
208 class BytecodeArray::BodyDescriptor final : public BodyDescriptorBase { 193 class BytecodeArray::BodyDescriptor final : public BodyDescriptorBase {
209 public: 194 public:
210 static bool IsValidSlot(HeapObject* obj, int offset) { 195 static bool IsValidSlot(HeapObject* obj, int offset) {
211 return offset == kConstantPoolOffset; 196 return offset == kConstantPoolOffset;
212 } 197 }
213 198
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after
570 555
571 template <typename ObjectVisitor> 556 template <typename ObjectVisitor>
572 void HeapObject::IterateBodyFast(InstanceType type, int object_size, 557 void HeapObject::IterateBodyFast(InstanceType type, int object_size,
573 ObjectVisitor* v) { 558 ObjectVisitor* v) {
574 BodyDescriptorApply<CallIterateBody, void>(type, this, object_size, v); 559 BodyDescriptorApply<CallIterateBody, void>(type, this, object_size, v);
575 } 560 }
576 } // namespace internal 561 } // namespace internal
577 } // namespace v8 562 } // namespace v8
578 563
579 #endif // V8_OBJECTS_BODY_DESCRIPTORS_INL_H_ 564 #endif // V8_OBJECTS_BODY_DESCRIPTORS_INL_H_
OLDNEW
« no previous file with comments | « src/objects-body-descriptors.h ('k') | test/mjsunit/es6/classes-subclass-builtins.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698