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 | 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()->TypeChecksEnabled()) { | 35 if (Isolate::Current()->flags().type_checks()) { |
36 return; | 36 return; |
37 } | 37 } |
38 __ movq(RDX, Address(RSP, + 1 * kWordSize)); // Value. | 38 __ movq(RDX, Address(RSP, + 1 * kWordSize)); // Value. |
39 __ movq(RCX, Address(RSP, + 2 * kWordSize)); // Index. | 39 __ movq(RCX, Address(RSP, + 2 * kWordSize)); // Index. |
40 __ movq(RAX, Address(RSP, + 3 * kWordSize)); // Array. | 40 __ movq(RAX, Address(RSP, + 3 * kWordSize)); // Array. |
41 Label fall_through; | 41 Label fall_through; |
42 __ testq(RCX, Immediate(kSmiTagMask)); | 42 __ testq(RCX, Immediate(kSmiTagMask)); |
43 __ j(NOT_ZERO, &fall_through); | 43 __ j(NOT_ZERO, &fall_through); |
44 // Range check. | 44 // Range check. |
45 __ cmpq(RCX, FieldAddress(RAX, Array::length_offset())); | 45 __ cmpq(RCX, FieldAddress(RAX, Array::length_offset())); |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 | 94 |
95 __ Bind(&fall_through); | 95 __ Bind(&fall_through); |
96 } | 96 } |
97 | 97 |
98 | 98 |
99 // Add an element to growable array if it doesn't need to grow, otherwise | 99 // Add an element to growable array if it doesn't need to grow, otherwise |
100 // call into regular code. | 100 // call into regular code. |
101 // On stack: growable array (+2), value (+1), return-address (+0). | 101 // On stack: growable array (+2), value (+1), return-address (+0). |
102 void Intrinsifier::GrowableArray_add(Assembler* assembler) { | 102 void Intrinsifier::GrowableArray_add(Assembler* assembler) { |
103 // In checked mode we need to check the incoming argument. | 103 // In checked mode we need to check the incoming argument. |
104 if (Isolate::Current()->TypeChecksEnabled()) return; | 104 if (Isolate::Current()->flags().type_checks()) return; |
105 Label fall_through; | 105 Label fall_through; |
106 __ movq(RAX, Address(RSP, + 2 * kWordSize)); // Array. | 106 __ movq(RAX, Address(RSP, + 2 * kWordSize)); // Array. |
107 __ movq(RCX, FieldAddress(RAX, GrowableObjectArray::length_offset())); | 107 __ movq(RCX, FieldAddress(RAX, GrowableObjectArray::length_offset())); |
108 // RCX: length. | 108 // RCX: length. |
109 __ movq(RDX, FieldAddress(RAX, GrowableObjectArray::data_offset())); | 109 __ movq(RDX, FieldAddress(RAX, GrowableObjectArray::data_offset())); |
110 // RDX: data. | 110 // RDX: data. |
111 // Compare length with capacity. | 111 // Compare length with capacity. |
112 __ cmpq(RCX, FieldAddress(RDX, Array::length_offset())); | 112 __ cmpq(RCX, FieldAddress(RDX, Array::length_offset())); |
113 __ j(EQUAL, &fall_through); // Must grow data. | 113 __ j(EQUAL, &fall_through); // Must grow data. |
114 // len = len + 1; | 114 // len = len + 1; |
(...skipping 1870 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1985 // Set return value to Isolate::current_tag_. | 1985 // Set return value to Isolate::current_tag_. |
1986 __ movq(RAX, Address(RBX, Isolate::current_tag_offset())); | 1986 __ movq(RAX, Address(RBX, Isolate::current_tag_offset())); |
1987 __ ret(); | 1987 __ ret(); |
1988 } | 1988 } |
1989 | 1989 |
1990 #undef __ | 1990 #undef __ |
1991 | 1991 |
1992 } // namespace dart | 1992 } // namespace dart |
1993 | 1993 |
1994 #endif // defined TARGET_ARCH_X64 | 1994 #endif // defined TARGET_ARCH_X64 |
OLD | NEW |