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/compiler/type-cache.h" | 7 #include "src/compiler/type-cache.h" |
8 #include "src/contexts.h" | 8 #include "src/contexts.h" |
9 #include "src/frames.h" | 9 #include "src/frames.h" |
10 #include "src/handles-inl.h" | 10 #include "src/handles-inl.h" |
11 #include "src/heap/heap.h" | 11 #include "src/heap/heap.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::ForExternalDoubleValue() { | 18 FieldAccess AccessBuilder::ForExternalDoubleValue() { |
19 FieldAccess access = {kUntaggedBase, 0, | 19 FieldAccess access = {kUntaggedBase, 0, |
20 MaybeHandle<Name>(), Type::Number(), | 20 MaybeHandle<Name>(), Type::Number(), |
21 MachineType::Float64(), kNoWriteBarrier}; | 21 MachineType::Float64(), kNoWriteBarrier}; |
22 return access; | 22 return access; |
23 } | 23 } |
24 | 24 |
25 // static | 25 // static |
26 FieldAccess AccessBuilder::ForMap() { | 26 FieldAccess AccessBuilder::ForMap() { |
27 FieldAccess access = { | 27 FieldAccess access = { |
28 kTaggedBase, HeapObject::kMapOffset, MaybeHandle<Name>(), | 28 kTaggedBase, HeapObject::kMapOffset, MaybeHandle<Name>(), |
29 Type::OtherInternal(), MachineType::AnyTagged(), kMapWriteBarrier}; | 29 Type::OtherInternal(), MachineType::TaggedPointer(), kMapWriteBarrier}; |
30 return access; | 30 return access; |
31 } | 31 } |
32 | 32 |
33 | 33 |
34 // static | 34 // static |
35 FieldAccess AccessBuilder::ForHeapNumberValue() { | 35 FieldAccess AccessBuilder::ForHeapNumberValue() { |
36 FieldAccess access = {kTaggedBase, | 36 FieldAccess access = {kTaggedBase, |
37 HeapNumber::kValueOffset, | 37 HeapNumber::kValueOffset, |
38 MaybeHandle<Name>(), | 38 MaybeHandle<Name>(), |
39 TypeCache::Get().kFloat64, | 39 TypeCache::Get().kFloat64, |
40 MachineType::Float64(), | 40 MachineType::Float64(), |
41 kNoWriteBarrier}; | 41 kNoWriteBarrier}; |
42 return access; | 42 return access; |
43 } | 43 } |
44 | 44 |
45 | 45 |
46 // static | 46 // static |
47 FieldAccess AccessBuilder::ForJSObjectProperties() { | 47 FieldAccess AccessBuilder::ForJSObjectProperties() { |
48 FieldAccess access = { | 48 FieldAccess access = { |
49 kTaggedBase, JSObject::kPropertiesOffset, MaybeHandle<Name>(), | 49 kTaggedBase, JSObject::kPropertiesOffset, MaybeHandle<Name>(), |
50 Type::Internal(), MachineType::AnyTagged(), kPointerWriteBarrier}; | 50 Type::Internal(), MachineType::TaggedPointer(), kPointerWriteBarrier}; |
51 return access; | 51 return access; |
52 } | 52 } |
53 | 53 |
54 | 54 |
55 // static | 55 // static |
56 FieldAccess AccessBuilder::ForJSObjectElements() { | 56 FieldAccess AccessBuilder::ForJSObjectElements() { |
57 FieldAccess access = { | 57 FieldAccess access = { |
58 kTaggedBase, JSObject::kElementsOffset, MaybeHandle<Name>(), | 58 kTaggedBase, JSObject::kElementsOffset, MaybeHandle<Name>(), |
59 Type::Internal(), MachineType::AnyTagged(), kPointerWriteBarrier}; | 59 Type::Internal(), MachineType::TaggedPointer(), kPointerWriteBarrier}; |
60 return access; | 60 return access; |
61 } | 61 } |
62 | 62 |
63 | 63 |
64 // static | 64 // static |
65 FieldAccess AccessBuilder::ForJSObjectInObjectProperty(Handle<Map> map, | 65 FieldAccess AccessBuilder::ForJSObjectInObjectProperty(Handle<Map> map, |
66 int index) { | 66 int index) { |
67 int const offset = map->GetInObjectPropertyOffset(index); | 67 int const offset = map->GetInObjectPropertyOffset(index); |
68 FieldAccess access = {kTaggedBase, | 68 FieldAccess access = {kTaggedBase, |
69 offset, | 69 offset, |
(...skipping 24 matching lines...) Expand all Loading... |
94 return access; | 94 return access; |
95 } | 95 } |
96 | 96 |
97 | 97 |
98 // static | 98 // static |
99 FieldAccess AccessBuilder::ForJSFunctionSharedFunctionInfo() { | 99 FieldAccess AccessBuilder::ForJSFunctionSharedFunctionInfo() { |
100 FieldAccess access = {kTaggedBase, | 100 FieldAccess access = {kTaggedBase, |
101 JSFunction::kSharedFunctionInfoOffset, | 101 JSFunction::kSharedFunctionInfoOffset, |
102 Handle<Name>(), | 102 Handle<Name>(), |
103 Type::OtherInternal(), | 103 Type::OtherInternal(), |
104 MachineType::AnyTagged(), | 104 MachineType::TaggedPointer(), |
105 kPointerWriteBarrier}; | 105 kPointerWriteBarrier}; |
106 return access; | 106 return access; |
107 } | 107 } |
108 | 108 |
109 // static | 109 // static |
110 FieldAccess AccessBuilder::ForJSFunctionLiterals() { | 110 FieldAccess AccessBuilder::ForJSFunctionLiterals() { |
111 FieldAccess access = { | 111 FieldAccess access = { |
112 kTaggedBase, JSFunction::kLiteralsOffset, Handle<Name>(), | 112 kTaggedBase, JSFunction::kLiteralsOffset, Handle<Name>(), |
113 Type::Internal(), MachineType::AnyTagged(), kPointerWriteBarrier}; | 113 Type::Internal(), MachineType::TaggedPointer(), kPointerWriteBarrier}; |
114 return access; | 114 return access; |
115 } | 115 } |
116 | 116 |
117 // static | 117 // static |
118 FieldAccess AccessBuilder::ForJSFunctionCodeEntry() { | 118 FieldAccess AccessBuilder::ForJSFunctionCodeEntry() { |
119 FieldAccess access = { | 119 FieldAccess access = { |
120 kTaggedBase, JSFunction::kCodeEntryOffset, Handle<Name>(), | 120 kTaggedBase, JSFunction::kCodeEntryOffset, Handle<Name>(), |
121 Type::OtherInternal(), MachineType::Pointer(), kNoWriteBarrier}; | 121 Type::OtherInternal(), MachineType::Pointer(), kNoWriteBarrier}; |
122 return access; | 122 return access; |
123 } | 123 } |
124 | 124 |
125 // static | 125 // static |
126 FieldAccess AccessBuilder::ForJSFunctionNextFunctionLink() { | 126 FieldAccess AccessBuilder::ForJSFunctionNextFunctionLink() { |
127 FieldAccess access = {kTaggedBase, | 127 FieldAccess access = {kTaggedBase, |
128 JSFunction::kNextFunctionLinkOffset, | 128 JSFunction::kNextFunctionLinkOffset, |
129 Handle<Name>(), | 129 Handle<Name>(), |
130 Type::Any(), | 130 Type::Any(), |
131 MachineType::AnyTagged(), | 131 MachineType::AnyTagged(), |
132 kPointerWriteBarrier}; | 132 kPointerWriteBarrier}; |
133 return access; | 133 return access; |
134 } | 134 } |
135 | 135 |
136 // static | 136 // static |
137 FieldAccess AccessBuilder::ForJSGeneratorObjectContext() { | 137 FieldAccess AccessBuilder::ForJSGeneratorObjectContext() { |
138 FieldAccess access = {kTaggedBase, | 138 FieldAccess access = {kTaggedBase, |
139 JSGeneratorObject::kContextOffset, | 139 JSGeneratorObject::kContextOffset, |
140 Handle<Name>(), | 140 Handle<Name>(), |
141 Type::Internal(), | 141 Type::Internal(), |
142 MachineType::AnyTagged(), | 142 MachineType::TaggedPointer(), |
143 kPointerWriteBarrier}; | 143 kPointerWriteBarrier}; |
144 return access; | 144 return access; |
145 } | 145 } |
146 | 146 |
147 // static | 147 // static |
148 FieldAccess AccessBuilder::ForJSGeneratorObjectContinuation() { | 148 FieldAccess AccessBuilder::ForJSGeneratorObjectContinuation() { |
149 TypeCache const& type_cache = TypeCache::Get(); | 149 TypeCache const& type_cache = TypeCache::Get(); |
150 FieldAccess access = {kTaggedBase, | 150 FieldAccess access = {kTaggedBase, |
151 JSGeneratorObject::kContinuationOffset, | 151 JSGeneratorObject::kContinuationOffset, |
152 Handle<Name>(), | 152 Handle<Name>(), |
153 type_cache.kSmi, | 153 type_cache.kSmi, |
154 MachineType::AnyTagged(), | 154 MachineType::TaggedSigned(), |
155 kNoWriteBarrier}; | 155 kNoWriteBarrier}; |
156 return access; | 156 return access; |
157 } | 157 } |
158 | 158 |
159 // static | 159 // static |
160 FieldAccess AccessBuilder::ForJSGeneratorObjectInputOrDebugPos() { | 160 FieldAccess AccessBuilder::ForJSGeneratorObjectInputOrDebugPos() { |
161 FieldAccess access = {kTaggedBase, | 161 FieldAccess access = {kTaggedBase, |
162 JSGeneratorObject::kInputOrDebugPosOffset, | 162 JSGeneratorObject::kInputOrDebugPosOffset, |
163 Handle<Name>(), | 163 Handle<Name>(), |
164 Type::NonInternal(), | 164 Type::NonInternal(), |
165 MachineType::AnyTagged(), | 165 MachineType::AnyTagged(), |
166 kFullWriteBarrier}; | 166 kFullWriteBarrier}; |
167 return access; | 167 return access; |
168 } | 168 } |
169 | 169 |
170 // static | 170 // static |
171 FieldAccess AccessBuilder::ForJSGeneratorObjectOperandStack() { | 171 FieldAccess AccessBuilder::ForJSGeneratorObjectOperandStack() { |
172 FieldAccess access = {kTaggedBase, | 172 FieldAccess access = {kTaggedBase, |
173 JSGeneratorObject::kOperandStackOffset, | 173 JSGeneratorObject::kOperandStackOffset, |
174 Handle<Name>(), | 174 Handle<Name>(), |
175 Type::Internal(), | 175 Type::Internal(), |
176 MachineType::AnyTagged(), | 176 MachineType::AnyTagged(), |
177 kPointerWriteBarrier}; | 177 kPointerWriteBarrier}; |
178 return access; | 178 return access; |
179 } | 179 } |
180 | 180 |
181 // static | 181 // static |
182 FieldAccess AccessBuilder::ForJSGeneratorObjectResumeMode() { | 182 FieldAccess AccessBuilder::ForJSGeneratorObjectResumeMode() { |
183 TypeCache const& type_cache = TypeCache::Get(); | 183 TypeCache const& type_cache = TypeCache::Get(); |
184 FieldAccess access = {kTaggedBase, | 184 FieldAccess access = { |
185 JSGeneratorObject::kResumeModeOffset, | 185 kTaggedBase, JSGeneratorObject::kResumeModeOffset, Handle<Name>(), |
186 Handle<Name>(), | 186 type_cache.kSmi, MachineType::TaggedSigned(), kNoWriteBarrier}; |
187 type_cache.kSmi, | |
188 MachineType::AnyTagged(), | |
189 kNoWriteBarrier}; | |
190 return access; | 187 return access; |
191 } | 188 } |
192 | 189 |
193 // static | 190 // static |
194 FieldAccess AccessBuilder::ForJSArrayLength(ElementsKind elements_kind) { | 191 FieldAccess AccessBuilder::ForJSArrayLength(ElementsKind elements_kind) { |
195 TypeCache const& type_cache = TypeCache::Get(); | 192 TypeCache const& type_cache = TypeCache::Get(); |
196 FieldAccess access = {kTaggedBase, | 193 FieldAccess access = {kTaggedBase, |
197 JSArray::kLengthOffset, | 194 JSArray::kLengthOffset, |
198 Handle<Name>(), | 195 Handle<Name>(), |
199 type_cache.kJSArrayLengthType, | 196 type_cache.kJSArrayLengthType, |
200 MachineType::AnyTagged(), | 197 MachineType::TaggedSigned(), |
201 kFullWriteBarrier}; | 198 kFullWriteBarrier}; |
202 if (IsFastDoubleElementsKind(elements_kind)) { | 199 if (IsFastDoubleElementsKind(elements_kind)) { |
203 access.type = type_cache.kFixedDoubleArrayLengthType; | 200 access.type = type_cache.kFixedDoubleArrayLengthType; |
204 access.write_barrier_kind = kNoWriteBarrier; | 201 access.write_barrier_kind = kNoWriteBarrier; |
205 } else if (IsFastElementsKind(elements_kind)) { | 202 } else if (IsFastElementsKind(elements_kind)) { |
206 access.type = type_cache.kFixedArrayLengthType; | 203 access.type = type_cache.kFixedArrayLengthType; |
207 access.write_barrier_kind = kNoWriteBarrier; | 204 access.write_barrier_kind = kNoWriteBarrier; |
208 } | 205 } |
209 return access; | 206 return access; |
210 } | 207 } |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 kFullWriteBarrier}; | 258 kFullWriteBarrier}; |
262 return access; | 259 return access; |
263 } | 260 } |
264 | 261 |
265 // static | 262 // static |
266 FieldAccess AccessBuilder::ForJSTypedArrayLength() { | 263 FieldAccess AccessBuilder::ForJSTypedArrayLength() { |
267 FieldAccess access = {kTaggedBase, | 264 FieldAccess access = {kTaggedBase, |
268 JSTypedArray::kLengthOffset, | 265 JSTypedArray::kLengthOffset, |
269 MaybeHandle<Name>(), | 266 MaybeHandle<Name>(), |
270 TypeCache::Get().kJSTypedArrayLengthType, | 267 TypeCache::Get().kJSTypedArrayLengthType, |
271 MachineType::AnyTagged(), | 268 MachineType::TaggedSigned(), |
272 kNoWriteBarrier}; | 269 kNoWriteBarrier}; |
273 return access; | 270 return access; |
274 } | 271 } |
275 | 272 |
276 // static | 273 // static |
277 FieldAccess AccessBuilder::ForJSDateValue() { | 274 FieldAccess AccessBuilder::ForJSDateValue() { |
278 FieldAccess access = {kTaggedBase, | 275 FieldAccess access = {kTaggedBase, |
279 JSDate::kValueOffset, | 276 JSDate::kValueOffset, |
280 MaybeHandle<Name>(), | 277 MaybeHandle<Name>(), |
281 TypeCache::Get().kJSDateValueType, | 278 TypeCache::Get().kJSDateValueType, |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
452 Handle<Name>(), | 449 Handle<Name>(), |
453 TypeCache::Get().kStringLengthType, | 450 TypeCache::Get().kStringLengthType, |
454 MachineType::TaggedSigned(), | 451 MachineType::TaggedSigned(), |
455 kNoWriteBarrier}; | 452 kNoWriteBarrier}; |
456 return access; | 453 return access; |
457 } | 454 } |
458 | 455 |
459 // static | 456 // static |
460 FieldAccess AccessBuilder::ForConsStringFirst() { | 457 FieldAccess AccessBuilder::ForConsStringFirst() { |
461 FieldAccess access = { | 458 FieldAccess access = { |
462 kTaggedBase, ConsString::kFirstOffset, Handle<Name>(), | 459 kTaggedBase, ConsString::kFirstOffset, Handle<Name>(), |
463 Type::String(), MachineType::AnyTagged(), kPointerWriteBarrier}; | 460 Type::String(), MachineType::TaggedPointer(), kPointerWriteBarrier}; |
464 return access; | 461 return access; |
465 } | 462 } |
466 | 463 |
467 // static | 464 // static |
468 FieldAccess AccessBuilder::ForConsStringSecond() { | 465 FieldAccess AccessBuilder::ForConsStringSecond() { |
469 FieldAccess access = { | 466 FieldAccess access = { |
470 kTaggedBase, ConsString::kSecondOffset, Handle<Name>(), | 467 kTaggedBase, ConsString::kSecondOffset, Handle<Name>(), |
471 Type::String(), MachineType::AnyTagged(), kPointerWriteBarrier}; | 468 Type::String(), MachineType::TaggedPointer(), kPointerWriteBarrier}; |
472 return access; | 469 return access; |
473 } | 470 } |
474 | 471 |
475 // static | 472 // static |
476 FieldAccess AccessBuilder::ForSlicedStringOffset() { | 473 FieldAccess AccessBuilder::ForSlicedStringOffset() { |
477 FieldAccess access = { | 474 FieldAccess access = { |
478 kTaggedBase, SlicedString::kOffsetOffset, Handle<Name>(), | 475 kTaggedBase, SlicedString::kOffsetOffset, Handle<Name>(), |
479 Type::SignedSmall(), MachineType::AnyTagged(), kNoWriteBarrier}; | 476 Type::SignedSmall(), MachineType::TaggedSigned(), kNoWriteBarrier}; |
480 return access; | 477 return access; |
481 } | 478 } |
482 | 479 |
483 // static | 480 // static |
484 FieldAccess AccessBuilder::ForSlicedStringParent() { | 481 FieldAccess AccessBuilder::ForSlicedStringParent() { |
485 FieldAccess access = { | 482 FieldAccess access = { |
486 kTaggedBase, SlicedString::kParentOffset, Handle<Name>(), | 483 kTaggedBase, SlicedString::kParentOffset, Handle<Name>(), |
487 Type::String(), MachineType::AnyTagged(), kPointerWriteBarrier}; | 484 Type::String(), MachineType::TaggedPointer(), kPointerWriteBarrier}; |
488 return access; | 485 return access; |
489 } | 486 } |
490 | 487 |
491 // static | 488 // static |
492 FieldAccess AccessBuilder::ForExternalStringResourceData() { | 489 FieldAccess AccessBuilder::ForExternalStringResourceData() { |
493 FieldAccess access = {kTaggedBase, | 490 FieldAccess access = {kTaggedBase, |
494 ExternalString::kResourceDataOffset, | 491 ExternalString::kResourceDataOffset, |
495 Handle<Name>(), | 492 Handle<Name>(), |
496 Type::OtherInternal(), | 493 Type::OtherInternal(), |
497 MachineType::Pointer(), | 494 MachineType::Pointer(), |
(...skipping 30 matching lines...) Expand all Loading... |
528 kNoWriteBarrier}; | 525 kNoWriteBarrier}; |
529 return access; | 526 return access; |
530 } | 527 } |
531 | 528 |
532 // static | 529 // static |
533 FieldAccess AccessBuilder::ForJSGlobalObjectGlobalProxy() { | 530 FieldAccess AccessBuilder::ForJSGlobalObjectGlobalProxy() { |
534 FieldAccess access = {kTaggedBase, | 531 FieldAccess access = {kTaggedBase, |
535 JSGlobalObject::kGlobalProxyOffset, | 532 JSGlobalObject::kGlobalProxyOffset, |
536 Handle<Name>(), | 533 Handle<Name>(), |
537 Type::Receiver(), | 534 Type::Receiver(), |
538 MachineType::AnyTagged(), | 535 MachineType::TaggedPointer(), |
539 kPointerWriteBarrier}; | 536 kPointerWriteBarrier}; |
540 return access; | 537 return access; |
541 } | 538 } |
542 | 539 |
543 // static | 540 // static |
544 FieldAccess AccessBuilder::ForJSGlobalObjectNativeContext() { | 541 FieldAccess AccessBuilder::ForJSGlobalObjectNativeContext() { |
545 FieldAccess access = {kTaggedBase, | 542 FieldAccess access = {kTaggedBase, |
546 JSGlobalObject::kNativeContextOffset, | 543 JSGlobalObject::kNativeContextOffset, |
547 Handle<Name>(), | 544 Handle<Name>(), |
548 Type::Internal(), | 545 Type::Internal(), |
549 MachineType::AnyTagged(), | 546 MachineType::TaggedPointer(), |
550 kPointerWriteBarrier}; | 547 kPointerWriteBarrier}; |
551 return access; | 548 return access; |
552 } | 549 } |
553 | 550 |
554 | 551 |
555 // static | 552 // static |
556 FieldAccess AccessBuilder::ForValue() { | 553 FieldAccess AccessBuilder::ForValue() { |
557 FieldAccess access = { | 554 FieldAccess access = { |
558 kTaggedBase, JSValue::kValueOffset, Handle<Name>(), | 555 kTaggedBase, JSValue::kValueOffset, Handle<Name>(), |
559 Type::NonInternal(), MachineType::AnyTagged(), kFullWriteBarrier}; | 556 Type::NonInternal(), MachineType::AnyTagged(), kFullWriteBarrier}; |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
729 } | 726 } |
730 UNREACHABLE(); | 727 UNREACHABLE(); |
731 ElementAccess access = {kUntaggedBase, 0, Type::None(), MachineType::None(), | 728 ElementAccess access = {kUntaggedBase, 0, Type::None(), MachineType::None(), |
732 kNoWriteBarrier}; | 729 kNoWriteBarrier}; |
733 return access; | 730 return access; |
734 } | 731 } |
735 | 732 |
736 } // namespace compiler | 733 } // namespace compiler |
737 } // namespace internal | 734 } // namespace internal |
738 } // namespace v8 | 735 } // namespace v8 |
OLD | NEW |