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

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

Issue 11348349: Improve array to string conversion. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 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 | Annotate | Revision Log
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 588 matching lines...) Expand 10 before | Expand all | Expand 10 after
599 // Load the byte into the result register. 599 // Load the byte into the result register.
600 __ bind(&ascii); 600 __ bind(&ascii);
601 __ movzxbl(result, FieldOperand(string, 601 __ movzxbl(result, FieldOperand(string,
602 index, 602 index,
603 times_1, 603 times_1,
604 SeqOneByteString::kHeaderSize)); 604 SeqOneByteString::kHeaderSize));
605 __ bind(&done); 605 __ bind(&done);
606 } 606 }
607 607
608 608
609 void SeqStringSetCharGenerator::Generate(MacroAssembler* masm,
610 bool one_byte_string,
611 Register string,
612 Register index,
613 Register value) {
614 if (FLAG_debug_code) {
615 __ Check(masm->CheckSmi(index), "Non-smi index");
616 __ Check(masm->CheckSmi(value), "Non-smi value");
617
618 __ SmiCompare(index, FieldOperand(string, String::kLengthOffset));
619 __ Check(less, "Index is too large");
620
621 __ SmiCompare(index, Smi::FromInt(0));
622 __ Check(greater_equal, "Index is negative");
623
624 __ push(value);
625 __ movq(value, FieldOperand(string, HeapObject::kMapOffset));
626 __ movzxbq(value, FieldOperand(value, Map::kInstanceTypeOffset));
627
628 __ andb(value, Immediate(kStringRepresentationMask | kStringEncodingMask));
629 static const uint32_t one_byte_seq_type = kSeqStringTag | kOneByteStringTag;
630 static const uint32_t two_byte_seq_type = kSeqStringTag | kTwoByteStringTag;
631 __ cmpq(value, Immediate(one_byte_string ? one_byte_seq_type
632 : two_byte_seq_type));
633 __ Check(equal, "Unexpected string type");
634 __ pop(value);
635 }
636
637 __ SmiToInteger32(value, value);
638 __ SmiToInteger32(index, index);
639 if (one_byte_string) {
640 __ movb(FieldOperand(string, index, times_1, SeqString::kHeaderSize),
641 value);
642 } else {
643 __ movw(FieldOperand(string, index, times_2, SeqString::kHeaderSize),
644 value);
645 }
646 }
647
648
609 void MathExpGenerator::EmitMathExp(MacroAssembler* masm, 649 void MathExpGenerator::EmitMathExp(MacroAssembler* masm,
610 XMMRegister input, 650 XMMRegister input,
611 XMMRegister result, 651 XMMRegister result,
612 XMMRegister double_scratch, 652 XMMRegister double_scratch,
613 Register temp1, 653 Register temp1,
614 Register temp2) { 654 Register temp2) {
615 ASSERT(!input.is(result)); 655 ASSERT(!input.is(result));
616 ASSERT(!input.is(double_scratch)); 656 ASSERT(!input.is(double_scratch));
617 ASSERT(!result.is(double_scratch)); 657 ASSERT(!result.is(double_scratch));
618 ASSERT(!temp1.is(temp2)); 658 ASSERT(!temp1.is(temp2));
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
718 CodePatcher patcher(sequence, young_length); 758 CodePatcher patcher(sequence, young_length);
719 patcher.masm()->call(stub->instruction_start()); 759 patcher.masm()->call(stub->instruction_start());
720 patcher.masm()->nop(); 760 patcher.masm()->nop();
721 } 761 }
722 } 762 }
723 763
724 764
725 } } // namespace v8::internal 765 } } // namespace v8::internal
726 766
727 #endif // V8_TARGET_ARCH_X64 767 #endif // V8_TARGET_ARCH_X64
OLDNEW
« src/string.js ('K') | « src/uri.js ('k') | src/x64/full-codegen-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698