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

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

Issue 2800027: Add special case of taking a substring that is the entire string to stub. (Closed)
Patch Set: Created 10 years, 6 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
« no previous file with comments | « src/ia32/codegen-ia32.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 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 11556 matching lines...) Expand 10 before | Expand all | Expand 10 after
11567 11567
11568 // rax: string 11568 // rax: string
11569 // rbx: instance type 11569 // rbx: instance type
11570 // Calculate length of sub string using the smi values. 11570 // Calculate length of sub string using the smi values.
11571 Label result_longer_than_two; 11571 Label result_longer_than_two;
11572 __ movq(rcx, Operand(rsp, kToOffset)); 11572 __ movq(rcx, Operand(rsp, kToOffset));
11573 __ movq(rdx, Operand(rsp, kFromOffset)); 11573 __ movq(rdx, Operand(rsp, kFromOffset));
11574 __ JumpIfNotBothPositiveSmi(rcx, rdx, &runtime); 11574 __ JumpIfNotBothPositiveSmi(rcx, rdx, &runtime);
11575 11575
11576 __ SmiSub(rcx, rcx, rdx, NULL); // Overflow doesn't happen. 11576 __ SmiSub(rcx, rcx, rdx, NULL); // Overflow doesn't happen.
11577 __ j(negative, &runtime); 11577 __ cmpq(FieldOperand(rax, String::kLengthOffset), rcx);
11578 Label return_rax;
11579 __ j(equal, &return_rax);
11578 // Special handling of sub-strings of length 1 and 2. One character strings 11580 // Special handling of sub-strings of length 1 and 2. One character strings
11579 // are handled in the runtime system (looked up in the single character 11581 // are handled in the runtime system (looked up in the single character
11580 // cache). Two character strings are looked for in the symbol cache. 11582 // cache). Two character strings are looked for in the symbol cache.
11581 __ SmiToInteger32(rcx, rcx); 11583 __ SmiToInteger32(rcx, rcx);
11582 __ cmpl(rcx, Immediate(2)); 11584 __ cmpl(rcx, Immediate(2));
11583 __ j(greater, &result_longer_than_two); 11585 __ j(greater, &result_longer_than_two);
11584 __ j(less, &runtime); 11586 __ j(less, &runtime);
11585 11587
11586 // Sub string of length 2 requested. 11588 // Sub string of length 2 requested.
11587 // rax: string 11589 // rax: string
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
11670 SeqAsciiString::kHeaderSize - kHeapObjectTag)); 11672 SeqAsciiString::kHeaderSize - kHeapObjectTag));
11671 } 11673 }
11672 11674
11673 // rax: result string 11675 // rax: result string
11674 // rcx: result length 11676 // rcx: result length
11675 // rdx: original value of rsi 11677 // rdx: original value of rsi
11676 // rdi: first character of result 11678 // rdi: first character of result
11677 // rsi: character of sub string start 11679 // rsi: character of sub string start
11678 StringHelper::GenerateCopyCharactersREP(masm, rdi, rsi, rcx, false); 11680 StringHelper::GenerateCopyCharactersREP(masm, rdi, rsi, rcx, false);
11679 __ movq(rsi, rdx); // Restore esi. 11681 __ movq(rsi, rdx); // Restore esi.
11682
11683 __ bind(&return_rax);
11680 __ IncrementCounter(&Counters::sub_string_native, 1); 11684 __ IncrementCounter(&Counters::sub_string_native, 1);
11681 __ ret(kArgumentsSize); 11685 __ ret(kArgumentsSize);
11682 11686
11683 // Just jump to runtime to create the sub string. 11687 // Just jump to runtime to create the sub string.
11684 __ bind(&runtime); 11688 __ bind(&runtime);
11685 __ TailCallRuntime(Runtime::kSubString, 3, 1); 11689 __ TailCallRuntime(Runtime::kSubString, 3, 1);
11686 } 11690 }
11687 11691
11688 11692
11689 void StringCompareStub::GenerateCompareFlatAsciiStrings(MacroAssembler* masm, 11693 void StringCompareStub::GenerateCompareFlatAsciiStrings(MacroAssembler* masm,
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
11902 } 11906 }
11903 11907
11904 #endif 11908 #endif
11905 11909
11906 11910
11907 #undef __ 11911 #undef __
11908 11912
11909 } } // namespace v8::internal 11913 } } // namespace v8::internal
11910 11914
11911 #endif // V8_TARGET_ARCH_X64 11915 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/ia32/codegen-ia32.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698