Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(309)

Side by Side Diff: src/mips/codegen-mips.cc

Issue 2549773002: Internalize strings in-place (Closed)
Patch Set: forgot one Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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; 623 Label cons_string, thin_string;
624 __ And(at, result, Operand(kSlicedNotConsMask)); 624 __ And(at, result, Operand(kStringRepresentationMask));
625 __ Branch(&cons_string, eq, at, Operand(zero_reg)); 625 __ Branch(&cons_string, eq, at, Operand(kConsStringTag));
626 __ Branch(&thin_string, eq, at, Operand(kThinStringTag));
626 627
627 // Handle slices. 628 // Handle slices.
628 Label indirect_string_loaded; 629 Label indirect_string_loaded;
629 __ lw(result, FieldMemOperand(string, SlicedString::kOffsetOffset)); 630 __ lw(result, FieldMemOperand(string, SlicedString::kOffsetOffset));
630 __ lw(string, FieldMemOperand(string, SlicedString::kParentOffset)); 631 __ lw(string, FieldMemOperand(string, SlicedString::kParentOffset));
631 __ sra(at, result, kSmiTagSize); 632 __ sra(at, result, kSmiTagSize);
632 __ Addu(index, index, at); 633 __ Addu(index, index, at);
633 __ jmp(&indirect_string_loaded); 634 __ jmp(&indirect_string_loaded);
634 635
636 // Handle thin strings.
637 __ bind(&thin_string);
638 __ lw(string, FieldMemOperand(string, ThinString::kActualOffset));
639 __ jmp(&indirect_string_loaded);
640
635 // Handle cons strings. 641 // Handle cons strings.
636 // Check whether the right hand side is the empty string (i.e. if 642 // Check whether the right hand side is the empty string (i.e. if
637 // this is really a flat string in a cons string). If that is not 643 // this is really a flat string in a cons string). If that is not
638 // the case we would rather go to the runtime system now to flatten 644 // the case we would rather go to the runtime system now to flatten
639 // the string. 645 // the string.
640 __ bind(&cons_string); 646 __ bind(&cons_string);
641 __ lw(result, FieldMemOperand(string, ConsString::kSecondOffset)); 647 __ lw(result, FieldMemOperand(string, ConsString::kSecondOffset));
642 __ LoadRoot(at, Heap::kempty_stringRootIndex); 648 __ LoadRoot(at, Heap::kempty_stringRootIndex);
643 __ Branch(call_runtime, ne, result, Operand(at)); 649 __ Branch(call_runtime, ne, result, Operand(at));
644 // Get the first of the two strings and load its instance type. 650 // Get the first of the two strings and load its instance type.
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
765 } 771 }
766 } 772 }
767 773
768 774
769 #undef __ 775 #undef __
770 776
771 } // namespace internal 777 } // namespace internal
772 } // namespace v8 778 } // namespace v8
773 779
774 #endif // V8_TARGET_ARCH_MIPS 780 #endif // V8_TARGET_ARCH_MIPS
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698