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 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
370 Node* value = LoadHeapNumberValue(object); | 370 Node* value = LoadHeapNumberValue(object); |
371 return raw_assembler_->TruncateFloat64ToInt32(TruncationMode::kJavaScript, | 371 return raw_assembler_->TruncateFloat64ToInt32(TruncationMode::kJavaScript, |
372 value); | 372 value); |
373 } | 373 } |
374 | 374 |
375 Node* CodeStubAssembler::LoadMapBitField(Node* map) { | 375 Node* CodeStubAssembler::LoadMapBitField(Node* map) { |
376 return Load(MachineType::Uint8(), map, | 376 return Load(MachineType::Uint8(), map, |
377 IntPtrConstant(Map::kBitFieldOffset - kHeapObjectTag)); | 377 IntPtrConstant(Map::kBitFieldOffset - kHeapObjectTag)); |
378 } | 378 } |
379 | 379 |
| 380 Node* CodeStubAssembler::LoadMapBitField2(Node* map) { |
| 381 return Load(MachineType::Uint8(), map, |
| 382 IntPtrConstant(Map::kBitField2Offset - kHeapObjectTag)); |
| 383 } |
| 384 |
| 385 Node* CodeStubAssembler::LoadMapBitField3(Node* map) { |
| 386 return Load(MachineType::Uint32(), map, |
| 387 IntPtrConstant(Map::kBitField3Offset - kHeapObjectTag)); |
| 388 } |
| 389 |
380 Node* CodeStubAssembler::LoadMapInstanceType(Node* map) { | 390 Node* CodeStubAssembler::LoadMapInstanceType(Node* map) { |
381 return Load(MachineType::Uint8(), map, | 391 return Load(MachineType::Uint8(), map, |
382 IntPtrConstant(Map::kInstanceTypeOffset - kHeapObjectTag)); | 392 IntPtrConstant(Map::kInstanceTypeOffset - kHeapObjectTag)); |
383 } | 393 } |
384 | 394 |
| 395 Node* CodeStubAssembler::LoadMapDescriptors(Node* map) { |
| 396 return LoadObjectField(map, Map::kDescriptorsOffset); |
| 397 } |
| 398 |
| 399 Node* CodeStubAssembler::LoadNameHash(Node* name) { |
| 400 return Load(MachineType::Uint32(), name, |
| 401 IntPtrConstant(Name::kHashFieldOffset - kHeapObjectTag)); |
| 402 } |
| 403 |
| 404 Node* CodeStubAssembler::LoadFixedArrayElementInt32Index( |
| 405 Node* object, Node* int32_index, int additional_offset) { |
| 406 Node* header_size = IntPtrConstant(additional_offset + |
| 407 FixedArray::kHeaderSize - kHeapObjectTag); |
| 408 Node* scaled_index = WordShl(int32_index, IntPtrConstant(kPointerSizeLog2)); |
| 409 Node* offset = IntPtrAdd(scaled_index, header_size); |
| 410 return Load(MachineType::AnyTagged(), object, offset); |
| 411 } |
| 412 |
385 Node* CodeStubAssembler::LoadFixedArrayElementSmiIndex(Node* object, | 413 Node* CodeStubAssembler::LoadFixedArrayElementSmiIndex(Node* object, |
386 Node* smi_index, | 414 Node* smi_index, |
387 int additional_offset) { | 415 int additional_offset) { |
388 int const kSmiShiftBits = kSmiShiftSize + kSmiTagSize; | 416 int const kSmiShiftBits = kSmiShiftSize + kSmiTagSize; |
389 Node* header_size = IntPtrConstant(additional_offset + | 417 Node* header_size = IntPtrConstant(additional_offset + |
390 FixedArray::kHeaderSize - kHeapObjectTag); | 418 FixedArray::kHeaderSize - kHeapObjectTag); |
391 Node* scaled_index = | 419 Node* scaled_index = |
392 (kSmiShiftBits > kPointerSizeLog2) | 420 (kSmiShiftBits > kPointerSizeLog2) |
393 ? WordSar(smi_index, IntPtrConstant(kSmiShiftBits - kPointerSizeLog2)) | 421 ? WordSar(smi_index, IntPtrConstant(kSmiShiftBits - kPointerSizeLog2)) |
394 : WordShl(smi_index, | 422 : WordShl(smi_index, |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
603 Node* CodeStubAssembler::StoreMapNoWriteBarrier(Node* object, Node* map) { | 631 Node* CodeStubAssembler::StoreMapNoWriteBarrier(Node* object, Node* map) { |
604 return StoreNoWriteBarrier( | 632 return StoreNoWriteBarrier( |
605 MachineRepresentation::kTagged, object, | 633 MachineRepresentation::kTagged, object, |
606 IntPtrConstant(HeapNumber::kMapOffset - kHeapObjectTag), map); | 634 IntPtrConstant(HeapNumber::kMapOffset - kHeapObjectTag), map); |
607 } | 635 } |
608 | 636 |
609 Node* CodeStubAssembler::LoadInstanceType(Node* object) { | 637 Node* CodeStubAssembler::LoadInstanceType(Node* object) { |
610 return LoadMapInstanceType(LoadMap(object)); | 638 return LoadMapInstanceType(LoadMap(object)); |
611 } | 639 } |
612 | 640 |
| 641 Node* CodeStubAssembler::LoadElements(Node* object) { |
| 642 return LoadObjectField(object, JSObject::kElementsOffset); |
| 643 } |
| 644 |
| 645 Node* CodeStubAssembler::LoadFixedArrayBaseLength(Node* array) { |
| 646 return LoadObjectField(array, FixedArrayBase::kLengthOffset); |
| 647 } |
| 648 |
613 Node* CodeStubAssembler::BitFieldDecode(Node* word32, uint32_t shift, | 649 Node* CodeStubAssembler::BitFieldDecode(Node* word32, uint32_t shift, |
614 uint32_t mask) { | 650 uint32_t mask) { |
615 return raw_assembler_->Word32Shr( | 651 return raw_assembler_->Word32Shr( |
616 raw_assembler_->Word32And(word32, raw_assembler_->Int32Constant(mask)), | 652 raw_assembler_->Word32And(word32, raw_assembler_->Int32Constant(mask)), |
617 raw_assembler_->Int32Constant(shift)); | 653 raw_assembler_->Int32Constant(shift)); |
618 } | 654 } |
619 | 655 |
620 Node* CodeStubAssembler::ChangeFloat64ToTagged(Node* value) { | 656 Node* CodeStubAssembler::ChangeFloat64ToTagged(Node* value) { |
621 Node* value32 = raw_assembler_->TruncateFloat64ToInt32( | 657 Node* value32 = raw_assembler_->TruncateFloat64ToInt32( |
622 TruncationMode::kRoundToZero, value); | 658 TruncationMode::kRoundToZero, value); |
(...skipping 593 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1216 } | 1252 } |
1217 } | 1253 } |
1218 } | 1254 } |
1219 | 1255 |
1220 bound_ = true; | 1256 bound_ = true; |
1221 } | 1257 } |
1222 | 1258 |
1223 } // namespace compiler | 1259 } // namespace compiler |
1224 } // namespace internal | 1260 } // namespace internal |
1225 } // namespace v8 | 1261 } // namespace v8 |
OLD | NEW |