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

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

Issue 442024: Perform string add in generated code on IA-32 platforms... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 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 2006-2009 the V8 project authors. All rights reserved. 1 // Copyright 2006-2009 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 802 matching lines...) Expand 10 before | Expand all | Expand 10 after
813 scratch2, 813 scratch2,
814 gc_required, 814 gc_required,
815 TAG_OBJECT); 815 TAG_OBJECT);
816 816
817 // Set the map. 817 // Set the map.
818 mov(FieldOperand(result, HeapObject::kMapOffset), 818 mov(FieldOperand(result, HeapObject::kMapOffset),
819 Immediate(Factory::heap_number_map())); 819 Immediate(Factory::heap_number_map()));
820 } 820 }
821 821
822 822
823 void MacroAssembler::AllocateTwoByteString(Register result,
824 Register length,
825 Register scratch1,
826 Register scratch2,
827 Register scratch3,
828 Label* gc_required) {
829 // Calculate the number of words needed for the number of characters in the
830 // string
831 mov(scratch1, length);
832 add(Operand(scratch1), Immediate(1));
833 shr(scratch1, 1);
834
835 // Allocate two byte string in new space.
836 AllocateInNewSpace(SeqTwoByteString::kHeaderSize,
837 times_4,
838 scratch1,
839 result,
840 scratch2,
841 scratch3,
842 gc_required,
843 TAG_OBJECT);
844
845 // Set the map, length and hash field.
846 mov(FieldOperand(result, HeapObject::kMapOffset),
847 Immediate(Factory::string_map()));
848 mov(FieldOperand(result, String::kLengthOffset), length);
849 mov(FieldOperand(result, String::kHashFieldOffset),
850 Immediate(String::kEmptyHashField));
851 }
852
853
854 void MacroAssembler::AllocateAsciiString(Register result,
855 Register length,
856 Register scratch1,
857 Register scratch2,
858 Register scratch3,
859 Label* gc_required) {
860 // Calculate the number of words needed for the number of characters in the
861 // string
862 mov(scratch1, length);
863 add(Operand(scratch1), Immediate(3));
864 shr(scratch1, 2);
865
866 // Allocate ascii string in new space.
867 AllocateInNewSpace(SeqAsciiString::kHeaderSize,
868 times_4,
869 scratch1,
870 result,
871 scratch2,
872 scratch3,
873 gc_required,
874 TAG_OBJECT);
875
876 // Set the map, length and hash field.
877 mov(FieldOperand(result, HeapObject::kMapOffset),
878 Immediate(Factory::ascii_string_map()));
879 mov(FieldOperand(result, String::kLengthOffset), length);
880 mov(FieldOperand(result, String::kHashFieldOffset),
881 Immediate(String::kEmptyHashField));
882 }
883
884
885 void MacroAssembler::AllocateConsString(Register result,
886 Register scratch1,
887 Register scratch2,
888 Label* gc_required) {
889 // Allocate heap number in new space.
890 AllocateInNewSpace(ConsString::kSize,
891 result,
892 scratch1,
893 scratch2,
894 gc_required,
895 TAG_OBJECT);
896
897 // Set the map. The other fields are left uninitialized.
898 mov(FieldOperand(result, HeapObject::kMapOffset),
899 Immediate(Factory::cons_string_map()));
900 }
901
902
903 void MacroAssembler::AllocateAsciiConsString(Register result,
904 Register scratch1,
905 Register scratch2,
906 Label* gc_required) {
907 // Allocate heap number in new space.
908 AllocateInNewSpace(ConsString::kSize,
909 result,
910 scratch1,
911 scratch2,
912 gc_required,
913 TAG_OBJECT);
914
915 // Set the map. The other fields are left uninitialized.
916 mov(FieldOperand(result, HeapObject::kMapOffset),
917 Immediate(Factory::cons_ascii_string_map()));
918 }
919
920
823 void MacroAssembler::NegativeZeroTest(CodeGenerator* cgen, 921 void MacroAssembler::NegativeZeroTest(CodeGenerator* cgen,
824 Register result, 922 Register result,
825 Register op, 923 Register op,
826 JumpTarget* then_target) { 924 JumpTarget* then_target) {
827 JumpTarget ok; 925 JumpTarget ok;
828 test(result, Operand(result)); 926 test(result, Operand(result));
829 ok.Branch(not_zero, taken); 927 ok.Branch(not_zero, taken);
830 test(op, Operand(op)); 928 test(op, Operand(op));
831 then_target->Branch(sign, not_taken); 929 then_target->Branch(sign, not_taken);
832 ok.Bind(); 930 ok.Bind();
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
906 bind(&done); 1004 bind(&done);
907 } 1005 }
908 1006
909 1007
910 void MacroAssembler::CallStub(CodeStub* stub) { 1008 void MacroAssembler::CallStub(CodeStub* stub) {
911 ASSERT(allow_stub_calls()); // calls are not allowed in some stubs 1009 ASSERT(allow_stub_calls()); // calls are not allowed in some stubs
912 call(stub->GetCode(), RelocInfo::CODE_TARGET); 1010 call(stub->GetCode(), RelocInfo::CODE_TARGET);
913 } 1011 }
914 1012
915 1013
1014 void MacroAssembler::TailCallStub(CodeStub* stub) {
1015 ASSERT(allow_stub_calls()); // calls are not allowed in some stubs
1016 jmp(stub->GetCode(), RelocInfo::CODE_TARGET);
1017 }
1018
1019
916 void MacroAssembler::StubReturn(int argc) { 1020 void MacroAssembler::StubReturn(int argc) {
917 ASSERT(argc >= 1 && generating_stub()); 1021 ASSERT(argc >= 1 && generating_stub());
918 ret((argc - 1) * kPointerSize); 1022 ret((argc - 1) * kPointerSize);
919 } 1023 }
920 1024
921 1025
922 void MacroAssembler::IllegalOperation(int num_arguments) { 1026 void MacroAssembler::IllegalOperation(int num_arguments) {
923 if (num_arguments > 0) { 1027 if (num_arguments > 0) {
924 add(Operand(esp), Immediate(num_arguments * kPointerSize)); 1028 add(Operand(esp), Immediate(num_arguments * kPointerSize));
925 } 1029 }
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after
1300 // Indicate that code has changed. 1404 // Indicate that code has changed.
1301 CPU::FlushICache(address_, size_); 1405 CPU::FlushICache(address_, size_);
1302 1406
1303 // Check that the code was patched as expected. 1407 // Check that the code was patched as expected.
1304 ASSERT(masm_.pc_ == address_ + size_); 1408 ASSERT(masm_.pc_ == address_ + size_);
1305 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); 1409 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap);
1306 } 1410 }
1307 1411
1308 1412
1309 } } // namespace v8::internal 1413 } } // namespace v8::internal
OLDNEW
« src/ia32/codegen-ia32.cc ('K') | « src/ia32/macro-assembler-ia32.h ('k') | src/runtime.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698