OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #if V8_TARGET_ARCH_X64 | 7 #if V8_TARGET_ARCH_X64 |
8 | 8 |
9 #include "src/bootstrapper.h" | 9 #include "src/bootstrapper.h" |
10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
(...skipping 3217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3228 // rcx: result length | 3228 // rcx: result length |
3229 // rdi: first character of result | 3229 // rdi: first character of result |
3230 // r14: character of sub string start | 3230 // r14: character of sub string start |
3231 StringHelper::GenerateCopyCharacters( | 3231 StringHelper::GenerateCopyCharacters( |
3232 masm, rdi, r14, rcx, String::TWO_BYTE_ENCODING); | 3232 masm, rdi, r14, rcx, String::TWO_BYTE_ENCODING); |
3233 __ IncrementCounter(counters->sub_string_native(), 1); | 3233 __ IncrementCounter(counters->sub_string_native(), 1); |
3234 __ ret(SUB_STRING_ARGUMENT_COUNT * kPointerSize); | 3234 __ ret(SUB_STRING_ARGUMENT_COUNT * kPointerSize); |
3235 | 3235 |
3236 // Just jump to runtime to create the sub string. | 3236 // Just jump to runtime to create the sub string. |
3237 __ bind(&runtime); | 3237 __ bind(&runtime); |
3238 __ TailCallRuntime(Runtime::kSubString, 3, 1); | 3238 __ TailCallRuntime(Runtime::kSubStringRT, 3, 1); |
3239 | 3239 |
3240 __ bind(&single_char); | 3240 __ bind(&single_char); |
3241 // rax: string | 3241 // rax: string |
3242 // rbx: instance type | 3242 // rbx: instance type |
3243 // rcx: sub string length (smi) | 3243 // rcx: sub string length (smi) |
3244 // rdx: from index (smi) | 3244 // rdx: from index (smi) |
3245 StringCharAtGenerator generator(rax, rdx, rcx, rax, &runtime, &runtime, | 3245 StringCharAtGenerator generator(rax, rdx, rcx, rax, &runtime, &runtime, |
3246 &runtime, STRING_INDEX_IS_NUMBER, | 3246 &runtime, STRING_INDEX_IS_NUMBER, |
3247 RECEIVER_IS_STRING); | 3247 RECEIVER_IS_STRING); |
3248 generator.GenerateFast(masm); | 3248 generator.GenerateFast(masm); |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3465 // Drop arguments from the stack | 3465 // Drop arguments from the stack |
3466 __ PopReturnAddressTo(rcx); | 3466 __ PopReturnAddressTo(rcx); |
3467 __ addp(rsp, Immediate(2 * kPointerSize)); | 3467 __ addp(rsp, Immediate(2 * kPointerSize)); |
3468 __ PushReturnAddressFrom(rcx); | 3468 __ PushReturnAddressFrom(rcx); |
3469 StringHelper::GenerateCompareFlatOneByteStrings(masm, rdx, rax, rcx, rbx, rdi, | 3469 StringHelper::GenerateCompareFlatOneByteStrings(masm, rdx, rax, rcx, rbx, rdi, |
3470 r8); | 3470 r8); |
3471 | 3471 |
3472 // Call the runtime; it returns -1 (less), 0 (equal), or 1 (greater) | 3472 // Call the runtime; it returns -1 (less), 0 (equal), or 1 (greater) |
3473 // tagged as a small integer. | 3473 // tagged as a small integer. |
3474 __ bind(&runtime); | 3474 __ bind(&runtime); |
3475 __ TailCallRuntime(Runtime::kStringCompare, 2, 1); | 3475 __ TailCallRuntime(Runtime::kStringCompareRT, 2, 1); |
3476 } | 3476 } |
3477 | 3477 |
3478 | 3478 |
3479 void BinaryOpICWithAllocationSiteStub::Generate(MacroAssembler* masm) { | 3479 void BinaryOpICWithAllocationSiteStub::Generate(MacroAssembler* masm) { |
3480 // ----------- S t a t e ------------- | 3480 // ----------- S t a t e ------------- |
3481 // -- rdx : left | 3481 // -- rdx : left |
3482 // -- rax : right | 3482 // -- rax : right |
3483 // -- rsp[0] : return address | 3483 // -- rsp[0] : return address |
3484 // ----------------------------------- | 3484 // ----------------------------------- |
3485 | 3485 |
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3763 | 3763 |
3764 // Handle more complex cases in runtime. | 3764 // Handle more complex cases in runtime. |
3765 __ bind(&runtime); | 3765 __ bind(&runtime); |
3766 __ PopReturnAddressTo(tmp1); | 3766 __ PopReturnAddressTo(tmp1); |
3767 __ Push(left); | 3767 __ Push(left); |
3768 __ Push(right); | 3768 __ Push(right); |
3769 __ PushReturnAddressFrom(tmp1); | 3769 __ PushReturnAddressFrom(tmp1); |
3770 if (equality) { | 3770 if (equality) { |
3771 __ TailCallRuntime(Runtime::kStringEquals, 2, 1); | 3771 __ TailCallRuntime(Runtime::kStringEquals, 2, 1); |
3772 } else { | 3772 } else { |
3773 __ TailCallRuntime(Runtime::kStringCompare, 2, 1); | 3773 __ TailCallRuntime(Runtime::kStringCompareRT, 2, 1); |
3774 } | 3774 } |
3775 | 3775 |
3776 __ bind(&miss); | 3776 __ bind(&miss); |
3777 GenerateMiss(masm); | 3777 GenerateMiss(masm); |
3778 } | 3778 } |
3779 | 3779 |
3780 | 3780 |
3781 void CompareICStub::GenerateObjects(MacroAssembler* masm) { | 3781 void CompareICStub::GenerateObjects(MacroAssembler* masm) { |
3782 DCHECK(state() == CompareICState::OBJECT); | 3782 DCHECK(state() == CompareICState::OBJECT); |
3783 Label miss; | 3783 Label miss; |
(...skipping 1361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5145 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, getter_arg, | 5145 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, getter_arg, |
5146 kStackSpace, nullptr, return_value_operand, NULL); | 5146 kStackSpace, nullptr, return_value_operand, NULL); |
5147 } | 5147 } |
5148 | 5148 |
5149 | 5149 |
5150 #undef __ | 5150 #undef __ |
5151 | 5151 |
5152 } } // namespace v8::internal | 5152 } } // namespace v8::internal |
5153 | 5153 |
5154 #endif // V8_TARGET_ARCH_X64 | 5154 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |