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 // The RBP register should not be modified, because it is used by the profiler. | 25 // The RBP register should not be modified, because it is used by the profiler. |
26 // The PP and THR registers (see constants_x64.h) must be preserved. | 26 // The PP and THR registers (see constants_x64.h) must be preserved. |
27 | 27 |
28 #define __ assembler-> | 28 #define __ assembler-> |
29 | 29 |
30 | 30 |
31 intptr_t Intrinsifier::ParameterSlotFromSp() { return 0; } | 31 intptr_t Intrinsifier::ParameterSlotFromSp() { return 0; } |
32 | 32 |
33 | 33 |
34 void Intrinsifier::ObjectArraySetIndexed(Assembler* assembler) { | 34 void Intrinsifier::ObjectArraySetIndexed(Assembler* assembler) { |
35 if (Isolate::Current()->flags().type_checks()) { | 35 if (Isolate::Current()->type_checks()) { |
36 return; | 36 return; |
37 } | 37 } |
38 | 38 |
39 Label fall_through; | 39 Label fall_through; |
40 __ movq(RDX, Address(RSP, + 1 * kWordSize)); // Value. | 40 __ movq(RDX, Address(RSP, + 1 * kWordSize)); // Value. |
41 __ movq(RCX, Address(RSP, + 2 * kWordSize)); // Index. | 41 __ movq(RCX, Address(RSP, + 2 * kWordSize)); // Index. |
42 __ movq(RAX, Address(RSP, + 3 * kWordSize)); // Array. | 42 __ movq(RAX, Address(RSP, + 3 * kWordSize)); // Array. |
43 __ testq(RCX, Immediate(kSmiTagMask)); | 43 __ testq(RCX, Immediate(kSmiTagMask)); |
44 __ j(NOT_ZERO, &fall_through); | 44 __ j(NOT_ZERO, &fall_through); |
45 // Range check. | 45 // Range check. |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 | 95 |
96 __ Bind(&fall_through); | 96 __ Bind(&fall_through); |
97 } | 97 } |
98 | 98 |
99 | 99 |
100 // Add an element to growable array if it doesn't need to grow, otherwise | 100 // Add an element to growable array if it doesn't need to grow, otherwise |
101 // call into regular code. | 101 // call into regular code. |
102 // On stack: growable array (+2), value (+1), return-address (+0). | 102 // On stack: growable array (+2), value (+1), return-address (+0). |
103 void Intrinsifier::GrowableArray_add(Assembler* assembler) { | 103 void Intrinsifier::GrowableArray_add(Assembler* assembler) { |
104 // In checked mode we need to check the incoming argument. | 104 // In checked mode we need to check the incoming argument. |
105 if (Isolate::Current()->flags().type_checks()) return; | 105 if (Isolate::Current()->type_checks()) return; |
106 Label fall_through; | 106 Label fall_through; |
107 __ movq(RAX, Address(RSP, + 2 * kWordSize)); // Array. | 107 __ movq(RAX, Address(RSP, + 2 * kWordSize)); // Array. |
108 __ movq(RCX, FieldAddress(RAX, GrowableObjectArray::length_offset())); | 108 __ movq(RCX, FieldAddress(RAX, GrowableObjectArray::length_offset())); |
109 // RCX: length. | 109 // RCX: length. |
110 __ movq(RDX, FieldAddress(RAX, GrowableObjectArray::data_offset())); | 110 __ movq(RDX, FieldAddress(RAX, GrowableObjectArray::data_offset())); |
111 // RDX: data. | 111 // RDX: data. |
112 // Compare length with capacity. | 112 // Compare length with capacity. |
113 __ cmpq(RCX, FieldAddress(RDX, Array::length_offset())); | 113 __ cmpq(RCX, FieldAddress(RDX, Array::length_offset())); |
114 __ j(EQUAL, &fall_through); // Must grow data. | 114 __ j(EQUAL, &fall_through); // Must grow data. |
115 // len = len + 1; | 115 // len = len + 1; |
(...skipping 1990 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2106 __ LoadIsolate(RAX); | 2106 __ LoadIsolate(RAX); |
2107 __ movq(RAX, Address(RAX, Isolate::current_tag_offset())); | 2107 __ movq(RAX, Address(RAX, Isolate::current_tag_offset())); |
2108 __ ret(); | 2108 __ ret(); |
2109 } | 2109 } |
2110 | 2110 |
2111 #undef __ | 2111 #undef __ |
2112 | 2112 |
2113 } // namespace dart | 2113 } // namespace dart |
2114 | 2114 |
2115 #endif // defined TARGET_ARCH_X64 | 2115 #endif // defined TARGET_ARCH_X64 |
OLD | NEW |