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 // TOS: Return address | 25 // TOS: Return address |
26 // The RBX, R10 registers can be destroyed only if there is no slow-path (i.e., | 26 // The RBX, R10 registers can be destroyed only if there is no slow-path (i.e., |
27 // the methods returns true). | 27 // the methods returns true). |
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 TypeChecksEnabled() { |
| 36 return FLAG_enable_type_checks || Isolate::Current()->checked_mode(); |
| 37 } |
| 38 |
| 39 |
35 void Intrinsifier::ObjectArraySetIndexed(Assembler* assembler) { | 40 void Intrinsifier::ObjectArraySetIndexed(Assembler* assembler) { |
36 if (FLAG_enable_type_checks) { | 41 if (TypeChecksEnabled()) { |
37 return; | 42 return; |
38 } | 43 } |
39 __ movq(RDX, Address(RSP, + 1 * kWordSize)); // Value. | 44 __ movq(RDX, Address(RSP, + 1 * kWordSize)); // Value. |
40 __ movq(RCX, Address(RSP, + 2 * kWordSize)); // Index. | 45 __ movq(RCX, Address(RSP, + 2 * kWordSize)); // Index. |
41 __ movq(RAX, Address(RSP, + 3 * kWordSize)); // Array. | 46 __ movq(RAX, Address(RSP, + 3 * kWordSize)); // Array. |
42 Label fall_through; | 47 Label fall_through; |
43 __ testq(RCX, Immediate(kSmiTagMask)); | 48 __ testq(RCX, Immediate(kSmiTagMask)); |
44 __ j(NOT_ZERO, &fall_through); | 49 __ j(NOT_ZERO, &fall_through); |
45 // Range check. | 50 // Range check. |
46 __ cmpq(RCX, FieldAddress(RAX, Array::length_offset())); | 51 __ cmpq(RCX, FieldAddress(RAX, Array::length_offset())); |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 | 100 |
96 __ Bind(&fall_through); | 101 __ Bind(&fall_through); |
97 } | 102 } |
98 | 103 |
99 | 104 |
100 // Add an element to growable array if it doesn't need to grow, otherwise | 105 // Add an element to growable array if it doesn't need to grow, otherwise |
101 // call into regular code. | 106 // call into regular code. |
102 // On stack: growable array (+2), value (+1), return-address (+0). | 107 // On stack: growable array (+2), value (+1), return-address (+0). |
103 void Intrinsifier::GrowableArray_add(Assembler* assembler) { | 108 void Intrinsifier::GrowableArray_add(Assembler* assembler) { |
104 // In checked mode we need to check the incoming argument. | 109 // In checked mode we need to check the incoming argument. |
105 if (FLAG_enable_type_checks) return; | 110 if (TypeChecksEnabled()) return; |
106 Label fall_through; | 111 Label fall_through; |
107 __ movq(RAX, Address(RSP, + 2 * kWordSize)); // Array. | 112 __ movq(RAX, Address(RSP, + 2 * kWordSize)); // Array. |
108 __ movq(RCX, FieldAddress(RAX, GrowableObjectArray::length_offset())); | 113 __ movq(RCX, FieldAddress(RAX, GrowableObjectArray::length_offset())); |
109 // RCX: length. | 114 // RCX: length. |
110 __ movq(RDX, FieldAddress(RAX, GrowableObjectArray::data_offset())); | 115 __ movq(RDX, FieldAddress(RAX, GrowableObjectArray::data_offset())); |
111 // RDX: data. | 116 // RDX: data. |
112 // Compare length with capacity. | 117 // Compare length with capacity. |
113 __ cmpq(RCX, FieldAddress(RDX, Array::length_offset())); | 118 __ cmpq(RCX, FieldAddress(RDX, Array::length_offset())); |
114 __ j(EQUAL, &fall_through); // Must grow data. | 119 __ j(EQUAL, &fall_through); // Must grow data. |
115 // len = len + 1; | 120 // len = len + 1; |
(...skipping 1818 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1934 // Set return value to Isolate::current_tag_. | 1939 // Set return value to Isolate::current_tag_. |
1935 __ movq(RAX, Address(RBX, Isolate::current_tag_offset())); | 1940 __ movq(RAX, Address(RBX, Isolate::current_tag_offset())); |
1936 __ ret(); | 1941 __ ret(); |
1937 } | 1942 } |
1938 | 1943 |
1939 #undef __ | 1944 #undef __ |
1940 | 1945 |
1941 } // namespace dart | 1946 } // namespace dart |
1942 | 1947 |
1943 #endif // defined TARGET_ARCH_X64 | 1948 #endif // defined TARGET_ARCH_X64 |
OLD | NEW |