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

Side by Side Diff: src/layout-descriptor.h

Issue 1033273005: Layout descriptor must be trimmed when corresponding descriptors array is trimmed to stay in sync. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Forgot to actually trim the array Created 5 years, 8 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
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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_LAYOUT_DESCRIPTOR_H_ 5 #ifndef V8_LAYOUT_DESCRIPTOR_H_
6 #define V8_LAYOUT_DESCRIPTOR_H_ 6 #define V8_LAYOUT_DESCRIPTOR_H_
7 7
8 #include <iosfwd> 8 #include <iosfwd>
9 9
10 #include "src/objects.h" 10 #include "src/objects.h"
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 // Otherwise the |full_layout_descriptor| is returned. 63 // Otherwise the |full_layout_descriptor| is returned.
64 static Handle<LayoutDescriptor> AppendIfFastOrUseFull( 64 static Handle<LayoutDescriptor> AppendIfFastOrUseFull(
65 Handle<Map> map, PropertyDetails details, 65 Handle<Map> map, PropertyDetails details,
66 Handle<LayoutDescriptor> full_layout_descriptor); 66 Handle<LayoutDescriptor> full_layout_descriptor);
67 67
68 // Layout descriptor that corresponds to an object all fields of which are 68 // Layout descriptor that corresponds to an object all fields of which are
69 // tagged (FastPointerLayout). 69 // tagged (FastPointerLayout).
70 V8_INLINE static LayoutDescriptor* FastPointerLayout(); 70 V8_INLINE static LayoutDescriptor* FastPointerLayout();
71 71
72 // Check that this layout descriptor corresponds to given map. 72 // Check that this layout descriptor corresponds to given map.
73 bool IsConsistentWithMap(Map* map); 73 bool IsConsistentWithMap(Map* map, bool check_tail = false);
74
75 // Trims this layout descriptor to given number of descriptors. This happens
76 // only when corresponding descriptors array is trimmed.
77 // The layout descriptor could be trimmed if it was slow or it could
78 // become fast.
79 LayoutDescriptor* Trim(Heap* heap, Map* map, DescriptorArray* descriptors,
80 int num_descriptors);
74 81
75 #ifdef OBJECT_PRINT 82 #ifdef OBJECT_PRINT
76 // For our gdb macros, we should perhaps change these in the future. 83 // For our gdb macros, we should perhaps change these in the future.
77 void Print(); 84 void Print();
78 85
79 void Print(std::ostream& os); // NOLINT 86 void Print(std::ostream& os); // NOLINT
80 #endif 87 #endif
81 88
82 // Capacity of layout descriptors in bits. 89 // Capacity of layout descriptors in bits.
83 V8_INLINE int capacity(); 90 V8_INLINE int capacity();
84 91
85 static Handle<LayoutDescriptor> NewForTesting(Isolate* isolate, int length); 92 static Handle<LayoutDescriptor> NewForTesting(Isolate* isolate, int length);
86 LayoutDescriptor* SetTaggedForTesting(int field_index, bool tagged); 93 LayoutDescriptor* SetTaggedForTesting(int field_index, bool tagged);
87 94
88 private: 95 private:
89 static const int kNumberOfBits = 32; 96 static const int kNumberOfBits = 32;
90 97
91 V8_INLINE static Handle<LayoutDescriptor> New(Isolate* isolate, int length); 98 V8_INLINE static Handle<LayoutDescriptor> New(Isolate* isolate, int length);
92 V8_INLINE static LayoutDescriptor* FromSmi(Smi* smi); 99 V8_INLINE static LayoutDescriptor* FromSmi(Smi* smi);
93 100
94 V8_INLINE static bool InobjectUnboxedField(int inobject_properties, 101 V8_INLINE static bool InobjectUnboxedField(int inobject_properties,
95 PropertyDetails details); 102 PropertyDetails details);
96 103
104 // Calculates minimal layout descriptor capacity required for given
105 // |map|, |descriptors| and |num_descriptors|.
106 V8_INLINE static int CalculateCapacity(Map* map, DescriptorArray* descriptors,
107 int num_descriptors);
108
109 // Calculates the length of the slow-mode backing store array by given layout
110 // descriptor length.
111 V8_INLINE static int GetSlowModeBackingStoreLength(int length);
112
113 // Fills in clean |layout_descriptor| according to given |map|, |descriptors|
114 // and |num_descriptors|.
115 V8_INLINE static LayoutDescriptor* Initialize(
116 LayoutDescriptor* layout_descriptor, Map* map,
117 DescriptorArray* descriptors, int num_descriptors);
118
97 static Handle<LayoutDescriptor> EnsureCapacity( 119 static Handle<LayoutDescriptor> EnsureCapacity(
98 Isolate* isolate, Handle<LayoutDescriptor> layout_descriptor, 120 Isolate* isolate, Handle<LayoutDescriptor> layout_descriptor,
99 int new_capacity); 121 int new_capacity);
100 122
101 // Returns false if requested field_index is out of bounds. 123 // Returns false if requested field_index is out of bounds.
102 V8_INLINE bool GetIndexes(int field_index, int* layout_word_index, 124 V8_INLINE bool GetIndexes(int field_index, int* layout_word_index,
103 int* layout_bit_index); 125 int* layout_bit_index);
104 126
105 V8_INLINE MUST_USE_RESULT LayoutDescriptor* SetRawData(int field_index) { 127 V8_INLINE MUST_USE_RESULT LayoutDescriptor* SetRawData(int field_index) {
106 return SetTagged(field_index, false); 128 return SetTagged(field_index, false);
(...skipping 23 matching lines...) Expand all
130 152
131 private: 153 private:
132 bool all_fields_tagged_; 154 bool all_fields_tagged_;
133 int header_size_; 155 int header_size_;
134 LayoutDescriptor* layout_descriptor_; 156 LayoutDescriptor* layout_descriptor_;
135 }; 157 };
136 } 158 }
137 } // namespace v8::internal 159 } // namespace v8::internal
138 160
139 #endif // V8_LAYOUT_DESCRIPTOR_H_ 161 #endif // V8_LAYOUT_DESCRIPTOR_H_
OLDNEW
« no previous file with comments | « src/heap/mark-compact.cc ('k') | src/layout-descriptor.cc » ('j') | src/layout-descriptor.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698