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/codegen.h" | 10 #include "src/codegen.h" |
(...skipping 2995 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3006 Cmp(result.X(), 1); | 3006 Cmp(result.X(), 1); |
3007 Ccmp(result.X(), -1, VFlag, vc); | 3007 Ccmp(result.X(), -1, VFlag, vc); |
3008 | 3008 |
3009 B(vc, done); | 3009 B(vc, done); |
3010 } | 3010 } |
3011 | 3011 |
3012 | 3012 |
3013 void MacroAssembler::TruncateDoubleToI(Register result, | 3013 void MacroAssembler::TruncateDoubleToI(Register result, |
3014 DoubleRegister double_input) { | 3014 DoubleRegister double_input) { |
3015 Label done; | 3015 Label done; |
3016 DCHECK(jssp.Is(StackPointer())); | |
3017 | 3016 |
3018 // Try to convert the double to an int64. If successful, the bottom 32 bits | 3017 // Try to convert the double to an int64. If successful, the bottom 32 bits |
3019 // contain our truncated int32 result. | 3018 // contain our truncated int32 result. |
3020 TryConvertDoubleToInt64(result, double_input, &done); | 3019 TryConvertDoubleToInt64(result, double_input, &done); |
3021 | 3020 |
| 3021 const Register old_stack_pointer = StackPointer(); |
| 3022 if (csp.Is(old_stack_pointer)) { |
| 3023 // This currently only happens during compiler-unittest. If it arises |
| 3024 // during regular code generation the DoubleToI stub should be updated to |
| 3025 // cope with csp and have an extra parameter indicating which stack pointer |
| 3026 // it should use. |
| 3027 Push(jssp, xzr); // Push xzr to maintain csp required 16-bytes alignment. |
| 3028 Mov(jssp, csp); |
| 3029 SetStackPointer(jssp); |
| 3030 } |
| 3031 |
3022 // If we fell through then inline version didn't succeed - call stub instead. | 3032 // If we fell through then inline version didn't succeed - call stub instead. |
3023 Push(lr, double_input); | 3033 Push(lr, double_input); |
3024 | 3034 |
3025 DoubleToIStub stub(isolate(), | 3035 DoubleToIStub stub(isolate(), |
3026 jssp, | 3036 jssp, |
3027 result, | 3037 result, |
3028 0, | 3038 0, |
3029 true, // is_truncating | 3039 true, // is_truncating |
3030 true); // skip_fastpath | 3040 true); // skip_fastpath |
3031 CallStub(&stub); // DoubleToIStub preserves any registers it needs to clobber | 3041 CallStub(&stub); // DoubleToIStub preserves any registers it needs to clobber |
3032 | 3042 |
3033 Drop(1, kDoubleSize); // Drop the double input on the stack. | 3043 DCHECK_EQ(xzr.SizeInBytes(), double_input.SizeInBytes()); |
3034 Pop(lr); | 3044 Pop(xzr, lr); // xzr to drop the double input on the stack. |
| 3045 |
| 3046 if (csp.Is(old_stack_pointer)) { |
| 3047 Mov(csp, jssp); |
| 3048 SetStackPointer(csp); |
| 3049 AssertStackConsistency(); |
| 3050 Pop(xzr, jssp); |
| 3051 } |
3035 | 3052 |
3036 Bind(&done); | 3053 Bind(&done); |
3037 } | 3054 } |
3038 | 3055 |
3039 | 3056 |
3040 void MacroAssembler::TruncateHeapNumberToI(Register result, | 3057 void MacroAssembler::TruncateHeapNumberToI(Register result, |
3041 Register object) { | 3058 Register object) { |
3042 Label done; | 3059 Label done; |
3043 DCHECK(!result.is(object)); | 3060 DCHECK(!result.is(object)); |
3044 DCHECK(jssp.Is(StackPointer())); | 3061 DCHECK(jssp.Is(StackPointer())); |
(...skipping 2363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5408 } | 5425 } |
5409 } | 5426 } |
5410 | 5427 |
5411 | 5428 |
5412 #undef __ | 5429 #undef __ |
5413 | 5430 |
5414 | 5431 |
5415 } } // namespace v8::internal | 5432 } } // namespace v8::internal |
5416 | 5433 |
5417 #endif // V8_TARGET_ARCH_ARM64 | 5434 #endif // V8_TARGET_ARCH_ARM64 |
OLD | NEW |