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_ARM64 | 7 #if V8_TARGET_ARCH_ARM64 |
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 3869 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3880 STRING_INDEX_IS_NUMBER, RECEIVER_IS_STRING); | 3880 STRING_INDEX_IS_NUMBER, RECEIVER_IS_STRING); |
3881 generator.GenerateFast(masm); | 3881 generator.GenerateFast(masm); |
3882 __ Drop(3); | 3882 __ Drop(3); |
3883 __ Ret(); | 3883 __ Ret(); |
3884 generator.SkipSlow(masm, &runtime); | 3884 generator.SkipSlow(masm, &runtime); |
3885 } | 3885 } |
3886 | 3886 |
3887 | 3887 |
3888 void ToNumberStub::Generate(MacroAssembler* masm) { | 3888 void ToNumberStub::Generate(MacroAssembler* masm) { |
3889 // The ToNumber stub takes one argument in x0. | 3889 // The ToNumber stub takes one argument in x0. |
3890 Label check_heap_number, call_builtin; | 3890 Label not_smi; |
3891 __ JumpIfNotSmi(x0, &check_heap_number); | 3891 __ JumpIfNotSmi(x0, ¬_smi); |
3892 __ Ret(); | 3892 __ Ret(); |
| 3893 __ Bind(¬_smi); |
3893 | 3894 |
3894 __ bind(&check_heap_number); | 3895 Label not_heap_number; |
3895 __ JumpIfNotHeapNumber(x0, &call_builtin); | 3896 __ Ldr(x1, FieldMemOperand(x0, HeapObject::kMapOffset)); |
| 3897 __ Ldrb(x1, FieldMemOperand(x1, Map::kInstanceTypeOffset)); |
| 3898 // x0: object |
| 3899 // x1: instance type |
| 3900 __ Cmp(x1, HEAP_NUMBER_TYPE); |
| 3901 __ B(ne, ¬_heap_number); |
3896 __ Ret(); | 3902 __ Ret(); |
| 3903 __ Bind(¬_heap_number); |
3897 | 3904 |
3898 __ bind(&call_builtin); | 3905 Label not_string, slow_string; |
3899 __ push(x0); | 3906 __ Cmp(x1, FIRST_NONSTRING_TYPE); |
| 3907 __ B(hs, ¬_string); |
| 3908 // Check if string has a cached array index. |
| 3909 __ Ldr(x2, FieldMemOperand(x0, String::kHashFieldOffset)); |
| 3910 __ Tst(x2, Operand(String::kContainsCachedArrayIndexMask)); |
| 3911 __ B(ne, &slow_string); |
| 3912 __ IndexFromHash(x2, x0); |
| 3913 __ Ret(); |
| 3914 __ Bind(&slow_string); |
| 3915 __ Push(x0); // Push argument. |
| 3916 __ TailCallRuntime(Runtime::kStringToNumber, 1, 1); |
| 3917 __ Bind(¬_string); |
| 3918 |
| 3919 Label not_oddball; |
| 3920 __ Cmp(x1, ODDBALL_TYPE); |
| 3921 __ B(ne, ¬_oddball); |
| 3922 __ Ldr(x0, FieldMemOperand(x0, Oddball::kToNumberOffset)); |
| 3923 __ Ret(); |
| 3924 __ Bind(¬_oddball); |
| 3925 |
| 3926 __ Push(x0); // Push argument. |
3900 __ InvokeBuiltin(Builtins::TO_NUMBER, JUMP_FUNCTION); | 3927 __ InvokeBuiltin(Builtins::TO_NUMBER, JUMP_FUNCTION); |
3901 } | 3928 } |
3902 | 3929 |
3903 | 3930 |
3904 void StringHelper::GenerateFlatOneByteStringEquals( | 3931 void StringHelper::GenerateFlatOneByteStringEquals( |
3905 MacroAssembler* masm, Register left, Register right, Register scratch1, | 3932 MacroAssembler* masm, Register left, Register right, Register scratch1, |
3906 Register scratch2, Register scratch3) { | 3933 Register scratch2, Register scratch3) { |
3907 DCHECK(!AreAliased(left, right, scratch1, scratch2, scratch3)); | 3934 DCHECK(!AreAliased(left, right, scratch1, scratch2, scratch3)); |
3908 Register result = x0; | 3935 Register result = x0; |
3909 Register left_length = scratch1; | 3936 Register left_length = scratch1; |
(...skipping 1251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5161 MemOperand(fp, 6 * kPointerSize), | 5188 MemOperand(fp, 6 * kPointerSize), |
5162 NULL); | 5189 NULL); |
5163 } | 5190 } |
5164 | 5191 |
5165 | 5192 |
5166 #undef __ | 5193 #undef __ |
5167 | 5194 |
5168 } } // namespace v8::internal | 5195 } } // namespace v8::internal |
5169 | 5196 |
5170 #endif // V8_TARGET_ARCH_ARM64 | 5197 #endif // V8_TARGET_ARCH_ARM64 |
OLD | NEW |