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