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 #include "src/types-inl.h" | 6 #include "src/types-inl.h" |
7 | 7 |
8 namespace v8 { | 8 namespace v8 { |
9 namespace internal { | 9 namespace internal { |
10 namespace compiler { | 10 namespace compiler { |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 FieldAccess access = { | 124 FieldAccess access = { |
125 kTaggedBase, String::kLengthOffset, Handle<Name>(), | 125 kTaggedBase, String::kLengthOffset, Handle<Name>(), |
126 Type::Intersect(Type::Range(0, String::kMaxLength, zone), | 126 Type::Intersect(Type::Range(0, String::kMaxLength, zone), |
127 Type::TaggedSigned(), zone), | 127 Type::TaggedSigned(), zone), |
128 kMachAnyTagged}; | 128 kMachAnyTagged}; |
129 return access; | 129 return access; |
130 } | 130 } |
131 | 131 |
132 | 132 |
133 // static | 133 // static |
| 134 FieldAccess AccessBuilder::ForGlobalObjectNativeContext() { |
| 135 FieldAccess access = {kTaggedBase, GlobalObject::kNativeContextOffset, |
| 136 Handle<Name>(), Type::Any(), kMachAnyTagged}; |
| 137 return access; |
| 138 } |
| 139 |
| 140 |
| 141 // static |
134 FieldAccess AccessBuilder::ForValue() { | 142 FieldAccess AccessBuilder::ForValue() { |
135 FieldAccess access = {kTaggedBase, JSValue::kValueOffset, Handle<Name>(), | 143 FieldAccess access = {kTaggedBase, JSValue::kValueOffset, Handle<Name>(), |
136 Type::Any(), kMachAnyTagged}; | 144 Type::Any(), kMachAnyTagged}; |
137 return access; | 145 return access; |
138 } | 146 } |
139 | 147 |
140 | 148 |
141 // static | 149 // static |
| 150 FieldAccess AccessBuilder::ForArgumentsLength() { |
| 151 int offset = |
| 152 JSObject::kHeaderSize + Heap::kArgumentsLengthIndex * kPointerSize; |
| 153 FieldAccess access = {kTaggedBase, offset, Handle<Name>(), Type::Any(), |
| 154 kMachAnyTagged}; |
| 155 return access; |
| 156 } |
| 157 |
| 158 |
| 159 // static |
| 160 FieldAccess AccessBuilder::ForFixedArraySlot(size_t index) { |
| 161 int offset = FixedArray::OffsetOfElementAt(static_cast<int>(index)); |
| 162 FieldAccess access = {kTaggedBase, offset, Handle<Name>(), Type::Any(), |
| 163 kMachAnyTagged}; |
| 164 return access; |
| 165 } |
| 166 |
| 167 |
| 168 // static |
142 FieldAccess AccessBuilder::ForContextSlot(size_t index) { | 169 FieldAccess AccessBuilder::ForContextSlot(size_t index) { |
143 int offset = Context::kHeaderSize + static_cast<int>(index) * kPointerSize; | 170 int offset = Context::kHeaderSize + static_cast<int>(index) * kPointerSize; |
144 DCHECK_EQ(offset, | 171 DCHECK_EQ(offset, |
145 Context::SlotOffset(static_cast<int>(index)) + kHeapObjectTag); | 172 Context::SlotOffset(static_cast<int>(index)) + kHeapObjectTag); |
146 FieldAccess access = {kTaggedBase, offset, Handle<Name>(), Type::Any(), | 173 FieldAccess access = {kTaggedBase, offset, Handle<Name>(), Type::Any(), |
147 kMachAnyTagged}; | 174 kMachAnyTagged}; |
148 return access; | 175 return access; |
149 } | 176 } |
150 | 177 |
151 | 178 |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
272 // static | 299 // static |
273 FieldAccess AccessBuilder::ForFrameMarker() { | 300 FieldAccess AccessBuilder::ForFrameMarker() { |
274 FieldAccess access = {kUntaggedBase, StandardFrameConstants::kMarkerOffset, | 301 FieldAccess access = {kUntaggedBase, StandardFrameConstants::kMarkerOffset, |
275 MaybeHandle<Name>(), Type::Tagged(), kMachAnyTagged}; | 302 MaybeHandle<Name>(), Type::Tagged(), kMachAnyTagged}; |
276 return access; | 303 return access; |
277 } | 304 } |
278 | 305 |
279 } // namespace compiler | 306 } // namespace compiler |
280 } // namespace internal | 307 } // namespace internal |
281 } // namespace v8 | 308 } // namespace v8 |
OLD | NEW |