OLD | NEW |
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 3783 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3794 __ j(zero, &runtime); | 3794 __ j(zero, &runtime); |
3795 Condition is_string = masm->IsObjectStringType(rax, rbx, rbx); | 3795 Condition is_string = masm->IsObjectStringType(rax, rbx, rbx); |
3796 __ j(NegateCondition(is_string), &runtime); | 3796 __ j(NegateCondition(is_string), &runtime); |
3797 | 3797 |
3798 // rax: string | 3798 // rax: string |
3799 // rbx: instance type | 3799 // rbx: instance type |
3800 // Calculate length of sub string using the smi values. | 3800 // Calculate length of sub string using the smi values. |
3801 Label result_longer_than_two; | 3801 Label result_longer_than_two; |
3802 __ movq(rcx, Operand(rsp, kToOffset)); | 3802 __ movq(rcx, Operand(rsp, kToOffset)); |
3803 __ movq(rdx, Operand(rsp, kFromOffset)); | 3803 __ movq(rdx, Operand(rsp, kFromOffset)); |
3804 __ JumpIfNotBothPositiveSmi(rcx, rdx, &runtime); | 3804 __ JumpUnlessBothNonNegativeSmi(rcx, rdx, &runtime); |
3805 | 3805 |
3806 __ SmiSub(rcx, rcx, rdx); // Overflow doesn't happen. | 3806 __ SmiSub(rcx, rcx, rdx); // Overflow doesn't happen. |
3807 __ cmpq(FieldOperand(rax, String::kLengthOffset), rcx); | 3807 __ cmpq(FieldOperand(rax, String::kLengthOffset), rcx); |
3808 Label return_rax; | 3808 Label return_rax; |
3809 __ j(equal, &return_rax); | 3809 __ j(equal, &return_rax); |
3810 // Special handling of sub-strings of length 1 and 2. One character strings | 3810 // Special handling of sub-strings of length 1 and 2. One character strings |
3811 // are handled in the runtime system (looked up in the single character | 3811 // are handled in the runtime system (looked up in the single character |
3812 // cache). Two character strings are looked for in the symbol cache. | 3812 // cache). Two character strings are looked for in the symbol cache. |
3813 __ SmiToInteger32(rcx, rcx); | 3813 __ SmiToInteger32(rcx, rcx); |
3814 __ cmpl(rcx, Immediate(2)); | 3814 __ cmpl(rcx, Immediate(2)); |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4045 // tagged as a small integer. | 4045 // tagged as a small integer. |
4046 __ bind(&runtime); | 4046 __ bind(&runtime); |
4047 __ TailCallRuntime(Runtime::kStringCompare, 2, 1); | 4047 __ TailCallRuntime(Runtime::kStringCompare, 2, 1); |
4048 } | 4048 } |
4049 | 4049 |
4050 #undef __ | 4050 #undef __ |
4051 | 4051 |
4052 } } // namespace v8::internal | 4052 } } // namespace v8::internal |
4053 | 4053 |
4054 #endif // V8_TARGET_ARCH_X64 | 4054 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |