OLD | NEW |
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 #include "src/compiler/access-builder.h" | 5 #include "src/compiler/access-builder.h" |
6 | 6 |
7 #include "src/contexts.h" | 7 #include "src/contexts.h" |
8 #include "src/frames.h" | 8 #include "src/frames.h" |
9 #include "src/handles-inl.h" | 9 #include "src/handles-inl.h" |
10 #include "src/heap/heap.h" | 10 #include "src/heap/heap.h" |
11 #include "src/type-cache.h" | 11 #include "src/type-cache.h" |
12 | 12 |
13 namespace v8 { | 13 namespace v8 { |
14 namespace internal { | 14 namespace internal { |
15 namespace compiler { | 15 namespace compiler { |
16 | 16 |
17 // static | 17 // static |
18 FieldAccess AccessBuilder::ForMap() { | 18 FieldAccess AccessBuilder::ForMap() { |
19 FieldAccess access = { | 19 FieldAccess access = {kTaggedBase, HeapObject::kMapOffset, |
20 kTaggedBase, HeapObject::kMapOffset, MaybeHandle<Name>(), | 20 MaybeHandle<Name>(), Type::Any(), |
21 Type::Any(), MachineType::AnyTagged(), kMapWriteBarrier}; | 21 MachineType::AnyTagged()}; |
22 return access; | 22 return access; |
23 } | 23 } |
24 | 24 |
25 | 25 |
26 // static | 26 // static |
27 FieldAccess AccessBuilder::ForHeapNumberValue() { | 27 FieldAccess AccessBuilder::ForHeapNumberValue() { |
28 FieldAccess access = {kTaggedBase, | 28 FieldAccess access = {kTaggedBase, HeapNumber::kValueOffset, |
29 HeapNumber::kValueOffset, | 29 MaybeHandle<Name>(), TypeCache::Get().kFloat64, |
30 MaybeHandle<Name>(), | 30 MachineType::Float64()}; |
31 TypeCache::Get().kFloat64, | |
32 MachineType::Float64(), | |
33 kNoWriteBarrier}; | |
34 return access; | 31 return access; |
35 } | 32 } |
36 | 33 |
37 | 34 |
38 // static | 35 // static |
39 FieldAccess AccessBuilder::ForJSObjectProperties() { | 36 FieldAccess AccessBuilder::ForJSObjectProperties() { |
40 FieldAccess access = { | 37 FieldAccess access = {kTaggedBase, JSObject::kPropertiesOffset, |
41 kTaggedBase, JSObject::kPropertiesOffset, MaybeHandle<Name>(), | 38 MaybeHandle<Name>(), Type::Internal(), |
42 Type::Internal(), MachineType::AnyTagged(), kPointerWriteBarrier}; | 39 MachineType::AnyTagged()}; |
43 return access; | 40 return access; |
44 } | 41 } |
45 | 42 |
46 | 43 |
47 // static | 44 // static |
48 FieldAccess AccessBuilder::ForJSObjectElements() { | 45 FieldAccess AccessBuilder::ForJSObjectElements() { |
49 FieldAccess access = { | 46 FieldAccess access = {kTaggedBase, JSObject::kElementsOffset, |
50 kTaggedBase, JSObject::kElementsOffset, MaybeHandle<Name>(), | 47 MaybeHandle<Name>(), Type::Internal(), |
51 Type::Internal(), MachineType::AnyTagged(), kPointerWriteBarrier}; | 48 MachineType::AnyTagged()}; |
52 return access; | 49 return access; |
53 } | 50 } |
54 | 51 |
55 | 52 |
56 // static | 53 // static |
57 FieldAccess AccessBuilder::ForJSObjectInObjectProperty(Handle<Map> map, | 54 FieldAccess AccessBuilder::ForJSObjectInObjectProperty(Handle<Map> map, |
58 int index) { | 55 int index) { |
59 int const offset = map->GetInObjectPropertyOffset(index); | 56 int const offset = map->GetInObjectPropertyOffset(index); |
60 FieldAccess access = {kTaggedBase, | 57 FieldAccess access = {kTaggedBase, offset, MaybeHandle<Name>(), |
61 offset, | 58 Type::Tagged(), MachineType::AnyTagged()}; |
62 MaybeHandle<Name>(), | |
63 Type::Tagged(), | |
64 MachineType::AnyTagged(), | |
65 kFullWriteBarrier}; | |
66 return access; | 59 return access; |
67 } | 60 } |
68 | 61 |
69 | 62 |
70 // static | 63 // static |
71 FieldAccess AccessBuilder::ForJSFunctionPrototypeOrInitialMap() { | 64 FieldAccess AccessBuilder::ForJSFunctionPrototypeOrInitialMap() { |
72 FieldAccess access = {kTaggedBase, | 65 FieldAccess access = {kTaggedBase, JSFunction::kPrototypeOrInitialMapOffset, |
73 JSFunction::kPrototypeOrInitialMapOffset, | 66 MaybeHandle<Name>(), Type::Any(), |
74 MaybeHandle<Name>(), | 67 MachineType::AnyTagged()}; |
75 Type::Any(), | |
76 MachineType::AnyTagged(), | |
77 kFullWriteBarrier}; | |
78 return access; | 68 return access; |
79 } | 69 } |
80 | 70 |
81 // static | 71 // static |
82 FieldAccess AccessBuilder::ForJSFunctionContext() { | 72 FieldAccess AccessBuilder::ForJSFunctionContext() { |
83 FieldAccess access = { | 73 FieldAccess access = {kTaggedBase, JSFunction::kContextOffset, |
84 kTaggedBase, JSFunction::kContextOffset, MaybeHandle<Name>(), | 74 MaybeHandle<Name>(), Type::Internal(), |
85 Type::Internal(), MachineType::AnyTagged(), kPointerWriteBarrier}; | 75 MachineType::AnyTagged()}; |
86 return access; | 76 return access; |
87 } | 77 } |
88 | 78 |
89 | 79 |
90 // static | 80 // static |
91 FieldAccess AccessBuilder::ForJSFunctionSharedFunctionInfo() { | 81 FieldAccess AccessBuilder::ForJSFunctionSharedFunctionInfo() { |
92 FieldAccess access = {kTaggedBase, | 82 FieldAccess access = {kTaggedBase, JSFunction::kSharedFunctionInfoOffset, |
93 JSFunction::kSharedFunctionInfoOffset, | 83 Handle<Name>(), Type::Any(), MachineType::AnyTagged()}; |
94 Handle<Name>(), | |
95 Type::Any(), | |
96 MachineType::AnyTagged(), | |
97 kPointerWriteBarrier}; | |
98 return access; | 84 return access; |
99 } | 85 } |
100 | 86 |
101 | 87 |
102 // static | 88 // static |
103 FieldAccess AccessBuilder::ForJSFunctionLiterals() { | 89 FieldAccess AccessBuilder::ForJSFunctionLiterals() { |
104 FieldAccess access = { | 90 FieldAccess access = {kTaggedBase, JSFunction::kLiteralsOffset, |
105 kTaggedBase, JSFunction::kLiteralsOffset, Handle<Name>(), | 91 Handle<Name>(), Type::Internal(), |
106 Type::Internal(), MachineType::AnyTagged(), kPointerWriteBarrier}; | 92 MachineType::AnyTagged()}; |
107 return access; | 93 return access; |
108 } | 94 } |
109 | 95 |
110 // static | 96 // static |
111 FieldAccess AccessBuilder::ForJSFunctionCodeEntry() { | 97 FieldAccess AccessBuilder::ForJSFunctionCodeEntry() { |
112 FieldAccess access = {kTaggedBase, | 98 FieldAccess access = {kTaggedBase, JSFunction::kCodeEntryOffset, |
113 JSFunction::kCodeEntryOffset, | 99 Handle<Name>(), Type::UntaggedPointer(), |
114 Handle<Name>(), | 100 MachineType::Pointer()}; |
115 Type::UntaggedPointer(), | |
116 MachineType::Pointer(), | |
117 kNoWriteBarrier}; | |
118 return access; | 101 return access; |
119 } | 102 } |
120 | 103 |
121 // static | 104 // static |
122 FieldAccess AccessBuilder::ForJSFunctionNextFunctionLink() { | 105 FieldAccess AccessBuilder::ForJSFunctionNextFunctionLink() { |
123 FieldAccess access = {kTaggedBase, | 106 FieldAccess access = {kTaggedBase, JSFunction::kNextFunctionLinkOffset, |
124 JSFunction::kNextFunctionLinkOffset, | 107 Handle<Name>(), Type::Any(), MachineType::AnyTagged()}; |
125 Handle<Name>(), | |
126 Type::Any(), | |
127 MachineType::AnyTagged(), | |
128 kPointerWriteBarrier}; | |
129 return access; | 108 return access; |
130 } | 109 } |
131 | 110 |
132 // static | 111 // static |
133 FieldAccess AccessBuilder::ForJSArrayLength(ElementsKind elements_kind) { | 112 FieldAccess AccessBuilder::ForJSArrayLength(ElementsKind elements_kind) { |
134 TypeCache const& type_cache = TypeCache::Get(); | 113 TypeCache const& type_cache = TypeCache::Get(); |
135 FieldAccess access = {kTaggedBase, | 114 FieldAccess access = {kTaggedBase, JSArray::kLengthOffset, Handle<Name>(), |
136 JSArray::kLengthOffset, | |
137 Handle<Name>(), | |
138 type_cache.kJSArrayLengthType, | 115 type_cache.kJSArrayLengthType, |
139 MachineType::AnyTagged(), | 116 MachineType::AnyTagged()}; |
140 kFullWriteBarrier}; | |
141 if (IsFastDoubleElementsKind(elements_kind)) { | 117 if (IsFastDoubleElementsKind(elements_kind)) { |
142 access.type = type_cache.kFixedDoubleArrayLengthType; | 118 access.type = type_cache.kFixedDoubleArrayLengthType; |
143 access.write_barrier_kind = kNoWriteBarrier; | |
144 } else if (IsFastElementsKind(elements_kind)) { | 119 } else if (IsFastElementsKind(elements_kind)) { |
145 access.type = type_cache.kFixedArrayLengthType; | 120 access.type = type_cache.kFixedArrayLengthType; |
146 access.write_barrier_kind = kNoWriteBarrier; | |
147 } | 121 } |
148 return access; | 122 return access; |
149 } | 123 } |
150 | 124 |
151 | 125 |
152 // static | 126 // static |
153 FieldAccess AccessBuilder::ForJSArrayBufferBackingStore() { | 127 FieldAccess AccessBuilder::ForJSArrayBufferBackingStore() { |
154 FieldAccess access = {kTaggedBase, | 128 FieldAccess access = {kTaggedBase, JSArrayBuffer::kBackingStoreOffset, |
155 JSArrayBuffer::kBackingStoreOffset, | 129 MaybeHandle<Name>(), Type::UntaggedPointer(), |
156 MaybeHandle<Name>(), | 130 MachineType::Pointer()}; |
157 Type::UntaggedPointer(), | |
158 MachineType::Pointer(), | |
159 kNoWriteBarrier}; | |
160 return access; | 131 return access; |
161 } | 132 } |
162 | 133 |
163 | 134 |
164 // static | 135 // static |
165 FieldAccess AccessBuilder::ForJSArrayBufferBitField() { | 136 FieldAccess AccessBuilder::ForJSArrayBufferBitField() { |
166 FieldAccess access = {kTaggedBase, JSArrayBuffer::kBitFieldOffset, | 137 FieldAccess access = {kTaggedBase, JSArrayBuffer::kBitFieldOffset, |
167 MaybeHandle<Name>(), TypeCache::Get().kInt8, | 138 MaybeHandle<Name>(), TypeCache::Get().kInt8, |
168 MachineType::Int8(), kNoWriteBarrier}; | 139 MachineType::Int8()}; |
169 return access; | 140 return access; |
170 } | 141 } |
171 | 142 |
172 | 143 |
173 // static | 144 // static |
174 FieldAccess AccessBuilder::ForJSArrayBufferViewBuffer() { | 145 FieldAccess AccessBuilder::ForJSArrayBufferViewBuffer() { |
175 FieldAccess access = {kTaggedBase, | 146 FieldAccess access = {kTaggedBase, JSArrayBufferView::kBufferOffset, |
176 JSArrayBufferView::kBufferOffset, | 147 MaybeHandle<Name>(), Type::TaggedPointer(), |
177 MaybeHandle<Name>(), | 148 MachineType::AnyTagged()}; |
178 Type::TaggedPointer(), | |
179 MachineType::AnyTagged(), | |
180 kPointerWriteBarrier}; | |
181 return access; | 149 return access; |
182 } | 150 } |
183 | 151 |
184 | 152 |
185 // static | 153 // static |
186 FieldAccess AccessBuilder::ForJSDateField(JSDate::FieldIndex index) { | 154 FieldAccess AccessBuilder::ForJSDateField(JSDate::FieldIndex index) { |
187 FieldAccess access = {kTaggedBase, | 155 FieldAccess access = { |
188 JSDate::kValueOffset + index * kPointerSize, | 156 kTaggedBase, JSDate::kValueOffset + index * kPointerSize, |
189 MaybeHandle<Name>(), | 157 MaybeHandle<Name>(), Type::Number(), MachineType::AnyTagged()}; |
190 Type::Number(), | |
191 MachineType::AnyTagged(), | |
192 kFullWriteBarrier}; | |
193 return access; | 158 return access; |
194 } | 159 } |
195 | 160 |
196 | 161 |
197 // static | 162 // static |
198 FieldAccess AccessBuilder::ForJSIteratorResultDone() { | 163 FieldAccess AccessBuilder::ForJSIteratorResultDone() { |
199 FieldAccess access = { | 164 FieldAccess access = {kTaggedBase, JSIteratorResult::kDoneOffset, |
200 kTaggedBase, JSIteratorResult::kDoneOffset, MaybeHandle<Name>(), | 165 MaybeHandle<Name>(), Type::Any(), |
201 Type::Any(), MachineType::AnyTagged(), kFullWriteBarrier}; | 166 MachineType::AnyTagged()}; |
202 return access; | 167 return access; |
203 } | 168 } |
204 | 169 |
205 | 170 |
206 // static | 171 // static |
207 FieldAccess AccessBuilder::ForJSIteratorResultValue() { | 172 FieldAccess AccessBuilder::ForJSIteratorResultValue() { |
208 FieldAccess access = { | 173 FieldAccess access = {kTaggedBase, JSIteratorResult::kValueOffset, |
209 kTaggedBase, JSIteratorResult::kValueOffset, MaybeHandle<Name>(), | 174 MaybeHandle<Name>(), Type::Any(), |
210 Type::Any(), MachineType::AnyTagged(), kFullWriteBarrier}; | 175 MachineType::AnyTagged()}; |
211 return access; | 176 return access; |
212 } | 177 } |
213 | 178 |
214 | 179 |
215 // static | 180 // static |
216 FieldAccess AccessBuilder::ForJSRegExpFlags() { | 181 FieldAccess AccessBuilder::ForJSRegExpFlags() { |
217 FieldAccess access = { | 182 FieldAccess access = {kTaggedBase, JSRegExp::kFlagsOffset, |
218 kTaggedBase, JSRegExp::kFlagsOffset, MaybeHandle<Name>(), | 183 MaybeHandle<Name>(), Type::Tagged(), |
219 Type::Tagged(), MachineType::AnyTagged(), kFullWriteBarrier}; | 184 MachineType::AnyTagged()}; |
220 return access; | 185 return access; |
221 } | 186 } |
222 | 187 |
223 | 188 |
224 // static | 189 // static |
225 FieldAccess AccessBuilder::ForJSRegExpSource() { | 190 FieldAccess AccessBuilder::ForJSRegExpSource() { |
226 FieldAccess access = { | 191 FieldAccess access = {kTaggedBase, JSRegExp::kSourceOffset, |
227 kTaggedBase, JSRegExp::kSourceOffset, MaybeHandle<Name>(), | 192 MaybeHandle<Name>(), Type::Tagged(), |
228 Type::Tagged(), MachineType::AnyTagged(), kFullWriteBarrier}; | 193 MachineType::AnyTagged()}; |
229 return access; | 194 return access; |
230 } | 195 } |
231 | 196 |
232 | 197 |
233 // static | 198 // static |
234 FieldAccess AccessBuilder::ForFixedArrayLength() { | 199 FieldAccess AccessBuilder::ForFixedArrayLength() { |
235 FieldAccess access = {kTaggedBase, | 200 FieldAccess access = { |
236 FixedArray::kLengthOffset, | 201 kTaggedBase, FixedArray::kLengthOffset, MaybeHandle<Name>(), |
237 MaybeHandle<Name>(), | 202 TypeCache::Get().kFixedArrayLengthType, MachineType::AnyTagged()}; |
238 TypeCache::Get().kFixedArrayLengthType, | |
239 MachineType::AnyTagged(), | |
240 kNoWriteBarrier}; | |
241 return access; | 203 return access; |
242 } | 204 } |
243 | 205 |
244 | 206 |
245 // static | 207 // static |
246 FieldAccess AccessBuilder::ForDescriptorArrayEnumCache() { | 208 FieldAccess AccessBuilder::ForDescriptorArrayEnumCache() { |
247 FieldAccess access = {kTaggedBase, | 209 FieldAccess access = {kTaggedBase, DescriptorArray::kEnumCacheOffset, |
248 DescriptorArray::kEnumCacheOffset, | 210 Handle<Name>(), Type::TaggedPointer(), |
249 Handle<Name>(), | 211 MachineType::AnyTagged()}; |
250 Type::TaggedPointer(), | |
251 MachineType::AnyTagged(), | |
252 kPointerWriteBarrier}; | |
253 return access; | 212 return access; |
254 } | 213 } |
255 | 214 |
256 | 215 |
257 // static | 216 // static |
258 FieldAccess AccessBuilder::ForDescriptorArrayEnumCacheBridgeCache() { | 217 FieldAccess AccessBuilder::ForDescriptorArrayEnumCacheBridgeCache() { |
259 FieldAccess access = {kTaggedBase, | 218 FieldAccess access = { |
260 DescriptorArray::kEnumCacheBridgeCacheOffset, | 219 kTaggedBase, DescriptorArray::kEnumCacheBridgeCacheOffset, Handle<Name>(), |
261 Handle<Name>(), | 220 Type::TaggedPointer(), MachineType::AnyTagged()}; |
262 Type::TaggedPointer(), | |
263 MachineType::AnyTagged(), | |
264 kPointerWriteBarrier}; | |
265 return access; | 221 return access; |
266 } | 222 } |
267 | 223 |
268 | 224 |
269 // static | 225 // static |
270 FieldAccess AccessBuilder::ForMapBitField() { | 226 FieldAccess AccessBuilder::ForMapBitField() { |
271 FieldAccess access = {kTaggedBase, Map::kBitFieldOffset, | 227 FieldAccess access = {kTaggedBase, Map::kBitFieldOffset, Handle<Name>(), |
272 Handle<Name>(), TypeCache::Get().kUint8, | 228 TypeCache::Get().kUint8, MachineType::Uint8()}; |
273 MachineType::Uint8(), kNoWriteBarrier}; | |
274 return access; | 229 return access; |
275 } | 230 } |
276 | 231 |
277 | 232 |
278 // static | 233 // static |
279 FieldAccess AccessBuilder::ForMapBitField3() { | 234 FieldAccess AccessBuilder::ForMapBitField3() { |
280 FieldAccess access = {kTaggedBase, Map::kBitField3Offset, | 235 FieldAccess access = {kTaggedBase, Map::kBitField3Offset, Handle<Name>(), |
281 Handle<Name>(), TypeCache::Get().kInt32, | 236 TypeCache::Get().kInt32, MachineType::Int32()}; |
282 MachineType::Int32(), kNoWriteBarrier}; | |
283 return access; | 237 return access; |
284 } | 238 } |
285 | 239 |
286 | 240 |
287 // static | 241 // static |
288 FieldAccess AccessBuilder::ForMapDescriptors() { | 242 FieldAccess AccessBuilder::ForMapDescriptors() { |
289 FieldAccess access = { | 243 FieldAccess access = {kTaggedBase, Map::kDescriptorsOffset, Handle<Name>(), |
290 kTaggedBase, Map::kDescriptorsOffset, Handle<Name>(), | 244 Type::TaggedPointer(), MachineType::AnyTagged()}; |
291 Type::TaggedPointer(), MachineType::AnyTagged(), kPointerWriteBarrier}; | |
292 return access; | 245 return access; |
293 } | 246 } |
294 | 247 |
295 | 248 |
296 // static | 249 // static |
297 FieldAccess AccessBuilder::ForMapInstanceType() { | 250 FieldAccess AccessBuilder::ForMapInstanceType() { |
298 FieldAccess access = {kTaggedBase, Map::kInstanceTypeOffset, | 251 FieldAccess access = {kTaggedBase, Map::kInstanceTypeOffset, Handle<Name>(), |
299 Handle<Name>(), TypeCache::Get().kUint8, | 252 TypeCache::Get().kUint8, MachineType::Uint8()}; |
300 MachineType::Uint8(), kNoWriteBarrier}; | |
301 return access; | 253 return access; |
302 } | 254 } |
303 | 255 |
304 | 256 |
305 // static | 257 // static |
306 FieldAccess AccessBuilder::ForMapPrototype() { | 258 FieldAccess AccessBuilder::ForMapPrototype() { |
307 FieldAccess access = { | 259 FieldAccess access = {kTaggedBase, Map::kPrototypeOffset, Handle<Name>(), |
308 kTaggedBase, Map::kPrototypeOffset, Handle<Name>(), | 260 Type::TaggedPointer(), MachineType::AnyTagged()}; |
309 Type::TaggedPointer(), MachineType::AnyTagged(), kPointerWriteBarrier}; | |
310 return access; | 261 return access; |
311 } | 262 } |
312 | 263 |
313 | 264 |
314 // static | 265 // static |
315 FieldAccess AccessBuilder::ForStringLength() { | 266 FieldAccess AccessBuilder::ForStringLength() { |
316 FieldAccess access = {kTaggedBase, | 267 FieldAccess access = {kTaggedBase, String::kLengthOffset, Handle<Name>(), |
317 String::kLengthOffset, | |
318 Handle<Name>(), | |
319 TypeCache::Get().kStringLengthType, | 268 TypeCache::Get().kStringLengthType, |
320 MachineType::AnyTagged(), | 269 MachineType::AnyTagged()}; |
321 kNoWriteBarrier}; | |
322 return access; | 270 return access; |
323 } | 271 } |
324 | 272 |
325 | 273 |
326 // static | 274 // static |
327 FieldAccess AccessBuilder::ForJSGlobalObjectGlobalProxy() { | 275 FieldAccess AccessBuilder::ForJSGlobalObjectGlobalProxy() { |
328 FieldAccess access = {kTaggedBase, | 276 FieldAccess access = {kTaggedBase, JSGlobalObject::kGlobalProxyOffset, |
329 JSGlobalObject::kGlobalProxyOffset, | 277 Handle<Name>(), Type::Receiver(), |
330 Handle<Name>(), | 278 MachineType::AnyTagged()}; |
331 Type::Receiver(), | |
332 MachineType::AnyTagged(), | |
333 kPointerWriteBarrier}; | |
334 return access; | 279 return access; |
335 } | 280 } |
336 | 281 |
337 | 282 |
338 // static | 283 // static |
339 FieldAccess AccessBuilder::ForJSGlobalObjectNativeContext() { | 284 FieldAccess AccessBuilder::ForJSGlobalObjectNativeContext() { |
340 FieldAccess access = {kTaggedBase, | 285 FieldAccess access = {kTaggedBase, JSGlobalObject::kNativeContextOffset, |
341 JSGlobalObject::kNativeContextOffset, | 286 Handle<Name>(), Type::Internal(), |
342 Handle<Name>(), | 287 MachineType::AnyTagged()}; |
343 Type::Internal(), | |
344 MachineType::AnyTagged(), | |
345 kPointerWriteBarrier}; | |
346 return access; | 288 return access; |
347 } | 289 } |
348 | 290 |
349 | 291 |
350 // static | 292 // static |
351 FieldAccess AccessBuilder::ForValue() { | 293 FieldAccess AccessBuilder::ForValue() { |
352 FieldAccess access = { | 294 FieldAccess access = {kTaggedBase, JSValue::kValueOffset, Handle<Name>(), |
353 kTaggedBase, JSValue::kValueOffset, Handle<Name>(), | 295 Type::Any(), MachineType::AnyTagged()}; |
354 Type::Any(), MachineType::AnyTagged(), kFullWriteBarrier}; | |
355 return access; | 296 return access; |
356 } | 297 } |
357 | 298 |
358 | 299 |
359 // static | 300 // static |
360 FieldAccess AccessBuilder::ForArgumentsLength() { | 301 FieldAccess AccessBuilder::ForArgumentsLength() { |
361 FieldAccess access = { | 302 FieldAccess access = {kTaggedBase, JSArgumentsObject::kLengthOffset, |
362 kTaggedBase, JSArgumentsObject::kLengthOffset, Handle<Name>(), | 303 Handle<Name>(), Type::Any(), MachineType::AnyTagged()}; |
363 Type::Any(), MachineType::AnyTagged(), kFullWriteBarrier}; | |
364 return access; | 304 return access; |
365 } | 305 } |
366 | 306 |
367 | 307 |
368 // static | 308 // static |
369 FieldAccess AccessBuilder::ForArgumentsCallee() { | 309 FieldAccess AccessBuilder::ForArgumentsCallee() { |
370 FieldAccess access = {kTaggedBase, | 310 FieldAccess access = {kTaggedBase, JSSloppyArgumentsObject::kCalleeOffset, |
371 JSSloppyArgumentsObject::kCalleeOffset, | 311 Handle<Name>(), Type::Any(), MachineType::AnyTagged()}; |
372 Handle<Name>(), | |
373 Type::Any(), | |
374 MachineType::AnyTagged(), | |
375 kPointerWriteBarrier}; | |
376 return access; | 312 return access; |
377 } | 313 } |
378 | 314 |
379 | 315 |
380 // static | 316 // static |
381 FieldAccess AccessBuilder::ForFixedArraySlot(size_t index) { | 317 FieldAccess AccessBuilder::ForFixedArraySlot(size_t index) { |
382 int offset = FixedArray::OffsetOfElementAt(static_cast<int>(index)); | 318 int offset = FixedArray::OffsetOfElementAt(static_cast<int>(index)); |
383 FieldAccess access = {kTaggedBase, | 319 FieldAccess access = {kTaggedBase, offset, Handle<Name>(), Type::Any(), |
384 offset, | 320 MachineType::AnyTagged()}; |
385 Handle<Name>(), | |
386 Type::Any(), | |
387 MachineType::AnyTagged(), | |
388 kFullWriteBarrier}; | |
389 return access; | 321 return access; |
390 } | 322 } |
391 | 323 |
392 | 324 |
393 // static | 325 // static |
394 FieldAccess AccessBuilder::ForContextSlot(size_t index) { | 326 FieldAccess AccessBuilder::ForContextSlot(size_t index) { |
395 int offset = Context::kHeaderSize + static_cast<int>(index) * kPointerSize; | 327 int offset = Context::kHeaderSize + static_cast<int>(index) * kPointerSize; |
396 DCHECK_EQ(offset, | 328 DCHECK_EQ(offset, |
397 Context::SlotOffset(static_cast<int>(index)) + kHeapObjectTag); | 329 Context::SlotOffset(static_cast<int>(index)) + kHeapObjectTag); |
398 FieldAccess access = {kTaggedBase, | 330 FieldAccess access = {kTaggedBase, offset, Handle<Name>(), Type::Any(), |
399 offset, | 331 MachineType::AnyTagged()}; |
400 Handle<Name>(), | |
401 Type::Any(), | |
402 MachineType::AnyTagged(), | |
403 kFullWriteBarrier}; | |
404 return access; | 332 return access; |
405 } | 333 } |
406 | 334 |
407 | 335 |
408 // static | 336 // static |
409 FieldAccess AccessBuilder::ForPropertyCellValue() { | 337 FieldAccess AccessBuilder::ForPropertyCellValue() { |
410 return ForPropertyCellValue(Type::Tagged()); | 338 return ForPropertyCellValue(Type::Tagged()); |
411 } | 339 } |
412 | 340 |
413 | 341 |
414 // static | 342 // static |
415 FieldAccess AccessBuilder::ForPropertyCellValue(Type* type) { | 343 FieldAccess AccessBuilder::ForPropertyCellValue(Type* type) { |
416 FieldAccess access = { | 344 FieldAccess access = {kTaggedBase, PropertyCell::kValueOffset, Handle<Name>(), |
417 kTaggedBase, PropertyCell::kValueOffset, Handle<Name>(), | 345 type, MachineType::AnyTagged()}; |
418 type, MachineType::AnyTagged(), kFullWriteBarrier}; | |
419 return access; | 346 return access; |
420 } | 347 } |
421 | 348 |
422 | 349 |
423 // static | 350 // static |
424 FieldAccess AccessBuilder::ForSharedFunctionInfoTypeFeedbackVector() { | 351 FieldAccess AccessBuilder::ForSharedFunctionInfoTypeFeedbackVector() { |
425 FieldAccess access = {kTaggedBase, | 352 FieldAccess access = {kTaggedBase, SharedFunctionInfo::kFeedbackVectorOffset, |
426 SharedFunctionInfo::kFeedbackVectorOffset, | 353 Handle<Name>(), Type::Any(), MachineType::AnyTagged()}; |
427 Handle<Name>(), | |
428 Type::Any(), | |
429 MachineType::AnyTagged(), | |
430 kPointerWriteBarrier}; | |
431 return access; | 354 return access; |
432 } | 355 } |
433 | 356 |
434 | 357 |
435 // static | 358 // static |
436 ElementAccess AccessBuilder::ForFixedArrayElement() { | 359 ElementAccess AccessBuilder::ForFixedArrayElement() { |
437 ElementAccess access = {kTaggedBase, FixedArray::kHeaderSize, Type::Tagged(), | 360 ElementAccess access = {kTaggedBase, FixedArray::kHeaderSize, Type::Tagged(), |
438 MachineType::AnyTagged(), kFullWriteBarrier}; | 361 MachineType::AnyTagged()}; |
439 return access; | 362 return access; |
440 } | 363 } |
441 | 364 |
442 | 365 |
443 // static | 366 // static |
444 ElementAccess AccessBuilder::ForFixedDoubleArrayElement() { | 367 ElementAccess AccessBuilder::ForFixedDoubleArrayElement() { |
445 ElementAccess access = {kTaggedBase, FixedDoubleArray::kHeaderSize, | 368 ElementAccess access = {kTaggedBase, FixedDoubleArray::kHeaderSize, |
446 TypeCache::Get().kFloat64, MachineType::Float64(), | 369 TypeCache::Get().kFloat64, MachineType::Float64()}; |
447 kNoWriteBarrier}; | |
448 return access; | 370 return access; |
449 } | 371 } |
450 | 372 |
451 | 373 |
452 // static | 374 // static |
453 ElementAccess AccessBuilder::ForTypedArrayElement(ExternalArrayType type, | 375 ElementAccess AccessBuilder::ForTypedArrayElement(ExternalArrayType type, |
454 bool is_external) { | 376 bool is_external) { |
455 BaseTaggedness taggedness = is_external ? kUntaggedBase : kTaggedBase; | 377 BaseTaggedness taggedness = is_external ? kUntaggedBase : kTaggedBase; |
456 int header_size = is_external ? 0 : FixedTypedArrayBase::kDataOffset; | 378 int header_size = is_external ? 0 : FixedTypedArrayBase::kDataOffset; |
457 switch (type) { | 379 switch (type) { |
458 case kExternalInt8Array: { | 380 case kExternalInt8Array: { |
459 ElementAccess access = {taggedness, header_size, Type::Signed32(), | 381 ElementAccess access = {taggedness, header_size, Type::Signed32(), |
460 MachineType::Int8(), kNoWriteBarrier}; | 382 MachineType::Int8()}; |
461 return access; | 383 return access; |
462 } | 384 } |
463 case kExternalUint8Array: | 385 case kExternalUint8Array: |
464 case kExternalUint8ClampedArray: { | 386 case kExternalUint8ClampedArray: { |
465 ElementAccess access = {taggedness, header_size, Type::Unsigned32(), | 387 ElementAccess access = {taggedness, header_size, Type::Unsigned32(), |
466 MachineType::Uint8(), kNoWriteBarrier}; | 388 MachineType::Uint8()}; |
467 return access; | 389 return access; |
468 } | 390 } |
469 case kExternalInt16Array: { | 391 case kExternalInt16Array: { |
470 ElementAccess access = {taggedness, header_size, Type::Signed32(), | 392 ElementAccess access = {taggedness, header_size, Type::Signed32(), |
471 MachineType::Int16(), kNoWriteBarrier}; | 393 MachineType::Int16()}; |
472 return access; | 394 return access; |
473 } | 395 } |
474 case kExternalUint16Array: { | 396 case kExternalUint16Array: { |
475 ElementAccess access = {taggedness, header_size, Type::Unsigned32(), | 397 ElementAccess access = {taggedness, header_size, Type::Unsigned32(), |
476 MachineType::Uint16(), kNoWriteBarrier}; | 398 MachineType::Uint16()}; |
477 return access; | 399 return access; |
478 } | 400 } |
479 case kExternalInt32Array: { | 401 case kExternalInt32Array: { |
480 ElementAccess access = {taggedness, header_size, Type::Signed32(), | 402 ElementAccess access = {taggedness, header_size, Type::Signed32(), |
481 MachineType::Int32(), kNoWriteBarrier}; | 403 MachineType::Int32()}; |
482 return access; | 404 return access; |
483 } | 405 } |
484 case kExternalUint32Array: { | 406 case kExternalUint32Array: { |
485 ElementAccess access = {taggedness, header_size, Type::Unsigned32(), | 407 ElementAccess access = {taggedness, header_size, Type::Unsigned32(), |
486 MachineType::Uint32(), kNoWriteBarrier}; | 408 MachineType::Uint32()}; |
487 return access; | 409 return access; |
488 } | 410 } |
489 case kExternalFloat32Array: { | 411 case kExternalFloat32Array: { |
490 ElementAccess access = {taggedness, header_size, Type::Number(), | 412 ElementAccess access = {taggedness, header_size, Type::Number(), |
491 MachineType::Float32(), kNoWriteBarrier}; | 413 MachineType::Float32()}; |
492 return access; | 414 return access; |
493 } | 415 } |
494 case kExternalFloat64Array: { | 416 case kExternalFloat64Array: { |
495 ElementAccess access = {taggedness, header_size, Type::Number(), | 417 ElementAccess access = {taggedness, header_size, Type::Number(), |
496 MachineType::Float64(), kNoWriteBarrier}; | 418 MachineType::Float64()}; |
497 return access; | 419 return access; |
498 } | 420 } |
499 } | 421 } |
500 UNREACHABLE(); | 422 UNREACHABLE(); |
501 ElementAccess access = {kUntaggedBase, 0, Type::None(), MachineType::None(), | 423 ElementAccess access = {kUntaggedBase, 0, Type::None(), MachineType::None()}; |
502 kNoWriteBarrier}; | |
503 return access; | 424 return access; |
504 } | 425 } |
505 | 426 |
| 427 |
| 428 // static |
| 429 FieldAccess AccessBuilder::ForStatsCounter() { |
| 430 FieldAccess access = {kUntaggedBase, 0, MaybeHandle<Name>(), |
| 431 TypeCache::Get().kInt32, MachineType::Int32()}; |
| 432 return access; |
| 433 } |
| 434 |
506 } // namespace compiler | 435 } // namespace compiler |
507 } // namespace internal | 436 } // namespace internal |
508 } // namespace v8 | 437 } // namespace v8 |
OLD | NEW |