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