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

Side by Side Diff: src/heap/objects-visiting-inl.h

Issue 2950993002: Make some functions that are hit during renderer startup available for inlining (Closed)
Patch Set: rebase Created 3 years, 5 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/heap/objects-visiting.cc ('k') | src/heap/scavenger.h » ('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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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_VISITING_INL_H_ 5 #ifndef V8_OBJECTS_VISITING_INL_H_
6 #define V8_OBJECTS_VISITING_INL_H_ 6 #define V8_OBJECTS_VISITING_INL_H_
7 7
8 #include "src/heap/array-buffer-tracker.h" 8 #include "src/heap/array-buffer-tracker.h"
9 #include "src/heap/mark-compact.h" 9 #include "src/heap/mark-compact.h"
10 #include "src/heap/objects-visiting.h" 10 #include "src/heap/objects-visiting.h"
11 #include "src/ic/ic-state.h" 11 #include "src/ic/ic-state.h"
12 #include "src/macro-assembler.h" 12 #include "src/macro-assembler.h"
13 #include "src/objects-body-descriptors-inl.h" 13 #include "src/objects-body-descriptors-inl.h"
14 14
15 namespace v8 { 15 namespace v8 {
16 namespace internal { 16 namespace internal {
17 17
18 VisitorId StaticVisitorBase::GetVisitorId(Map* map) {
19 return GetVisitorId(map->instance_type(), map->instance_size(),
20 FLAG_unbox_double_fields && !map->HasFastPointerLayout());
21 }
22
23 VisitorId StaticVisitorBase::GetVisitorId(int instance_type, int instance_size,
24 bool has_unboxed_fields) {
25 if (instance_type < FIRST_NONSTRING_TYPE) {
26 switch (instance_type & kStringRepresentationMask) {
27 case kSeqStringTag:
28 if ((instance_type & kStringEncodingMask) == kOneByteStringTag) {
29 return kVisitSeqOneByteString;
30 } else {
31 return kVisitSeqTwoByteString;
32 }
33
34 case kConsStringTag:
35 if (IsShortcutCandidate(instance_type)) {
36 return kVisitShortcutCandidate;
37 } else {
38 return kVisitConsString;
39 }
40
41 case kSlicedStringTag:
42 return kVisitSlicedString;
43
44 case kExternalStringTag:
45 return kVisitDataObject;
46
47 case kThinStringTag:
48 return kVisitThinString;
49 }
50 UNREACHABLE();
51 }
52
53 switch (instance_type) {
54 case BYTE_ARRAY_TYPE:
55 return kVisitByteArray;
56
57 case BYTECODE_ARRAY_TYPE:
58 return kVisitBytecodeArray;
59
60 case FREE_SPACE_TYPE:
61 return kVisitFreeSpace;
62
63 case FIXED_ARRAY_TYPE:
64 return kVisitFixedArray;
65
66 case FIXED_DOUBLE_ARRAY_TYPE:
67 return kVisitFixedDoubleArray;
68
69 case ODDBALL_TYPE:
70 return kVisitOddball;
71
72 case MAP_TYPE:
73 return kVisitMap;
74
75 case CODE_TYPE:
76 return kVisitCode;
77
78 case CELL_TYPE:
79 return kVisitCell;
80
81 case PROPERTY_CELL_TYPE:
82 return kVisitPropertyCell;
83
84 case WEAK_CELL_TYPE:
85 return kVisitWeakCell;
86
87 case TRANSITION_ARRAY_TYPE:
88 return kVisitTransitionArray;
89
90 case JS_WEAK_MAP_TYPE:
91 case JS_WEAK_SET_TYPE:
92 return kVisitJSWeakCollection;
93
94 case JS_REGEXP_TYPE:
95 return kVisitJSRegExp;
96
97 case SHARED_FUNCTION_INFO_TYPE:
98 return kVisitSharedFunctionInfo;
99
100 case JS_PROXY_TYPE:
101 return kVisitStruct;
102
103 case SYMBOL_TYPE:
104 return kVisitSymbol;
105
106 case JS_ARRAY_BUFFER_TYPE:
107 return kVisitJSArrayBuffer;
108
109 case SMALL_ORDERED_HASH_MAP_TYPE:
110 return kVisitSmallOrderedHashMap;
111
112 case SMALL_ORDERED_HASH_SET_TYPE:
113 return kVisitSmallOrderedHashSet;
114
115 case JS_OBJECT_TYPE:
116 case JS_ERROR_TYPE:
117 case JS_ARGUMENTS_TYPE:
118 case JS_ASYNC_FROM_SYNC_ITERATOR_TYPE:
119 case JS_CONTEXT_EXTENSION_OBJECT_TYPE:
120 case JS_GENERATOR_OBJECT_TYPE:
121 case JS_ASYNC_GENERATOR_OBJECT_TYPE:
122 case JS_MODULE_NAMESPACE_TYPE:
123 case JS_VALUE_TYPE:
124 case JS_DATE_TYPE:
125 case JS_ARRAY_TYPE:
126 case JS_GLOBAL_PROXY_TYPE:
127 case JS_GLOBAL_OBJECT_TYPE:
128 case JS_MESSAGE_OBJECT_TYPE:
129 case JS_TYPED_ARRAY_TYPE:
130 case JS_DATA_VIEW_TYPE:
131 case JS_SET_TYPE:
132 case JS_MAP_TYPE:
133 case JS_SET_ITERATOR_TYPE:
134 case JS_MAP_ITERATOR_TYPE:
135 case JS_STRING_ITERATOR_TYPE:
136
137 case JS_TYPED_ARRAY_KEY_ITERATOR_TYPE:
138 case JS_FAST_ARRAY_KEY_ITERATOR_TYPE:
139 case JS_GENERIC_ARRAY_KEY_ITERATOR_TYPE:
140 case JS_UINT8_ARRAY_KEY_VALUE_ITERATOR_TYPE:
141 case JS_INT8_ARRAY_KEY_VALUE_ITERATOR_TYPE:
142 case JS_UINT16_ARRAY_KEY_VALUE_ITERATOR_TYPE:
143 case JS_INT16_ARRAY_KEY_VALUE_ITERATOR_TYPE:
144 case JS_UINT32_ARRAY_KEY_VALUE_ITERATOR_TYPE:
145 case JS_INT32_ARRAY_KEY_VALUE_ITERATOR_TYPE:
146 case JS_FLOAT32_ARRAY_KEY_VALUE_ITERATOR_TYPE:
147 case JS_FLOAT64_ARRAY_KEY_VALUE_ITERATOR_TYPE:
148 case JS_UINT8_CLAMPED_ARRAY_KEY_VALUE_ITERATOR_TYPE:
149 case JS_FAST_SMI_ARRAY_KEY_VALUE_ITERATOR_TYPE:
150 case JS_FAST_HOLEY_SMI_ARRAY_KEY_VALUE_ITERATOR_TYPE:
151 case JS_FAST_ARRAY_KEY_VALUE_ITERATOR_TYPE:
152 case JS_FAST_HOLEY_ARRAY_KEY_VALUE_ITERATOR_TYPE:
153 case JS_FAST_DOUBLE_ARRAY_KEY_VALUE_ITERATOR_TYPE:
154 case JS_FAST_HOLEY_DOUBLE_ARRAY_KEY_VALUE_ITERATOR_TYPE:
155 case JS_GENERIC_ARRAY_KEY_VALUE_ITERATOR_TYPE:
156 case JS_UINT8_ARRAY_VALUE_ITERATOR_TYPE:
157 case JS_INT8_ARRAY_VALUE_ITERATOR_TYPE:
158 case JS_UINT16_ARRAY_VALUE_ITERATOR_TYPE:
159 case JS_INT16_ARRAY_VALUE_ITERATOR_TYPE:
160 case JS_UINT32_ARRAY_VALUE_ITERATOR_TYPE:
161 case JS_INT32_ARRAY_VALUE_ITERATOR_TYPE:
162 case JS_FLOAT32_ARRAY_VALUE_ITERATOR_TYPE:
163 case JS_FLOAT64_ARRAY_VALUE_ITERATOR_TYPE:
164 case JS_UINT8_CLAMPED_ARRAY_VALUE_ITERATOR_TYPE:
165 case JS_FAST_SMI_ARRAY_VALUE_ITERATOR_TYPE:
166 case JS_FAST_HOLEY_SMI_ARRAY_VALUE_ITERATOR_TYPE:
167 case JS_FAST_ARRAY_VALUE_ITERATOR_TYPE:
168 case JS_FAST_HOLEY_ARRAY_VALUE_ITERATOR_TYPE:
169 case JS_FAST_DOUBLE_ARRAY_VALUE_ITERATOR_TYPE:
170 case JS_FAST_HOLEY_DOUBLE_ARRAY_VALUE_ITERATOR_TYPE:
171 case JS_GENERIC_ARRAY_VALUE_ITERATOR_TYPE:
172
173 case JS_PROMISE_CAPABILITY_TYPE:
174 case JS_PROMISE_TYPE:
175 case JS_BOUND_FUNCTION_TYPE:
176 return has_unboxed_fields ? kVisitJSObject : kVisitJSObjectFast;
177 case JS_API_OBJECT_TYPE:
178 case JS_SPECIAL_API_OBJECT_TYPE:
179 return kVisitJSApiObject;
180
181 case JS_FUNCTION_TYPE:
182 return kVisitJSFunction;
183
184 case FILLER_TYPE:
185 case FOREIGN_TYPE:
186 case HEAP_NUMBER_TYPE:
187 case MUTABLE_HEAP_NUMBER_TYPE:
188 return kVisitDataObject;
189
190 case FIXED_UINT8_ARRAY_TYPE:
191 case FIXED_INT8_ARRAY_TYPE:
192 case FIXED_UINT16_ARRAY_TYPE:
193 case FIXED_INT16_ARRAY_TYPE:
194 case FIXED_UINT32_ARRAY_TYPE:
195 case FIXED_INT32_ARRAY_TYPE:
196 case FIXED_FLOAT32_ARRAY_TYPE:
197 case FIXED_UINT8_CLAMPED_ARRAY_TYPE:
198 return kVisitFixedTypedArrayBase;
199
200 case FIXED_FLOAT64_ARRAY_TYPE:
201 return kVisitFixedFloat64Array;
202
203 #define MAKE_STRUCT_CASE(NAME, Name, name) case NAME##_TYPE:
204 STRUCT_LIST(MAKE_STRUCT_CASE)
205 #undef MAKE_STRUCT_CASE
206 if (instance_type == ALLOCATION_SITE_TYPE) {
207 return kVisitAllocationSite;
208 }
209
210 return kVisitStruct;
211
212 default:
213 UNREACHABLE();
214 }
215 }
18 216
19 template <typename Callback> 217 template <typename Callback>
20 Callback VisitorDispatchTable<Callback>::GetVisitor(Map* map) { 218 Callback VisitorDispatchTable<Callback>::GetVisitor(Map* map) {
21 return reinterpret_cast<Callback>(callbacks_[map->visitor_id()]); 219 return reinterpret_cast<Callback>(callbacks_[map->visitor_id()]);
22 } 220 }
23 221
24 template <typename StaticVisitor> 222 template <typename StaticVisitor>
25 void StaticMarkingVisitor<StaticVisitor>::Initialize() { 223 void StaticMarkingVisitor<StaticVisitor>::Initialize() {
26 table_.Register(kVisitShortcutCandidate, 224 table_.Register(kVisitShortcutCandidate,
27 &FixedBodyVisitor<StaticVisitor, ConsString::BodyDescriptor, 225 &FixedBodyVisitor<StaticVisitor, ConsString::BodyDescriptor,
(...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after
554 int size = Context::BodyDescriptor::SizeOf(map, object); 752 int size = Context::BodyDescriptor::SizeOf(map, object);
555 VisitMapPointer(object, object->map_slot()); 753 VisitMapPointer(object, object->map_slot());
556 Context::BodyDescriptor::IterateBody(object, size, this); 754 Context::BodyDescriptor::IterateBody(object, size, this);
557 return size; 755 return size;
558 } 756 }
559 757
560 } // namespace internal 758 } // namespace internal
561 } // namespace v8 759 } // namespace v8
562 760
563 #endif // V8_OBJECTS_VISITING_INL_H_ 761 #endif // V8_OBJECTS_VISITING_INL_H_
OLDNEW
« no previous file with comments | « src/heap/objects-visiting.cc ('k') | src/heap/scavenger.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698