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

Side by Side Diff: src/x64/macro-assembler-x64.cc

Issue 7795018: Generated code for substring slices in x64 and arm. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Applied Bill's suggestions. Created 9 years, 3 months 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/x64/macro-assembler-x64.h ('k') | test/cctest/test-strings.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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 3605 matching lines...) Expand 10 before | Expand all | Expand 10 after
3616 // Set the map, length and hash field. 3616 // Set the map, length and hash field.
3617 LoadRoot(kScratchRegister, Heap::kAsciiStringMapRootIndex); 3617 LoadRoot(kScratchRegister, Heap::kAsciiStringMapRootIndex);
3618 movq(FieldOperand(result, HeapObject::kMapOffset), kScratchRegister); 3618 movq(FieldOperand(result, HeapObject::kMapOffset), kScratchRegister);
3619 Integer32ToSmi(scratch1, length); 3619 Integer32ToSmi(scratch1, length);
3620 movq(FieldOperand(result, String::kLengthOffset), scratch1); 3620 movq(FieldOperand(result, String::kLengthOffset), scratch1);
3621 movq(FieldOperand(result, String::kHashFieldOffset), 3621 movq(FieldOperand(result, String::kHashFieldOffset),
3622 Immediate(String::kEmptyHashField)); 3622 Immediate(String::kEmptyHashField));
3623 } 3623 }
3624 3624
3625 3625
3626 void MacroAssembler::AllocateConsString(Register result, 3626 void MacroAssembler::AllocateTwoByteConsString(Register result,
3627 Register scratch1, 3627 Register scratch1,
3628 Register scratch2, 3628 Register scratch2,
3629 Label* gc_required) { 3629 Label* gc_required) {
3630 // Allocate heap number in new space. 3630 // Allocate heap number in new space.
3631 AllocateInNewSpace(ConsString::kSize, 3631 AllocateInNewSpace(ConsString::kSize,
3632 result, 3632 result,
3633 scratch1, 3633 scratch1,
3634 scratch2, 3634 scratch2,
3635 gc_required, 3635 gc_required,
3636 TAG_OBJECT); 3636 TAG_OBJECT);
(...skipping 15 matching lines...) Expand all
3652 scratch2, 3652 scratch2,
3653 gc_required, 3653 gc_required,
3654 TAG_OBJECT); 3654 TAG_OBJECT);
3655 3655
3656 // Set the map. The other fields are left uninitialized. 3656 // Set the map. The other fields are left uninitialized.
3657 LoadRoot(kScratchRegister, Heap::kConsAsciiStringMapRootIndex); 3657 LoadRoot(kScratchRegister, Heap::kConsAsciiStringMapRootIndex);
3658 movq(FieldOperand(result, HeapObject::kMapOffset), kScratchRegister); 3658 movq(FieldOperand(result, HeapObject::kMapOffset), kScratchRegister);
3659 } 3659 }
3660 3660
3661 3661
3662 void MacroAssembler::AllocateTwoByteSlicedString(Register result,
3663 Register scratch1,
3664 Register scratch2,
3665 Label* gc_required) {
3666 // Allocate heap number in new space.
3667 AllocateInNewSpace(SlicedString::kSize,
3668 result,
3669 scratch1,
3670 scratch2,
3671 gc_required,
3672 TAG_OBJECT);
3673
3674 // Set the map. The other fields are left uninitialized.
3675 LoadRoot(kScratchRegister, Heap::kSlicedStringMapRootIndex);
3676 movq(FieldOperand(result, HeapObject::kMapOffset), kScratchRegister);
3677 }
3678
3679
3680 void MacroAssembler::AllocateAsciiSlicedString(Register result,
3681 Register scratch1,
3682 Register scratch2,
3683 Label* gc_required) {
3684 // Allocate heap number in new space.
3685 AllocateInNewSpace(SlicedString::kSize,
3686 result,
3687 scratch1,
3688 scratch2,
3689 gc_required,
3690 TAG_OBJECT);
3691
3692 // Set the map. The other fields are left uninitialized.
3693 LoadRoot(kScratchRegister, Heap::kSlicedAsciiStringMapRootIndex);
3694 movq(FieldOperand(result, HeapObject::kMapOffset), kScratchRegister);
3695 }
3696
3697
3662 // Copy memory, byte-by-byte, from source to destination. Not optimized for 3698 // Copy memory, byte-by-byte, from source to destination. Not optimized for
3663 // long or aligned copies. The contents of scratch and length are destroyed. 3699 // long or aligned copies. The contents of scratch and length are destroyed.
3664 // Destination is incremented by length, source, length and scratch are 3700 // Destination is incremented by length, source, length and scratch are
3665 // clobbered. 3701 // clobbered.
3666 // A simpler loop is faster on small copies, but slower on large ones. 3702 // A simpler loop is faster on small copies, but slower on large ones.
3667 // The cld() instruction must have been emitted, to set the direction flag(), 3703 // The cld() instruction must have been emitted, to set the direction flag(),
3668 // before calling this function. 3704 // before calling this function.
3669 void MacroAssembler::CopyBytes(Register destination, 3705 void MacroAssembler::CopyBytes(Register destination,
3670 Register source, 3706 Register source,
3671 Register length, 3707 Register length,
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
3852 CPU::FlushICache(address_, size_); 3888 CPU::FlushICache(address_, size_);
3853 3889
3854 // Check that the code was patched as expected. 3890 // Check that the code was patched as expected.
3855 ASSERT(masm_.pc_ == address_ + size_); 3891 ASSERT(masm_.pc_ == address_ + size_);
3856 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); 3892 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap);
3857 } 3893 }
3858 3894
3859 } } // namespace v8::internal 3895 } } // namespace v8::internal
3860 3896
3861 #endif // V8_TARGET_ARCH_X64 3897 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/x64/macro-assembler-x64.h ('k') | test/cctest/test-strings.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698