OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 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 #include "src/code-stub-assembler.h" | 4 #include "src/code-stub-assembler.h" |
5 #include "src/code-factory.h" | 5 #include "src/code-factory.h" |
6 #include "src/frames-inl.h" | 6 #include "src/frames-inl.h" |
7 #include "src/frames.h" | 7 #include "src/frames.h" |
8 #include "src/ic/handler-configuration.h" | 8 #include "src/ic/handler-configuration.h" |
9 #include "src/ic/stub-cache.h" | 9 #include "src/ic/stub-cache.h" |
10 | 10 |
(...skipping 1246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1257 return nullptr; | 1257 return nullptr; |
1258 } | 1258 } |
1259 return Load(machine_type, base, offset); | 1259 return Load(machine_type, base, offset); |
1260 } | 1260 } |
1261 | 1261 |
1262 Node* CodeStubAssembler::LoadContextElement(Node* context, int slot_index) { | 1262 Node* CodeStubAssembler::LoadContextElement(Node* context, int slot_index) { |
1263 int offset = Context::SlotOffset(slot_index); | 1263 int offset = Context::SlotOffset(slot_index); |
1264 return Load(MachineType::AnyTagged(), context, IntPtrConstant(offset)); | 1264 return Load(MachineType::AnyTagged(), context, IntPtrConstant(offset)); |
1265 } | 1265 } |
1266 | 1266 |
| 1267 Node* CodeStubAssembler::LoadContextElement(Node* context, Node* slot_index) { |
| 1268 Node* offset = |
| 1269 IntPtrAdd(WordShl(slot_index, kPointerSizeLog2), |
| 1270 IntPtrConstant(Context::kHeaderSize - kHeapObjectTag)); |
| 1271 return Load(MachineType::AnyTagged(), context, offset); |
| 1272 } |
| 1273 |
1267 Node* CodeStubAssembler::StoreContextElement(Node* context, int slot_index, | 1274 Node* CodeStubAssembler::StoreContextElement(Node* context, int slot_index, |
1268 Node* value) { | 1275 Node* value) { |
1269 int offset = Context::SlotOffset(slot_index); | 1276 int offset = Context::SlotOffset(slot_index); |
1270 return Store(MachineRepresentation::kTagged, context, IntPtrConstant(offset), | 1277 return Store(MachineRepresentation::kTagged, context, IntPtrConstant(offset), |
1271 value); | 1278 value); |
1272 } | 1279 } |
1273 | 1280 |
| 1281 Node* CodeStubAssembler::StoreContextElement(Node* context, Node* slot_index, |
| 1282 Node* value) { |
| 1283 Node* offset = |
| 1284 IntPtrAdd(WordShl(slot_index, kPointerSizeLog2), |
| 1285 IntPtrConstant(Context::kHeaderSize - kHeapObjectTag)); |
| 1286 return Store(MachineRepresentation::kTagged, context, offset, value); |
| 1287 } |
| 1288 |
1274 Node* CodeStubAssembler::LoadNativeContext(Node* context) { | 1289 Node* CodeStubAssembler::LoadNativeContext(Node* context) { |
1275 return LoadContextElement(context, Context::NATIVE_CONTEXT_INDEX); | 1290 return LoadContextElement(context, Context::NATIVE_CONTEXT_INDEX); |
1276 } | 1291 } |
1277 | 1292 |
1278 Node* CodeStubAssembler::LoadJSArrayElementsMap(ElementsKind kind, | 1293 Node* CodeStubAssembler::LoadJSArrayElementsMap(ElementsKind kind, |
1279 Node* native_context) { | 1294 Node* native_context) { |
1280 CSA_ASSERT(IsNativeContext(native_context)); | 1295 CSA_ASSERT(IsNativeContext(native_context)); |
1281 return LoadFixedArrayElement(native_context, | 1296 return LoadFixedArrayElement(native_context, |
1282 IntPtrConstant(Context::ArrayMapIndex(kind))); | 1297 IntPtrConstant(Context::ArrayMapIndex(kind))); |
1283 } | 1298 } |
(...skipping 7554 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8838 } | 8853 } |
8839 | 8854 |
8840 void CodeStubArguments::PopAndReturn(compiler::Node* value) { | 8855 void CodeStubArguments::PopAndReturn(compiler::Node* value) { |
8841 assembler_->PopAndReturn( | 8856 assembler_->PopAndReturn( |
8842 assembler_->IntPtrAddFoldConstants(argc_, assembler_->IntPtrConstant(1)), | 8857 assembler_->IntPtrAddFoldConstants(argc_, assembler_->IntPtrConstant(1)), |
8843 value); | 8858 value); |
8844 } | 8859 } |
8845 | 8860 |
8846 } // namespace internal | 8861 } // namespace internal |
8847 } // namespace v8 | 8862 } // namespace v8 |
OLD | NEW |