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 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
429 MachineType rep) { | 429 MachineType rep) { |
430 return raw_assembler_->Load(rep, buffer, IntPtrConstant(offset)); | 430 return raw_assembler_->Load(rep, buffer, IntPtrConstant(offset)); |
431 } | 431 } |
432 | 432 |
433 Node* CodeStubAssembler::LoadObjectField(Node* object, int offset, | 433 Node* CodeStubAssembler::LoadObjectField(Node* object, int offset, |
434 MachineType rep) { | 434 MachineType rep) { |
435 return raw_assembler_->Load(rep, object, | 435 return raw_assembler_->Load(rep, object, |
436 IntPtrConstant(offset - kHeapObjectTag)); | 436 IntPtrConstant(offset - kHeapObjectTag)); |
437 } | 437 } |
438 | 438 |
| 439 Node* CodeStubAssembler::StoreObjectFieldNoWriteBarrier( |
| 440 Node* object, int offset, Node* value, MachineRepresentation rep) { |
| 441 return StoreNoWriteBarrier(rep, object, |
| 442 IntPtrConstant(offset - kHeapObjectTag), value); |
| 443 } |
| 444 |
439 Node* CodeStubAssembler::LoadHeapNumberValue(Node* object) { | 445 Node* CodeStubAssembler::LoadHeapNumberValue(Node* object) { |
440 return Load(MachineType::Float64(), object, | 446 return Load(MachineType::Float64(), object, |
441 IntPtrConstant(HeapNumber::kValueOffset - kHeapObjectTag)); | 447 IntPtrConstant(HeapNumber::kValueOffset - kHeapObjectTag)); |
442 } | 448 } |
443 | 449 |
444 Node* CodeStubAssembler::StoreHeapNumberValue(Node* object, Node* value) { | 450 Node* CodeStubAssembler::StoreHeapNumberValue(Node* object, Node* value) { |
445 return StoreNoWriteBarrier( | 451 return StoreNoWriteBarrier( |
446 MachineRepresentation::kFloat64, object, | 452 MachineRepresentation::kFloat64, object, |
447 IntPtrConstant(HeapNumber::kValueOffset - kHeapObjectTag), value); | 453 IntPtrConstant(HeapNumber::kValueOffset - kHeapObjectTag), value); |
448 } | 454 } |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
484 | 490 |
485 Node* CodeStubAssembler::LoadFixedArrayElementInt32Index( | 491 Node* CodeStubAssembler::LoadFixedArrayElementInt32Index( |
486 Node* object, Node* int32_index, int additional_offset) { | 492 Node* object, Node* int32_index, int additional_offset) { |
487 Node* header_size = IntPtrConstant(additional_offset + | 493 Node* header_size = IntPtrConstant(additional_offset + |
488 FixedArray::kHeaderSize - kHeapObjectTag); | 494 FixedArray::kHeaderSize - kHeapObjectTag); |
489 Node* scaled_index = WordShl(int32_index, IntPtrConstant(kPointerSizeLog2)); | 495 Node* scaled_index = WordShl(int32_index, IntPtrConstant(kPointerSizeLog2)); |
490 Node* offset = IntPtrAdd(scaled_index, header_size); | 496 Node* offset = IntPtrAdd(scaled_index, header_size); |
491 return Load(MachineType::AnyTagged(), object, offset); | 497 return Load(MachineType::AnyTagged(), object, offset); |
492 } | 498 } |
493 | 499 |
| 500 Node* CodeStubAssembler::LoadMapInstanceSize(Node* map) { |
| 501 return Load(MachineType::Uint8(), map, |
| 502 IntPtrConstant(Map::kInstanceSizeOffset - kHeapObjectTag)); |
| 503 } |
| 504 |
494 Node* CodeStubAssembler::LoadFixedArrayElementSmiIndex(Node* object, | 505 Node* CodeStubAssembler::LoadFixedArrayElementSmiIndex(Node* object, |
495 Node* smi_index, | 506 Node* smi_index, |
496 int additional_offset) { | 507 int additional_offset) { |
497 int const kSmiShiftBits = kSmiShiftSize + kSmiTagSize; | 508 int const kSmiShiftBits = kSmiShiftSize + kSmiTagSize; |
498 Node* header_size = IntPtrConstant(additional_offset + | 509 Node* header_size = IntPtrConstant(additional_offset + |
499 FixedArray::kHeaderSize - kHeapObjectTag); | 510 FixedArray::kHeaderSize - kHeapObjectTag); |
500 Node* scaled_index = | 511 Node* scaled_index = |
501 (kSmiShiftBits > kPointerSizeLog2) | 512 (kSmiShiftBits > kPointerSizeLog2) |
502 ? WordSar(smi_index, IntPtrConstant(kSmiShiftBits - kPointerSizeLog2)) | 513 ? WordSar(smi_index, IntPtrConstant(kSmiShiftBits - kPointerSizeLog2)) |
503 : WordShl(smi_index, | 514 : WordShl(smi_index, |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
653 if (flags & kDoubleAlignment) { | 664 if (flags & kDoubleAlignment) { |
654 return AllocateRawAligned(IntPtrConstant(size_in_bytes), flags, top_address, | 665 return AllocateRawAligned(IntPtrConstant(size_in_bytes), flags, top_address, |
655 limit_address); | 666 limit_address); |
656 } | 667 } |
657 #endif | 668 #endif |
658 | 669 |
659 return AllocateRawUnaligned(IntPtrConstant(size_in_bytes), flags, top_address, | 670 return AllocateRawUnaligned(IntPtrConstant(size_in_bytes), flags, top_address, |
660 limit_address); | 671 limit_address); |
661 } | 672 } |
662 | 673 |
| 674 Node* CodeStubAssembler::InnerAllocate(Node* previous, int offset) { |
| 675 return IntPtrAdd(previous, IntPtrConstant(offset)); |
| 676 } |
| 677 |
663 Node* CodeStubAssembler::AllocateHeapNumber() { | 678 Node* CodeStubAssembler::AllocateHeapNumber() { |
664 Node* result = Allocate(HeapNumber::kSize, kNone); | 679 Node* result = Allocate(HeapNumber::kSize, kNone); |
665 StoreMapNoWriteBarrier(result, HeapNumberMapConstant()); | 680 StoreMapNoWriteBarrier(result, HeapNumberMapConstant()); |
666 return result; | 681 return result; |
667 } | 682 } |
668 | 683 |
669 Node* CodeStubAssembler::AllocateHeapNumberWithValue(Node* value) { | 684 Node* CodeStubAssembler::AllocateHeapNumberWithValue(Node* value) { |
670 Node* result = AllocateHeapNumber(); | 685 Node* result = AllocateHeapNumber(); |
671 StoreHeapNumberValue(result, value); | 686 StoreHeapNumberValue(result, value); |
672 return result; | 687 return result; |
(...skipping 671 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1344 } | 1359 } |
1345 } | 1360 } |
1346 } | 1361 } |
1347 | 1362 |
1348 bound_ = true; | 1363 bound_ = true; |
1349 } | 1364 } |
1350 | 1365 |
1351 } // namespace compiler | 1366 } // namespace compiler |
1352 } // namespace internal | 1367 } // namespace internal |
1353 } // namespace v8 | 1368 } // namespace v8 |
OLD | NEW |