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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 const intptr_t field_offset = cls.type_arguments_field_offset(); | 48 const intptr_t field_offset = cls.type_arguments_field_offset(); |
49 ASSERT(field_offset != Class::kNoTypeArguments); | 49 ASSERT(field_offset != Class::kNoTypeArguments); |
50 return field_offset; | 50 return field_offset; |
51 } | 51 } |
52 | 52 |
53 | 53 |
54 // Intrinsify only for Smi value and index. Non-smi values need a store buffer | 54 // Intrinsify only for Smi value and index. Non-smi values need a store buffer |
55 // update. Array length is always a Smi. | 55 // update. Array length is always a Smi. |
56 void Intrinsifier::ObjectArraySetIndexed(Assembler* assembler) { | 56 void Intrinsifier::ObjectArraySetIndexed(Assembler* assembler) { |
57 Label fall_through; | 57 Label fall_through; |
58 if (Isolate::Current()->flags().type_checks()) { | 58 if (Isolate::Current()->type_checks()) { |
59 const intptr_t type_args_field_offset = | 59 const intptr_t type_args_field_offset = |
60 ComputeObjectArrayTypeArgumentsOffset(); | 60 ComputeObjectArrayTypeArgumentsOffset(); |
61 // Inline simple tests (Smi, null), fallthrough if not positive. | 61 // Inline simple tests (Smi, null), fallthrough if not positive. |
62 const Immediate& raw_null = | 62 const Immediate& raw_null = |
63 Immediate(reinterpret_cast<intptr_t>(Object::null())); | 63 Immediate(reinterpret_cast<intptr_t>(Object::null())); |
64 Label checked_ok; | 64 Label checked_ok; |
65 __ movl(EDI, Address(ESP, + 1 * kWordSize)); // Value. | 65 __ movl(EDI, Address(ESP, + 1 * kWordSize)); // Value. |
66 // Null value is valid for any type. | 66 // Null value is valid for any type. |
67 __ cmpl(EDI, raw_null); | 67 __ cmpl(EDI, raw_null); |
68 __ j(EQUAL, &checked_ok, Assembler::kNearJump); | 68 __ j(EQUAL, &checked_ok, Assembler::kNearJump); |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 | 149 |
150 __ Bind(&fall_through); | 150 __ Bind(&fall_through); |
151 } | 151 } |
152 | 152 |
153 | 153 |
154 // Add an element to growable array if it doesn't need to grow, otherwise | 154 // Add an element to growable array if it doesn't need to grow, otherwise |
155 // call into regular code. | 155 // call into regular code. |
156 // On stack: growable array (+2), value (+1), return-address (+0). | 156 // On stack: growable array (+2), value (+1), return-address (+0). |
157 void Intrinsifier::GrowableArray_add(Assembler* assembler) { | 157 void Intrinsifier::GrowableArray_add(Assembler* assembler) { |
158 // In checked mode we need to type-check the incoming argument. | 158 // In checked mode we need to type-check the incoming argument. |
159 if (Isolate::Current()->flags().type_checks()) return; | 159 if (Isolate::Current()->type_checks()) return; |
160 | 160 |
161 Label fall_through; | 161 Label fall_through; |
162 __ movl(EAX, Address(ESP, + 2 * kWordSize)); // Array. | 162 __ movl(EAX, Address(ESP, + 2 * kWordSize)); // Array. |
163 __ movl(EBX, FieldAddress(EAX, GrowableObjectArray::length_offset())); | 163 __ movl(EBX, FieldAddress(EAX, GrowableObjectArray::length_offset())); |
164 // EBX: length. | 164 // EBX: length. |
165 __ movl(EDI, FieldAddress(EAX, GrowableObjectArray::data_offset())); | 165 __ movl(EDI, FieldAddress(EAX, GrowableObjectArray::data_offset())); |
166 // EDI: data. | 166 // EDI: data. |
167 // Compare length with capacity. | 167 // Compare length with capacity. |
168 __ cmpl(EBX, FieldAddress(EDI, Array::length_offset())); | 168 __ cmpl(EBX, FieldAddress(EDI, Array::length_offset())); |
169 __ j(EQUAL, &fall_through); // Must grow data. | 169 __ j(EQUAL, &fall_through); // Must grow data. |
(...skipping 1978 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2148 void Intrinsifier::Profiler_getCurrentTag(Assembler* assembler) { | 2148 void Intrinsifier::Profiler_getCurrentTag(Assembler* assembler) { |
2149 __ LoadIsolate(EAX); | 2149 __ LoadIsolate(EAX); |
2150 __ movl(EAX, Address(EAX, Isolate::current_tag_offset())); | 2150 __ movl(EAX, Address(EAX, Isolate::current_tag_offset())); |
2151 __ ret(); | 2151 __ ret(); |
2152 } | 2152 } |
2153 | 2153 |
2154 #undef __ | 2154 #undef __ |
2155 } // namespace dart | 2155 } // namespace dart |
2156 | 2156 |
2157 #endif // defined TARGET_ARCH_IA32 | 2157 #endif // defined TARGET_ARCH_IA32 |
OLD | NEW |