OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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/mips64/codegen-mips64.h" | 5 #include "src/mips64/codegen-mips64.h" |
6 | 6 |
7 #if V8_TARGET_ARCH_MIPS64 | 7 #if V8_TARGET_ARCH_MIPS64 |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 | 10 |
(...skipping 604 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
615 // Fetch the instance type of the receiver into result register. | 615 // Fetch the instance type of the receiver into result register. |
616 __ ld(result, FieldMemOperand(string, HeapObject::kMapOffset)); | 616 __ ld(result, FieldMemOperand(string, HeapObject::kMapOffset)); |
617 __ lbu(result, FieldMemOperand(result, Map::kInstanceTypeOffset)); | 617 __ lbu(result, FieldMemOperand(result, Map::kInstanceTypeOffset)); |
618 | 618 |
619 // We need special handling for indirect strings. | 619 // We need special handling for indirect strings. |
620 Label check_sequential; | 620 Label check_sequential; |
621 __ And(at, result, Operand(kIsIndirectStringMask)); | 621 __ And(at, result, Operand(kIsIndirectStringMask)); |
622 __ Branch(&check_sequential, eq, at, Operand(zero_reg)); | 622 __ Branch(&check_sequential, eq, at, Operand(zero_reg)); |
623 | 623 |
624 // Dispatch on the indirect string shape: slice or cons. | 624 // Dispatch on the indirect string shape: slice or cons. |
625 Label cons_string, thin_string; | 625 Label cons_string; |
626 __ And(at, result, Operand(kStringRepresentationMask)); | 626 __ And(at, result, Operand(kSlicedNotConsMask)); |
627 __ Branch(&cons_string, eq, at, Operand(kConsStringTag)); | 627 __ Branch(&cons_string, eq, at, Operand(zero_reg)); |
628 __ Branch(&thin_string, eq, at, Operand(kThinStringTag)); | |
629 | 628 |
630 // Handle slices. | 629 // Handle slices. |
631 Label indirect_string_loaded; | 630 Label indirect_string_loaded; |
632 __ ld(result, FieldMemOperand(string, SlicedString::kOffsetOffset)); | 631 __ ld(result, FieldMemOperand(string, SlicedString::kOffsetOffset)); |
633 __ ld(string, FieldMemOperand(string, SlicedString::kParentOffset)); | 632 __ ld(string, FieldMemOperand(string, SlicedString::kParentOffset)); |
634 __ dsra32(at, result, 0); | 633 __ dsra32(at, result, 0); |
635 __ Daddu(index, index, at); | 634 __ Daddu(index, index, at); |
636 __ jmp(&indirect_string_loaded); | 635 __ jmp(&indirect_string_loaded); |
637 | 636 |
638 // Handle thin strings. | |
639 __ bind(&thin_string); | |
640 __ ld(string, FieldMemOperand(string, ThinString::kActualOffset)); | |
641 __ jmp(&indirect_string_loaded); | |
642 | |
643 // Handle cons strings. | 637 // Handle cons strings. |
644 // Check whether the right hand side is the empty string (i.e. if | 638 // Check whether the right hand side is the empty string (i.e. if |
645 // this is really a flat string in a cons string). If that is not | 639 // this is really a flat string in a cons string). If that is not |
646 // the case we would rather go to the runtime system now to flatten | 640 // the case we would rather go to the runtime system now to flatten |
647 // the string. | 641 // the string. |
648 __ bind(&cons_string); | 642 __ bind(&cons_string); |
649 __ ld(result, FieldMemOperand(string, ConsString::kSecondOffset)); | 643 __ ld(result, FieldMemOperand(string, ConsString::kSecondOffset)); |
650 __ LoadRoot(at, Heap::kempty_stringRootIndex); | 644 __ LoadRoot(at, Heap::kempty_stringRootIndex); |
651 __ Branch(call_runtime, ne, result, Operand(at)); | 645 __ Branch(call_runtime, ne, result, Operand(at)); |
652 // Get the first of the two strings and load its instance type. | 646 // Get the first of the two strings and load its instance type. |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
775 } | 769 } |
776 } | 770 } |
777 | 771 |
778 | 772 |
779 #undef __ | 773 #undef __ |
780 | 774 |
781 } // namespace internal | 775 } // namespace internal |
782 } // namespace v8 | 776 } // namespace v8 |
783 | 777 |
784 #endif // V8_TARGET_ARCH_MIPS64 | 778 #endif // V8_TARGET_ARCH_MIPS64 |
OLD | NEW |