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 #if V8_TARGET_ARCH_ARM64 | 5 #if V8_TARGET_ARCH_ARM64 |
6 | 6 |
7 #include "src/code-stubs.h" | 7 #include "src/code-stubs.h" |
8 #include "src/api-arguments.h" | 8 #include "src/api-arguments.h" |
9 #include "src/bootstrapper.h" | 9 #include "src/bootstrapper.h" |
10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
(...skipping 2906 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2917 __ SmiTag(from); | 2917 __ SmiTag(from); |
2918 StringCharAtGenerator generator(input_string, from, result_length, x0, | 2918 StringCharAtGenerator generator(input_string, from, result_length, x0, |
2919 &runtime, &runtime, &runtime, | 2919 &runtime, &runtime, &runtime, |
2920 RECEIVER_IS_STRING); | 2920 RECEIVER_IS_STRING); |
2921 generator.GenerateFast(masm); | 2921 generator.GenerateFast(masm); |
2922 __ Drop(3); | 2922 __ Drop(3); |
2923 __ Ret(); | 2923 __ Ret(); |
2924 generator.SkipSlow(masm, &runtime); | 2924 generator.SkipSlow(masm, &runtime); |
2925 } | 2925 } |
2926 | 2926 |
2927 void ToStringStub::Generate(MacroAssembler* masm) { | |
2928 // The ToString stub takes one argument in x0. | |
2929 Label is_number; | |
2930 __ JumpIfSmi(x0, &is_number); | |
2931 | |
2932 Label not_string; | |
2933 __ JumpIfObjectType(x0, x1, x1, FIRST_NONSTRING_TYPE, ¬_string, hs); | |
2934 // x0: receiver | |
2935 // x1: receiver instance type | |
2936 __ Ret(); | |
2937 __ Bind(¬_string); | |
2938 | |
2939 Label not_heap_number; | |
2940 __ Cmp(x1, HEAP_NUMBER_TYPE); | |
2941 __ B(ne, ¬_heap_number); | |
2942 __ Bind(&is_number); | |
2943 NumberToStringStub stub(isolate()); | |
2944 __ TailCallStub(&stub); | |
2945 __ Bind(¬_heap_number); | |
2946 | |
2947 Label not_oddball; | |
2948 __ Cmp(x1, ODDBALL_TYPE); | |
2949 __ B(ne, ¬_oddball); | |
2950 __ Ldr(x0, FieldMemOperand(x0, Oddball::kToStringOffset)); | |
2951 __ Ret(); | |
2952 __ Bind(¬_oddball); | |
2953 | |
2954 __ Push(x0); // Push argument. | |
2955 __ TailCallRuntime(Runtime::kToString); | |
2956 } | |
2957 | |
2958 | 2927 |
2959 void StringHelper::GenerateFlatOneByteStringEquals( | 2928 void StringHelper::GenerateFlatOneByteStringEquals( |
2960 MacroAssembler* masm, Register left, Register right, Register scratch1, | 2929 MacroAssembler* masm, Register left, Register right, Register scratch1, |
2961 Register scratch2, Register scratch3) { | 2930 Register scratch2, Register scratch3) { |
2962 DCHECK(!AreAliased(left, right, scratch1, scratch2, scratch3)); | 2931 DCHECK(!AreAliased(left, right, scratch1, scratch2, scratch3)); |
2963 Register result = x0; | 2932 Register result = x0; |
2964 Register left_length = scratch1; | 2933 Register left_length = scratch1; |
2965 Register right_length = scratch2; | 2934 Register right_length = scratch2; |
2966 | 2935 |
2967 // Compare lengths. If lengths differ, strings can't be equal. Lengths are | 2936 // Compare lengths. If lengths differ, strings can't be equal. Lengths are |
(...skipping 2567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5535 kStackUnwindSpace, NULL, spill_offset, | 5504 kStackUnwindSpace, NULL, spill_offset, |
5536 return_value_operand, NULL); | 5505 return_value_operand, NULL); |
5537 } | 5506 } |
5538 | 5507 |
5539 #undef __ | 5508 #undef __ |
5540 | 5509 |
5541 } // namespace internal | 5510 } // namespace internal |
5542 } // namespace v8 | 5511 } // namespace v8 |
5543 | 5512 |
5544 #endif // V8_TARGET_ARCH_ARM64 | 5513 #endif // V8_TARGET_ARCH_ARM64 |
OLD | NEW |