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

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

Issue 15743006: Improve SeqStringSetChar implementation. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: small fix Created 7 years, 7 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/ia32/lithium-ia32.cc ('k') | src/x64/full-codegen-x64.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 606 matching lines...) Expand 10 before | Expand all | Expand 10 after
617 // Load the byte into the result register. 617 // Load the byte into the result register.
618 __ bind(&ascii); 618 __ bind(&ascii);
619 __ movzxbl(result, FieldOperand(string, 619 __ movzxbl(result, FieldOperand(string,
620 index, 620 index,
621 times_1, 621 times_1,
622 SeqOneByteString::kHeaderSize)); 622 SeqOneByteString::kHeaderSize));
623 __ bind(&done); 623 __ bind(&done);
624 } 624 }
625 625
626 626
627 void SeqStringSetCharGenerator::Generate(MacroAssembler* masm,
628 String::Encoding encoding,
629 Register string,
630 Register index,
631 Register value) {
632 if (FLAG_debug_code) {
633 __ Check(masm->CheckSmi(index), "Non-smi index");
634 __ Check(masm->CheckSmi(value), "Non-smi value");
635
636 __ SmiCompare(index, FieldOperand(string, String::kLengthOffset));
637 __ Check(less, "Index is too large");
638
639 __ SmiCompare(index, Smi::FromInt(0));
640 __ Check(greater_equal, "Index is negative");
641
642 __ push(value);
643 __ movq(value, FieldOperand(string, HeapObject::kMapOffset));
644 __ movzxbq(value, FieldOperand(value, Map::kInstanceTypeOffset));
645
646 __ andb(value, Immediate(kStringRepresentationMask | kStringEncodingMask));
647 static const uint32_t one_byte_seq_type = kSeqStringTag | kOneByteStringTag;
648 static const uint32_t two_byte_seq_type = kSeqStringTag | kTwoByteStringTag;
649 __ cmpq(value, Immediate(encoding == String::ONE_BYTE_ENCODING
650 ? one_byte_seq_type : two_byte_seq_type));
651 __ Check(equal, "Unexpected string type");
652 __ pop(value);
653 }
654
655 __ SmiToInteger32(value, value);
656 __ SmiToInteger32(index, index);
657 if (encoding == String::ONE_BYTE_ENCODING) {
658 __ movb(FieldOperand(string, index, times_1, SeqString::kHeaderSize),
659 value);
660 } else {
661 __ movw(FieldOperand(string, index, times_2, SeqString::kHeaderSize),
662 value);
663 }
664 }
665
666
667 void MathExpGenerator::EmitMathExp(MacroAssembler* masm, 627 void MathExpGenerator::EmitMathExp(MacroAssembler* masm,
668 XMMRegister input, 628 XMMRegister input,
669 XMMRegister result, 629 XMMRegister result,
670 XMMRegister double_scratch, 630 XMMRegister double_scratch,
671 Register temp1, 631 Register temp1,
672 Register temp2) { 632 Register temp2) {
673 ASSERT(!input.is(result)); 633 ASSERT(!input.is(result));
674 ASSERT(!input.is(double_scratch)); 634 ASSERT(!input.is(double_scratch));
675 ASSERT(!result.is(double_scratch)); 635 ASSERT(!result.is(double_scratch));
676 ASSERT(!temp1.is(temp2)); 636 ASSERT(!temp1.is(temp2));
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
776 CodePatcher patcher(sequence, young_length); 736 CodePatcher patcher(sequence, young_length);
777 patcher.masm()->call(stub->instruction_start()); 737 patcher.masm()->call(stub->instruction_start());
778 patcher.masm()->nop(); 738 patcher.masm()->nop();
779 } 739 }
780 } 740 }
781 741
782 742
783 } } // namespace v8::internal 743 } } // namespace v8::internal
784 744
785 #endif // V8_TARGET_ARCH_X64 745 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/ia32/lithium-ia32.cc ('k') | src/x64/full-codegen-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698