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 // The intrinsic code below is executed before a method has built its frame. | 5 // The intrinsic code below is executed before a method has built its frame. |
6 // The return address is on the stack and the arguments below it. | 6 // The return address is on the stack and the arguments below it. |
7 // Registers EDX (arguments descriptor) and ECX (function) must be preserved. | 7 // Registers EDX (arguments descriptor) and ECX (function) must be preserved. |
8 // Each intrinsification method returns true if the corresponding | 8 // Each intrinsification method returns true if the corresponding |
9 // Dart method was intrinsified. | 9 // Dart method was intrinsified. |
10 | 10 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 const intptr_t field_offset = cls.type_arguments_field_offset(); | 42 const intptr_t field_offset = cls.type_arguments_field_offset(); |
43 ASSERT(field_offset != Class::kNoTypeArguments); | 43 ASSERT(field_offset != Class::kNoTypeArguments); |
44 return field_offset; | 44 return field_offset; |
45 } | 45 } |
46 | 46 |
47 | 47 |
48 // Intrinsify only for Smi value and index. Non-smi values need a store buffer | 48 // Intrinsify only for Smi value and index. Non-smi values need a store buffer |
49 // update. Array length is always a Smi. | 49 // update. Array length is always a Smi. |
50 void Intrinsifier::ObjectArraySetIndexed(Assembler* assembler) { | 50 void Intrinsifier::ObjectArraySetIndexed(Assembler* assembler) { |
51 Label fall_through; | 51 Label fall_through; |
52 if (FLAG_enable_type_checks) { | 52 if (Isolate::Current()->TypeChecksEnabled()) { |
53 const intptr_t type_args_field_offset = | 53 const intptr_t type_args_field_offset = |
54 ComputeObjectArrayTypeArgumentsOffset(); | 54 ComputeObjectArrayTypeArgumentsOffset(); |
55 // Inline simple tests (Smi, null), fallthrough if not positive. | 55 // Inline simple tests (Smi, null), fallthrough if not positive. |
56 const Immediate& raw_null = | 56 const Immediate& raw_null = |
57 Immediate(reinterpret_cast<intptr_t>(Object::null())); | 57 Immediate(reinterpret_cast<intptr_t>(Object::null())); |
58 Label checked_ok; | 58 Label checked_ok; |
59 __ movl(EDI, Address(ESP, + 1 * kWordSize)); // Value. | 59 __ movl(EDI, Address(ESP, + 1 * kWordSize)); // Value. |
60 // Null value is valid for any type. | 60 // Null value is valid for any type. |
61 __ cmpl(EDI, raw_null); | 61 __ cmpl(EDI, raw_null); |
62 __ j(EQUAL, &checked_ok, Assembler::kNearJump); | 62 __ j(EQUAL, &checked_ok, Assembler::kNearJump); |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 | 143 |
144 __ Bind(&fall_through); | 144 __ Bind(&fall_through); |
145 } | 145 } |
146 | 146 |
147 | 147 |
148 // Add an element to growable array if it doesn't need to grow, otherwise | 148 // Add an element to growable array if it doesn't need to grow, otherwise |
149 // call into regular code. | 149 // call into regular code. |
150 // On stack: growable array (+2), value (+1), return-address (+0). | 150 // On stack: growable array (+2), value (+1), return-address (+0). |
151 void Intrinsifier::GrowableArray_add(Assembler* assembler) { | 151 void Intrinsifier::GrowableArray_add(Assembler* assembler) { |
152 // In checked mode we need to type-check the incoming argument. | 152 // In checked mode we need to type-check the incoming argument. |
153 if (FLAG_enable_type_checks) return; | 153 if (Isolate::Current()->TypeChecksEnabled()) return; |
154 | 154 |
155 Label fall_through; | 155 Label fall_through; |
156 __ movl(EAX, Address(ESP, + 2 * kWordSize)); // Array. | 156 __ movl(EAX, Address(ESP, + 2 * kWordSize)); // Array. |
157 __ movl(EBX, FieldAddress(EAX, GrowableObjectArray::length_offset())); | 157 __ movl(EBX, FieldAddress(EAX, GrowableObjectArray::length_offset())); |
158 // EBX: length. | 158 // EBX: length. |
159 __ movl(EDI, FieldAddress(EAX, GrowableObjectArray::data_offset())); | 159 __ movl(EDI, FieldAddress(EAX, GrowableObjectArray::data_offset())); |
160 // EDI: data. | 160 // EDI: data. |
161 // Compare length with capacity. | 161 // Compare length with capacity. |
162 __ cmpl(EBX, FieldAddress(EDI, Array::length_offset())); | 162 __ cmpl(EBX, FieldAddress(EDI, Array::length_offset())); |
163 __ j(EQUAL, &fall_through); // Must grow data. | 163 __ j(EQUAL, &fall_through); // Must grow data. |
(...skipping 1889 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2053 Isolate::current_tag_offset()); | 2053 Isolate::current_tag_offset()); |
2054 // Set return value to Isolate::current_tag_. | 2054 // Set return value to Isolate::current_tag_. |
2055 __ movl(EAX, current_tag_addr); | 2055 __ movl(EAX, current_tag_addr); |
2056 __ ret(); | 2056 __ ret(); |
2057 } | 2057 } |
2058 | 2058 |
2059 #undef __ | 2059 #undef __ |
2060 } // namespace dart | 2060 } // namespace dart |
2061 | 2061 |
2062 #endif // defined TARGET_ARCH_IA32 | 2062 #endif // defined TARGET_ARCH_IA32 |
OLD | NEW |