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

Side by Side Diff: src/arm/full-codegen-arm.cc

Issue 11411005: Rename SeqAsciiString (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « src/arm/codegen-arm.cc ('k') | src/arm/macro-assembler-arm.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 3606 matching lines...) Expand 10 before | Expand all | Expand 10 after
3617 if (generate_debug_code_) { 3617 if (generate_debug_code_) {
3618 __ cmp(array_length, Operand(0)); 3618 __ cmp(array_length, Operand(0));
3619 __ Assert(gt, "No empty arrays here in EmitFastAsciiArrayJoin"); 3619 __ Assert(gt, "No empty arrays here in EmitFastAsciiArrayJoin");
3620 } 3620 }
3621 __ bind(&loop); 3621 __ bind(&loop);
3622 __ ldr(string, MemOperand(element, kPointerSize, PostIndex)); 3622 __ ldr(string, MemOperand(element, kPointerSize, PostIndex));
3623 __ JumpIfSmi(string, &bailout); 3623 __ JumpIfSmi(string, &bailout);
3624 __ ldr(scratch1, FieldMemOperand(string, HeapObject::kMapOffset)); 3624 __ ldr(scratch1, FieldMemOperand(string, HeapObject::kMapOffset));
3625 __ ldrb(scratch1, FieldMemOperand(scratch1, Map::kInstanceTypeOffset)); 3625 __ ldrb(scratch1, FieldMemOperand(scratch1, Map::kInstanceTypeOffset));
3626 __ JumpIfInstanceTypeIsNotSequentialAscii(scratch1, scratch2, &bailout); 3626 __ JumpIfInstanceTypeIsNotSequentialAscii(scratch1, scratch2, &bailout);
3627 __ ldr(scratch1, FieldMemOperand(string, SeqAsciiString::kLengthOffset)); 3627 __ ldr(scratch1, FieldMemOperand(string, SeqOneByteString::kLengthOffset));
3628 __ add(string_length, string_length, Operand(scratch1), SetCC); 3628 __ add(string_length, string_length, Operand(scratch1), SetCC);
3629 __ b(vs, &bailout); 3629 __ b(vs, &bailout);
3630 __ cmp(element, elements_end); 3630 __ cmp(element, elements_end);
3631 __ b(lt, &loop); 3631 __ b(lt, &loop);
3632 3632
3633 // If array_length is 1, return elements[0], a string. 3633 // If array_length is 1, return elements[0], a string.
3634 __ cmp(array_length, Operand(1)); 3634 __ cmp(array_length, Operand(1));
3635 __ b(ne, &not_size_one_array); 3635 __ b(ne, &not_size_one_array);
3636 __ ldr(r0, FieldMemOperand(elements, FixedArray::kHeaderSize)); 3636 __ ldr(r0, FieldMemOperand(elements, FixedArray::kHeaderSize));
3637 __ b(&done); 3637 __ b(&done);
3638 3638
3639 __ bind(&not_size_one_array); 3639 __ bind(&not_size_one_array);
3640 3640
3641 // Live values in registers: 3641 // Live values in registers:
3642 // separator: Separator string 3642 // separator: Separator string
3643 // array_length: Length of the array. 3643 // array_length: Length of the array.
3644 // string_length: Sum of string lengths (smi). 3644 // string_length: Sum of string lengths (smi).
3645 // elements: FixedArray of strings. 3645 // elements: FixedArray of strings.
3646 3646
3647 // Check that the separator is a flat ASCII string. 3647 // Check that the separator is a flat ASCII string.
3648 __ JumpIfSmi(separator, &bailout); 3648 __ JumpIfSmi(separator, &bailout);
3649 __ ldr(scratch1, FieldMemOperand(separator, HeapObject::kMapOffset)); 3649 __ ldr(scratch1, FieldMemOperand(separator, HeapObject::kMapOffset));
3650 __ ldrb(scratch1, FieldMemOperand(scratch1, Map::kInstanceTypeOffset)); 3650 __ ldrb(scratch1, FieldMemOperand(scratch1, Map::kInstanceTypeOffset));
3651 __ JumpIfInstanceTypeIsNotSequentialAscii(scratch1, scratch2, &bailout); 3651 __ JumpIfInstanceTypeIsNotSequentialAscii(scratch1, scratch2, &bailout);
3652 3652
3653 // Add (separator length times array_length) - separator length to the 3653 // Add (separator length times array_length) - separator length to the
3654 // string_length to get the length of the result string. array_length is not 3654 // string_length to get the length of the result string. array_length is not
3655 // smi but the other values are, so the result is a smi 3655 // smi but the other values are, so the result is a smi
3656 __ ldr(scratch1, FieldMemOperand(separator, SeqAsciiString::kLengthOffset)); 3656 __ ldr(scratch1, FieldMemOperand(separator, SeqOneByteString::kLengthOffset));
3657 __ sub(string_length, string_length, Operand(scratch1)); 3657 __ sub(string_length, string_length, Operand(scratch1));
3658 __ smull(scratch2, ip, array_length, scratch1); 3658 __ smull(scratch2, ip, array_length, scratch1);
3659 // Check for smi overflow. No overflow if higher 33 bits of 64-bit result are 3659 // Check for smi overflow. No overflow if higher 33 bits of 64-bit result are
3660 // zero. 3660 // zero.
3661 __ cmp(ip, Operand(0)); 3661 __ cmp(ip, Operand(0));
3662 __ b(ne, &bailout); 3662 __ b(ne, &bailout);
3663 __ tst(scratch2, Operand(0x80000000)); 3663 __ tst(scratch2, Operand(0x80000000));
3664 __ b(ne, &bailout); 3664 __ b(ne, &bailout);
3665 __ add(string_length, string_length, Operand(scratch2), SetCC); 3665 __ add(string_length, string_length, Operand(scratch2), SetCC);
3666 __ b(vs, &bailout); 3666 __ b(vs, &bailout);
(...skipping 17 matching lines...) Expand all
3684 elements_end, 3684 elements_end,
3685 &bailout); 3685 &bailout);
3686 // Prepare for looping. Set up elements_end to end of the array. Set 3686 // Prepare for looping. Set up elements_end to end of the array. Set
3687 // result_pos to the position of the result where to write the first 3687 // result_pos to the position of the result where to write the first
3688 // character. 3688 // character.
3689 __ add(elements_end, element, Operand(array_length, LSL, kPointerSizeLog2)); 3689 __ add(elements_end, element, Operand(array_length, LSL, kPointerSizeLog2));
3690 result_pos = array_length; // End of live range for array_length. 3690 result_pos = array_length; // End of live range for array_length.
3691 array_length = no_reg; 3691 array_length = no_reg;
3692 __ add(result_pos, 3692 __ add(result_pos,
3693 result, 3693 result,
3694 Operand(SeqAsciiString::kHeaderSize - kHeapObjectTag)); 3694 Operand(SeqOneByteString::kHeaderSize - kHeapObjectTag));
3695 3695
3696 // Check the length of the separator. 3696 // Check the length of the separator.
3697 __ ldr(scratch1, FieldMemOperand(separator, SeqAsciiString::kLengthOffset)); 3697 __ ldr(scratch1, FieldMemOperand(separator, SeqOneByteString::kLengthOffset));
3698 __ cmp(scratch1, Operand(Smi::FromInt(1))); 3698 __ cmp(scratch1, Operand(Smi::FromInt(1)));
3699 __ b(eq, &one_char_separator); 3699 __ b(eq, &one_char_separator);
3700 __ b(gt, &long_separator); 3700 __ b(gt, &long_separator);
3701 3701
3702 // Empty separator case 3702 // Empty separator case
3703 __ bind(&empty_separator_loop); 3703 __ bind(&empty_separator_loop);
3704 // Live values in registers: 3704 // Live values in registers:
3705 // result_pos: the position to which we are currently copying characters. 3705 // result_pos: the position to which we are currently copying characters.
3706 // element: Current array element. 3706 // element: Current array element.
3707 // elements_end: Array end. 3707 // elements_end: Array end.
3708 3708
3709 // Copy next array element to the result. 3709 // Copy next array element to the result.
3710 __ ldr(string, MemOperand(element, kPointerSize, PostIndex)); 3710 __ ldr(string, MemOperand(element, kPointerSize, PostIndex));
3711 __ ldr(string_length, FieldMemOperand(string, String::kLengthOffset)); 3711 __ ldr(string_length, FieldMemOperand(string, String::kLengthOffset));
3712 __ SmiUntag(string_length); 3712 __ SmiUntag(string_length);
3713 __ add(string, string, Operand(SeqAsciiString::kHeaderSize - kHeapObjectTag)); 3713 __ add(string,
3714 string,
3715 Operand(SeqOneByteString::kHeaderSize - kHeapObjectTag));
3714 __ CopyBytes(string, result_pos, string_length, scratch1); 3716 __ CopyBytes(string, result_pos, string_length, scratch1);
3715 __ cmp(element, elements_end); 3717 __ cmp(element, elements_end);
3716 __ b(lt, &empty_separator_loop); // End while (element < elements_end). 3718 __ b(lt, &empty_separator_loop); // End while (element < elements_end).
3717 ASSERT(result.is(r0)); 3719 ASSERT(result.is(r0));
3718 __ b(&done); 3720 __ b(&done);
3719 3721
3720 // One-character separator case 3722 // One-character separator case
3721 __ bind(&one_char_separator); 3723 __ bind(&one_char_separator);
3722 // Replace separator with its ASCII character value. 3724 // Replace separator with its ASCII character value.
3723 __ ldrb(separator, FieldMemOperand(separator, SeqAsciiString::kHeaderSize)); 3725 __ ldrb(separator, FieldMemOperand(separator, SeqOneByteString::kHeaderSize));
3724 // Jump into the loop after the code that copies the separator, so the first 3726 // Jump into the loop after the code that copies the separator, so the first
3725 // element is not preceded by a separator 3727 // element is not preceded by a separator
3726 __ jmp(&one_char_separator_loop_entry); 3728 __ jmp(&one_char_separator_loop_entry);
3727 3729
3728 __ bind(&one_char_separator_loop); 3730 __ bind(&one_char_separator_loop);
3729 // Live values in registers: 3731 // Live values in registers:
3730 // result_pos: the position to which we are currently copying characters. 3732 // result_pos: the position to which we are currently copying characters.
3731 // element: Current array element. 3733 // element: Current array element.
3732 // elements_end: Array end. 3734 // elements_end: Array end.
3733 // separator: Single separator ASCII char (in lower byte). 3735 // separator: Single separator ASCII char (in lower byte).
3734 3736
3735 // Copy the separator character to the result. 3737 // Copy the separator character to the result.
3736 __ strb(separator, MemOperand(result_pos, 1, PostIndex)); 3738 __ strb(separator, MemOperand(result_pos, 1, PostIndex));
3737 3739
3738 // Copy next array element to the result. 3740 // Copy next array element to the result.
3739 __ bind(&one_char_separator_loop_entry); 3741 __ bind(&one_char_separator_loop_entry);
3740 __ ldr(string, MemOperand(element, kPointerSize, PostIndex)); 3742 __ ldr(string, MemOperand(element, kPointerSize, PostIndex));
3741 __ ldr(string_length, FieldMemOperand(string, String::kLengthOffset)); 3743 __ ldr(string_length, FieldMemOperand(string, String::kLengthOffset));
3742 __ SmiUntag(string_length); 3744 __ SmiUntag(string_length);
3743 __ add(string, string, Operand(SeqAsciiString::kHeaderSize - kHeapObjectTag)); 3745 __ add(string,
3746 string,
3747 Operand(SeqOneByteString::kHeaderSize - kHeapObjectTag));
3744 __ CopyBytes(string, result_pos, string_length, scratch1); 3748 __ CopyBytes(string, result_pos, string_length, scratch1);
3745 __ cmp(element, elements_end); 3749 __ cmp(element, elements_end);
3746 __ b(lt, &one_char_separator_loop); // End while (element < elements_end). 3750 __ b(lt, &one_char_separator_loop); // End while (element < elements_end).
3747 ASSERT(result.is(r0)); 3751 ASSERT(result.is(r0));
3748 __ b(&done); 3752 __ b(&done);
3749 3753
3750 // Long separator case (separator is more than one character). Entry is at the 3754 // Long separator case (separator is more than one character). Entry is at the
3751 // label long_separator below. 3755 // label long_separator below.
3752 __ bind(&long_separator_loop); 3756 __ bind(&long_separator_loop);
3753 // Live values in registers: 3757 // Live values in registers:
3754 // result_pos: the position to which we are currently copying characters. 3758 // result_pos: the position to which we are currently copying characters.
3755 // element: Current array element. 3759 // element: Current array element.
3756 // elements_end: Array end. 3760 // elements_end: Array end.
3757 // separator: Separator string. 3761 // separator: Separator string.
3758 3762
3759 // Copy the separator to the result. 3763 // Copy the separator to the result.
3760 __ ldr(string_length, FieldMemOperand(separator, String::kLengthOffset)); 3764 __ ldr(string_length, FieldMemOperand(separator, String::kLengthOffset));
3761 __ SmiUntag(string_length); 3765 __ SmiUntag(string_length);
3762 __ add(string, 3766 __ add(string,
3763 separator, 3767 separator,
3764 Operand(SeqAsciiString::kHeaderSize - kHeapObjectTag)); 3768 Operand(SeqOneByteString::kHeaderSize - kHeapObjectTag));
3765 __ CopyBytes(string, result_pos, string_length, scratch1); 3769 __ CopyBytes(string, result_pos, string_length, scratch1);
3766 3770
3767 __ bind(&long_separator); 3771 __ bind(&long_separator);
3768 __ ldr(string, MemOperand(element, kPointerSize, PostIndex)); 3772 __ ldr(string, MemOperand(element, kPointerSize, PostIndex));
3769 __ ldr(string_length, FieldMemOperand(string, String::kLengthOffset)); 3773 __ ldr(string_length, FieldMemOperand(string, String::kLengthOffset));
3770 __ SmiUntag(string_length); 3774 __ SmiUntag(string_length);
3771 __ add(string, string, Operand(SeqAsciiString::kHeaderSize - kHeapObjectTag)); 3775 __ add(string,
3776 string,
3777 Operand(SeqOneByteString::kHeaderSize - kHeapObjectTag));
3772 __ CopyBytes(string, result_pos, string_length, scratch1); 3778 __ CopyBytes(string, result_pos, string_length, scratch1);
3773 __ cmp(element, elements_end); 3779 __ cmp(element, elements_end);
3774 __ b(lt, &long_separator_loop); // End while (element < elements_end). 3780 __ b(lt, &long_separator_loop); // End while (element < elements_end).
3775 ASSERT(result.is(r0)); 3781 ASSERT(result.is(r0));
3776 __ b(&done); 3782 __ b(&done);
3777 3783
3778 __ bind(&bailout); 3784 __ bind(&bailout);
3779 __ LoadRoot(r0, Heap::kUndefinedValueRootIndex); 3785 __ LoadRoot(r0, Heap::kUndefinedValueRootIndex);
3780 __ bind(&done); 3786 __ bind(&done);
3781 context()->Plug(r0); 3787 context()->Plug(r0);
(...skipping 733 matching lines...) Expand 10 before | Expand all | Expand 10 after
4515 *context_length = 0; 4521 *context_length = 0;
4516 return previous_; 4522 return previous_;
4517 } 4523 }
4518 4524
4519 4525
4520 #undef __ 4526 #undef __
4521 4527
4522 } } // namespace v8::internal 4528 } } // namespace v8::internal
4523 4529
4524 #endif // V8_TARGET_ARCH_ARM 4530 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « src/arm/codegen-arm.cc ('k') | src/arm/macro-assembler-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698