OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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/code-stub-assembler.h" | 5 #include "src/compiler/code-stub-assembler.h" |
6 | 6 |
7 #include <ostream> | 7 #include <ostream> |
8 | 8 |
9 #include "src/code-factory.h" | 9 #include "src/code-factory.h" |
10 #include "src/compiler/graph.h" | 10 #include "src/compiler/graph.h" |
(...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
451 Node* value = LoadHeapNumberValue(object); | 451 Node* value = LoadHeapNumberValue(object); |
452 return raw_assembler_->TruncateFloat64ToInt32(TruncationMode::kJavaScript, | 452 return raw_assembler_->TruncateFloat64ToInt32(TruncationMode::kJavaScript, |
453 value); | 453 value); |
454 } | 454 } |
455 | 455 |
456 Node* CodeStubAssembler::LoadMapBitField(Node* map) { | 456 Node* CodeStubAssembler::LoadMapBitField(Node* map) { |
457 return Load(MachineType::Uint8(), map, | 457 return Load(MachineType::Uint8(), map, |
458 IntPtrConstant(Map::kBitFieldOffset - kHeapObjectTag)); | 458 IntPtrConstant(Map::kBitFieldOffset - kHeapObjectTag)); |
459 } | 459 } |
460 | 460 |
| 461 Node* CodeStubAssembler::LoadMapBitField2(Node* map) { |
| 462 return Load(MachineType::Uint8(), map, |
| 463 IntPtrConstant(Map::kBitField2Offset - kHeapObjectTag)); |
| 464 } |
| 465 |
| 466 Node* CodeStubAssembler::LoadMapBitField3(Node* map) { |
| 467 return Load(MachineType::Uint32(), map, |
| 468 IntPtrConstant(Map::kBitField3Offset - kHeapObjectTag)); |
| 469 } |
| 470 |
461 Node* CodeStubAssembler::LoadMapInstanceType(Node* map) { | 471 Node* CodeStubAssembler::LoadMapInstanceType(Node* map) { |
462 return Load(MachineType::Uint8(), map, | 472 return Load(MachineType::Uint8(), map, |
463 IntPtrConstant(Map::kInstanceTypeOffset - kHeapObjectTag)); | 473 IntPtrConstant(Map::kInstanceTypeOffset - kHeapObjectTag)); |
464 } | 474 } |
465 | 475 |
| 476 Node* CodeStubAssembler::LoadMapDescriptors(Node* map) { |
| 477 return LoadObjectField(map, Map::kDescriptorsOffset); |
| 478 } |
| 479 |
| 480 Node* CodeStubAssembler::LoadNameHash(Node* name) { |
| 481 return Load(MachineType::Uint32(), name, |
| 482 IntPtrConstant(Name::kHashFieldOffset - kHeapObjectTag)); |
| 483 } |
| 484 |
| 485 Node* CodeStubAssembler::LoadFixedArrayElementInt32Index( |
| 486 Node* object, Node* int32_index, int additional_offset) { |
| 487 Node* header_size = IntPtrConstant(additional_offset + |
| 488 FixedArray::kHeaderSize - kHeapObjectTag); |
| 489 Node* scaled_index = WordShl(int32_index, IntPtrConstant(kPointerSizeLog2)); |
| 490 Node* offset = IntPtrAdd(scaled_index, header_size); |
| 491 return Load(MachineType::AnyTagged(), object, offset); |
| 492 } |
| 493 |
466 Node* CodeStubAssembler::LoadFixedArrayElementSmiIndex(Node* object, | 494 Node* CodeStubAssembler::LoadFixedArrayElementSmiIndex(Node* object, |
467 Node* smi_index, | 495 Node* smi_index, |
468 int additional_offset) { | 496 int additional_offset) { |
469 int const kSmiShiftBits = kSmiShiftSize + kSmiTagSize; | 497 int const kSmiShiftBits = kSmiShiftSize + kSmiTagSize; |
470 Node* header_size = IntPtrConstant(additional_offset + | 498 Node* header_size = IntPtrConstant(additional_offset + |
471 FixedArray::kHeaderSize - kHeapObjectTag); | 499 FixedArray::kHeaderSize - kHeapObjectTag); |
472 Node* scaled_index = | 500 Node* scaled_index = |
473 (kSmiShiftBits > kPointerSizeLog2) | 501 (kSmiShiftBits > kPointerSizeLog2) |
474 ? WordSar(smi_index, IntPtrConstant(kSmiShiftBits - kPointerSizeLog2)) | 502 ? WordSar(smi_index, IntPtrConstant(kSmiShiftBits - kPointerSizeLog2)) |
475 : WordShl(smi_index, | 503 : WordShl(smi_index, |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
684 Node* CodeStubAssembler::StoreMapNoWriteBarrier(Node* object, Node* map) { | 712 Node* CodeStubAssembler::StoreMapNoWriteBarrier(Node* object, Node* map) { |
685 return StoreNoWriteBarrier( | 713 return StoreNoWriteBarrier( |
686 MachineRepresentation::kTagged, object, | 714 MachineRepresentation::kTagged, object, |
687 IntPtrConstant(HeapNumber::kMapOffset - kHeapObjectTag), map); | 715 IntPtrConstant(HeapNumber::kMapOffset - kHeapObjectTag), map); |
688 } | 716 } |
689 | 717 |
690 Node* CodeStubAssembler::LoadInstanceType(Node* object) { | 718 Node* CodeStubAssembler::LoadInstanceType(Node* object) { |
691 return LoadMapInstanceType(LoadMap(object)); | 719 return LoadMapInstanceType(LoadMap(object)); |
692 } | 720 } |
693 | 721 |
| 722 Node* CodeStubAssembler::LoadElements(Node* object) { |
| 723 return LoadObjectField(object, JSObject::kElementsOffset); |
| 724 } |
| 725 |
| 726 Node* CodeStubAssembler::LoadFixedArrayBaseLength(Node* array) { |
| 727 return LoadObjectField(array, FixedArrayBase::kLengthOffset); |
| 728 } |
| 729 |
694 Node* CodeStubAssembler::BitFieldDecode(Node* word32, uint32_t shift, | 730 Node* CodeStubAssembler::BitFieldDecode(Node* word32, uint32_t shift, |
695 uint32_t mask) { | 731 uint32_t mask) { |
696 return raw_assembler_->Word32Shr( | 732 return raw_assembler_->Word32Shr( |
697 raw_assembler_->Word32And(word32, raw_assembler_->Int32Constant(mask)), | 733 raw_assembler_->Word32And(word32, raw_assembler_->Int32Constant(mask)), |
698 raw_assembler_->Int32Constant(shift)); | 734 raw_assembler_->Int32Constant(shift)); |
699 } | 735 } |
700 | 736 |
701 Node* CodeStubAssembler::ChangeFloat64ToTagged(Node* value) { | 737 Node* CodeStubAssembler::ChangeFloat64ToTagged(Node* value) { |
702 Node* value32 = raw_assembler_->TruncateFloat64ToInt32( | 738 Node* value32 = raw_assembler_->TruncateFloat64ToInt32( |
703 TruncationMode::kRoundToZero, value); | 739 TruncationMode::kRoundToZero, value); |
(...skipping 605 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1309 } | 1345 } |
1310 } | 1346 } |
1311 } | 1347 } |
1312 | 1348 |
1313 bound_ = true; | 1349 bound_ = true; |
1314 } | 1350 } |
1315 | 1351 |
1316 } // namespace compiler | 1352 } // namespace compiler |
1317 } // namespace internal | 1353 } // namespace internal |
1318 } // namespace v8 | 1354 } // namespace v8 |
OLD | NEW |