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/x64/code-stubs-x64.cc

Issue 6588113: X64: Implement StringCharAtStub which is used from lithium codegen.... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 9 years, 9 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 | « no previous file | src/x64/lithium-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 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 4815 matching lines...) Expand 10 before | Expand all | Expand 10 after
4826 __ addq(rsp, Immediate(2 * kPointerSize)); 4826 __ addq(rsp, Immediate(2 * kPointerSize));
4827 __ push(rcx); 4827 __ push(rcx);
4828 GenerateCompareFlatAsciiStrings(masm, rdx, rax, rcx, rbx, rdi, r8); 4828 GenerateCompareFlatAsciiStrings(masm, rdx, rax, rcx, rbx, rdi, r8);
4829 4829
4830 // Call the runtime; it returns -1 (less), 0 (equal), or 1 (greater) 4830 // Call the runtime; it returns -1 (less), 0 (equal), or 1 (greater)
4831 // tagged as a small integer. 4831 // tagged as a small integer.
4832 __ bind(&runtime); 4832 __ bind(&runtime);
4833 __ TailCallRuntime(Runtime::kStringCompare, 2, 1); 4833 __ TailCallRuntime(Runtime::kStringCompare, 2, 1);
4834 } 4834 }
4835 4835
4836
4837 void StringCharAtStub::Generate(MacroAssembler* masm) {
4838 // Expects two arguments (object, index) on the stack:
4839
4840 // Stack frame on entry.
4841 // rsp[0]: return address
4842 // rsp[8]: index
4843 // rsp[16]: object
4844
4845 Register object = rbx;
4846 Register index = rax;
4847 Register scratch1 = rcx;
4848 Register scratch2 = rdx;
4849 Register result = rax;
4850
4851 __ pop(scratch1); // Return address.
4852 __ pop(index);
4853 __ pop(object);
4854 __ push(scratch1);
4855
4856 Label need_conversion;
4857 Label index_out_of_range;
4858 Label done;
4859 StringCharAtGenerator generator(object,
4860 index,
4861 scratch1,
4862 scratch2,
4863 result,
4864 &need_conversion,
4865 &need_conversion,
4866 &index_out_of_range,
4867 STRING_INDEX_IS_NUMBER);
4868 generator.GenerateFast(masm);
4869 __ jmp(&done);
4870
4871 __ bind(&index_out_of_range);
4872 // When the index is out of range, the spec requires us to return
4873 // the empty string.
4874 __ Move(result, Factory::empty_string());
4875 __ jmp(&done);
4876
4877 __ bind(&need_conversion);
4878 // Move smi zero into the result register, which will trigger
4879 // conversion.
4880 __ Move(result, Smi::FromInt(0));
4881 __ jmp(&done);
4882
4883 StubRuntimeCallHelper call_helper;
4884 generator.GenerateSlow(masm, call_helper);
4885
4886 __ bind(&done);
4887 __ ret(0);
4888 }
4889
4890
4836 void ICCompareStub::GenerateSmis(MacroAssembler* masm) { 4891 void ICCompareStub::GenerateSmis(MacroAssembler* masm) {
4837 ASSERT(state_ == CompareIC::SMIS); 4892 ASSERT(state_ == CompareIC::SMIS);
4838 NearLabel miss; 4893 NearLabel miss;
4839 __ JumpIfNotBothSmi(rdx, rax, &miss); 4894 __ JumpIfNotBothSmi(rdx, rax, &miss);
4840 4895
4841 if (GetCondition() == equal) { 4896 if (GetCondition() == equal) {
4842 // For equality we do not care about the sign of the result. 4897 // For equality we do not care about the sign of the result.
4843 __ subq(rax, rdx); 4898 __ subq(rax, rdx);
4844 } else { 4899 } else {
4845 NearLabel done; 4900 NearLabel done;
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
5086 FieldOperand(elements, PixelArray::kExternalPointerOffset)); 5141 FieldOperand(elements, PixelArray::kExternalPointerOffset));
5087 __ movb(Operand(external_pointer, untagged_key, times_1, 0), untagged_value); 5142 __ movb(Operand(external_pointer, untagged_key, times_1, 0), untagged_value);
5088 __ ret(0); // Return value in eax. 5143 __ ret(0); // Return value in eax.
5089 } 5144 }
5090 5145
5091 #undef __ 5146 #undef __
5092 5147
5093 } } // namespace v8::internal 5148 } } // namespace v8::internal
5094 5149
5095 #endif // V8_TARGET_ARCH_X64 5150 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « no previous file | src/x64/lithium-codegen-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698