| 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; | 625 Label cons_string, thin_string; |
| 626 __ And(at, result, Operand(kSlicedNotConsMask)); | 626 __ And(at, result, Operand(kStringRepresentationMask)); |
| 627 __ Branch(&cons_string, eq, at, Operand(zero_reg)); | 627 __ Branch(&cons_string, eq, at, Operand(kConsStringTag)); |
| 628 __ Branch(&thin_string, eq, at, Operand(kThinStringTag)); |
| 628 | 629 |
| 629 // Handle slices. | 630 // Handle slices. |
| 630 Label indirect_string_loaded; | 631 Label indirect_string_loaded; |
| 631 __ ld(result, FieldMemOperand(string, SlicedString::kOffsetOffset)); | 632 __ ld(result, FieldMemOperand(string, SlicedString::kOffsetOffset)); |
| 632 __ ld(string, FieldMemOperand(string, SlicedString::kParentOffset)); | 633 __ ld(string, FieldMemOperand(string, SlicedString::kParentOffset)); |
| 633 __ dsra32(at, result, 0); | 634 __ dsra32(at, result, 0); |
| 634 __ Daddu(index, index, at); | 635 __ Daddu(index, index, at); |
| 635 __ jmp(&indirect_string_loaded); | 636 __ jmp(&indirect_string_loaded); |
| 636 | 637 |
| 638 // Handle thin strings. |
| 639 __ bind(&thin_string); |
| 640 __ ld(string, FieldMemOperand(string, ThinString::kActualOffset)); |
| 641 __ jmp(&indirect_string_loaded); |
| 642 |
| 637 // Handle cons strings. | 643 // Handle cons strings. |
| 638 // Check whether the right hand side is the empty string (i.e. if | 644 // Check whether the right hand side is the empty string (i.e. if |
| 639 // this is really a flat string in a cons string). If that is not | 645 // this is really a flat string in a cons string). If that is not |
| 640 // the case we would rather go to the runtime system now to flatten | 646 // the case we would rather go to the runtime system now to flatten |
| 641 // the string. | 647 // the string. |
| 642 __ bind(&cons_string); | 648 __ bind(&cons_string); |
| 643 __ ld(result, FieldMemOperand(string, ConsString::kSecondOffset)); | 649 __ ld(result, FieldMemOperand(string, ConsString::kSecondOffset)); |
| 644 __ LoadRoot(at, Heap::kempty_stringRootIndex); | 650 __ LoadRoot(at, Heap::kempty_stringRootIndex); |
| 645 __ Branch(call_runtime, ne, result, Operand(at)); | 651 __ Branch(call_runtime, ne, result, Operand(at)); |
| 646 // Get the first of the two strings and load its instance type. | 652 // 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... |
| 769 } | 775 } |
| 770 } | 776 } |
| 771 | 777 |
| 772 | 778 |
| 773 #undef __ | 779 #undef __ |
| 774 | 780 |
| 775 } // namespace internal | 781 } // namespace internal |
| 776 } // namespace v8 | 782 } // namespace v8 |
| 777 | 783 |
| 778 #endif // V8_TARGET_ARCH_MIPS64 | 784 #endif // V8_TARGET_ARCH_MIPS64 |
| OLD | NEW |