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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 | 66 |
67 | 67 |
68 // static | 68 // static |
69 FieldAccess AccessBuilder::ForValue() { | 69 FieldAccess AccessBuilder::ForValue() { |
70 return {kTaggedBase, JSValue::kValueOffset, Handle<Name>(), Type::Any(), | 70 return {kTaggedBase, JSValue::kValueOffset, Handle<Name>(), Type::Any(), |
71 kMachAnyTagged}; | 71 kMachAnyTagged}; |
72 } | 72 } |
73 | 73 |
74 | 74 |
75 // static | 75 // static |
| 76 FieldAccess AccessBuilder::ForContextSlot(size_t index) { |
| 77 int offset = Context::kHeaderSize + static_cast<int>(index) * kPointerSize; |
| 78 DCHECK_EQ(offset, |
| 79 Context::SlotOffset(static_cast<int>(index)) + kHeapObjectTag); |
| 80 return {kTaggedBase, offset, Handle<Name>(), Type::Any(), kMachAnyTagged}; |
| 81 } |
| 82 |
| 83 |
| 84 // static |
76 ElementAccess AccessBuilder::ForFixedArrayElement() { | 85 ElementAccess AccessBuilder::ForFixedArrayElement() { |
77 return {kTaggedBase, FixedArray::kHeaderSize, Type::Any(), kMachAnyTagged}; | 86 return {kTaggedBase, FixedArray::kHeaderSize, Type::Any(), kMachAnyTagged}; |
78 } | 87 } |
79 | 88 |
80 | 89 |
81 // static | 90 // static |
82 ElementAccess AccessBuilder::ForTypedArrayElement(ExternalArrayType type, | 91 ElementAccess AccessBuilder::ForTypedArrayElement(ExternalArrayType type, |
83 bool is_external) { | 92 bool is_external) { |
84 BaseTaggedness taggedness = is_external ? kUntaggedBase : kTaggedBase; | 93 BaseTaggedness taggedness = is_external ? kUntaggedBase : kTaggedBase; |
85 int header_size = is_external ? 0 : FixedTypedArrayBase::kDataOffset; | 94 int header_size = is_external ? 0 : FixedTypedArrayBase::kDataOffset; |
(...skipping 16 matching lines...) Expand all Loading... |
102 case kExternalFloat64Array: | 111 case kExternalFloat64Array: |
103 return {taggedness, header_size, Type::Number(), kMachFloat64}; | 112 return {taggedness, header_size, Type::Number(), kMachFloat64}; |
104 } | 113 } |
105 UNREACHABLE(); | 114 UNREACHABLE(); |
106 return {kUntaggedBase, 0, Type::None(), kMachNone}; | 115 return {kUntaggedBase, 0, Type::None(), kMachNone}; |
107 } | 116 } |
108 | 117 |
109 } // namespace compiler | 118 } // namespace compiler |
110 } // namespace internal | 119 } // namespace internal |
111 } // namespace v8 | 120 } // namespace v8 |
OLD | NEW |