OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_X64. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_X64. |
6 #if defined(TARGET_ARCH_X64) | 6 #if defined(TARGET_ARCH_X64) |
7 | 7 |
8 #include "vm/intrinsifier.h" | 8 #include "vm/intrinsifier.h" |
9 | 9 |
10 #include "vm/assembler.h" | 10 #include "vm/assembler.h" |
(...skipping 14 matching lines...) Expand all Loading... |
25 // if the intrinsified method always executes a return. | 25 // if the intrinsified method always executes a return. |
26 // The RBP register should not be modified, because it is used by the profiler. | 26 // The RBP register should not be modified, because it is used by the profiler. |
27 // The PP and THR registers (see constants_x64.h) must be preserved. | 27 // The PP and THR registers (see constants_x64.h) must be preserved. |
28 | 28 |
29 #define __ assembler-> | 29 #define __ assembler-> |
30 | 30 |
31 | 31 |
32 intptr_t Intrinsifier::ParameterSlotFromSp() { return 0; } | 32 intptr_t Intrinsifier::ParameterSlotFromSp() { return 0; } |
33 | 33 |
34 | 34 |
| 35 static bool IsABIPreservedRegister(Register reg) { |
| 36 return ((1 << reg) & CallingConventions::kCalleeSaveCpuRegisters) != 0; |
| 37 } |
| 38 |
| 39 |
35 void Intrinsifier::IntrinsicCallPrologue(Assembler* assembler) { | 40 void Intrinsifier::IntrinsicCallPrologue(Assembler* assembler) { |
| 41 ASSERT(IsABIPreservedRegister(CODE_REG)); |
| 42 ASSERT(!IsABIPreservedRegister(ARGS_DESC_REG)); |
| 43 ASSERT(IsABIPreservedRegister(CALLEE_SAVED_TEMP)); |
| 44 ASSERT(CALLEE_SAVED_TEMP != CODE_REG); |
| 45 ASSERT(CALLEE_SAVED_TEMP != ARGS_DESC_REG); |
| 46 |
36 assembler->Comment("IntrinsicCallPrologue"); | 47 assembler->Comment("IntrinsicCallPrologue"); |
37 assembler->movq(CALLEE_SAVED_TEMP, R10); | 48 assembler->movq(CALLEE_SAVED_TEMP, ARGS_DESC_REG); |
38 } | 49 } |
39 | 50 |
40 | 51 |
41 void Intrinsifier::IntrinsicCallEpilogue(Assembler* assembler) { | 52 void Intrinsifier::IntrinsicCallEpilogue(Assembler* assembler) { |
42 assembler->Comment("IntrinsicCallEpilogue"); | 53 assembler->Comment("IntrinsicCallEpilogue"); |
43 assembler->movq(R10, CALLEE_SAVED_TEMP); | 54 assembler->movq(ARGS_DESC_REG, CALLEE_SAVED_TEMP); |
44 } | 55 } |
45 | 56 |
46 | 57 |
47 void Intrinsifier::ObjectArraySetIndexed(Assembler* assembler) { | 58 void Intrinsifier::ObjectArraySetIndexed(Assembler* assembler) { |
48 if (Isolate::Current()->type_checks()) { | 59 if (Isolate::Current()->type_checks()) { |
49 return; | 60 return; |
50 } | 61 } |
51 | 62 |
52 Label fall_through; | 63 Label fall_through; |
53 __ movq(RDX, Address(RSP, + 1 * kWordSize)); // Value. | 64 __ movq(RDX, Address(RSP, + 1 * kWordSize)); // Value. |
(...skipping 2054 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2108 __ Bind(&true_label); | 2119 __ Bind(&true_label); |
2109 __ LoadObject(RAX, Bool::True()); | 2120 __ LoadObject(RAX, Bool::True()); |
2110 __ ret(); | 2121 __ ret(); |
2111 } | 2122 } |
2112 | 2123 |
2113 #undef __ | 2124 #undef __ |
2114 | 2125 |
2115 } // namespace dart | 2126 } // namespace dart |
2116 | 2127 |
2117 #endif // defined TARGET_ARCH_X64 | 2128 #endif // defined TARGET_ARCH_X64 |
OLD | NEW |