OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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 #if V8_TARGET_ARCH_PPC | 5 #if V8_TARGET_ARCH_PPC |
6 | 6 |
7 #include "src/base/bits.h" | 7 #include "src/base/bits.h" |
8 #include "src/bootstrapper.h" | 8 #include "src/bootstrapper.h" |
9 #include "src/code-stubs.h" | 9 #include "src/code-stubs.h" |
10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
(...skipping 2925 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2936 __ lbzx(scratch1, MemOperand(left, index)); | 2936 __ lbzx(scratch1, MemOperand(left, index)); |
2937 __ lbzx(r0, MemOperand(right, index)); | 2937 __ lbzx(r0, MemOperand(right, index)); |
2938 __ cmp(scratch1, r0); | 2938 __ cmp(scratch1, r0); |
2939 __ bne(chars_not_equal); | 2939 __ bne(chars_not_equal); |
2940 __ addi(index, index, Operand(1)); | 2940 __ addi(index, index, Operand(1)); |
2941 __ cmpi(index, Operand::Zero()); | 2941 __ cmpi(index, Operand::Zero()); |
2942 __ bne(&loop); | 2942 __ bne(&loop); |
2943 } | 2943 } |
2944 | 2944 |
2945 | 2945 |
2946 void StringCompareStub::Generate(MacroAssembler* masm) { | |
2947 // ----------- S t a t e ------------- | |
2948 // -- r4 : left | |
2949 // -- r3 : right | |
2950 // -- lr : return address | |
2951 // ----------------------------------- | |
2952 __ AssertString(r4); | |
2953 __ AssertString(r3); | |
2954 | |
2955 Label not_same; | |
2956 __ cmp(r3, r4); | |
2957 __ bne(¬_same); | |
2958 __ LoadSmiLiteral(r3, Smi::FromInt(EQUAL)); | |
2959 __ IncrementCounter(isolate()->counters()->string_compare_native(), 1, r4, | |
2960 r5); | |
2961 __ Ret(); | |
2962 | |
2963 __ bind(¬_same); | |
2964 | |
2965 // Check that both objects are sequential one-byte strings. | |
2966 Label runtime; | |
2967 __ JumpIfNotBothSequentialOneByteStrings(r4, r3, r5, r6, &runtime); | |
2968 | |
2969 // Compare flat one-byte strings natively. | |
2970 __ IncrementCounter(isolate()->counters()->string_compare_native(), 1, r5, | |
2971 r6); | |
2972 StringHelper::GenerateCompareFlatOneByteStrings(masm, r4, r3, r5, r6, r7); | |
2973 | |
2974 // Call the runtime; it returns -1 (less), 0 (equal), or 1 (greater) | |
2975 // tagged as a small integer. | |
2976 __ bind(&runtime); | |
2977 __ Push(r4, r3); | |
2978 __ TailCallRuntime(Runtime::kStringCompare); | |
2979 } | |
2980 | |
2981 | |
2982 void BinaryOpICWithAllocationSiteStub::Generate(MacroAssembler* masm) { | 2946 void BinaryOpICWithAllocationSiteStub::Generate(MacroAssembler* masm) { |
2983 // ----------- S t a t e ------------- | 2947 // ----------- S t a t e ------------- |
2984 // -- r4 : left | 2948 // -- r4 : left |
2985 // -- r3 : right | 2949 // -- r3 : right |
2986 // -- lr : return address | 2950 // -- lr : return address |
2987 // ----------------------------------- | 2951 // ----------------------------------- |
2988 | 2952 |
2989 // Load r5 with the allocation site. We stick an undefined dummy value here | 2953 // Load r5 with the allocation site. We stick an undefined dummy value here |
2990 // and replace it with the real allocation site later when we instantiate this | 2954 // and replace it with the real allocation site later when we instantiate this |
2991 // stub in BinaryOpICWithAllocationSiteStub::GetCodeCopyFromTemplate(). | 2955 // stub in BinaryOpICWithAllocationSiteStub::GetCodeCopyFromTemplate(). |
(...skipping 2878 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5870 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, | 5834 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, |
5871 kStackUnwindSpace, NULL, return_value_operand, NULL); | 5835 kStackUnwindSpace, NULL, return_value_operand, NULL); |
5872 } | 5836 } |
5873 | 5837 |
5874 | 5838 |
5875 #undef __ | 5839 #undef __ |
5876 } // namespace internal | 5840 } // namespace internal |
5877 } // namespace v8 | 5841 } // namespace v8 |
5878 | 5842 |
5879 #endif // V8_TARGET_ARCH_PPC | 5843 #endif // V8_TARGET_ARCH_PPC |
OLD | NEW |