OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 |
11 #include "vm/globals.h" // Needed here to get TARGET_ARCH_IA32. | 11 #include "vm/globals.h" // Needed here to get TARGET_ARCH_IA32. |
12 #if defined(TARGET_ARCH_IA32) | 12 #if defined(TARGET_ARCH_IA32) |
13 | 13 |
14 #include "vm/intrinsifier.h" | 14 #include "vm/intrinsifier.h" |
15 | 15 |
16 #include "vm/assembler.h" | 16 #include "vm/assembler.h" |
17 #include "vm/assembler_macros.h" | 17 #include "vm/assembler_macros.h" |
18 #include "vm/object.h" | 18 #include "vm/object.h" |
19 #include "vm/object_store.h" | 19 #include "vm/object_store.h" |
20 #include "vm/os.h" | 20 #include "vm/os.h" |
21 #include "vm/stub_code.h" | 21 #include "vm/stub_code.h" |
| 22 #include "vm/symbols.h" |
22 | 23 |
23 namespace dart { | 24 namespace dart { |
24 | 25 |
25 DECLARE_FLAG(bool, enable_type_checks); | 26 DECLARE_FLAG(bool, enable_type_checks); |
26 | 27 |
27 | 28 |
28 #define __ assembler-> | 29 #define __ assembler-> |
29 | 30 |
30 bool Intrinsifier::ObjectArray_Allocate(Assembler* assembler) { | 31 bool Intrinsifier::ObjectArray_Allocate(Assembler* assembler) { |
31 // This snippet of inlined code uses the following registers: | 32 // This snippet of inlined code uses the following registers: |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 return false; | 159 return false; |
159 } | 160 } |
160 | 161 |
161 | 162 |
162 bool Intrinsifier::ImmutableArray_getIndexed(Assembler* assembler) { | 163 bool Intrinsifier::ImmutableArray_getIndexed(Assembler* assembler) { |
163 return Array_getIndexed(assembler); | 164 return Array_getIndexed(assembler); |
164 } | 165 } |
165 | 166 |
166 | 167 |
167 static intptr_t ComputeObjectArrayTypeArgumentsOffset() { | 168 static intptr_t ComputeObjectArrayTypeArgumentsOffset() { |
168 const String& class_name = String::Handle(String::NewSymbol("ObjectArray")); | 169 const String& class_name = String::Handle(Symbols::New("ObjectArray")); |
169 const Class& cls = Class::Handle( | 170 const Class& cls = Class::Handle( |
170 Library::Handle(Library::CoreImplLibrary()).LookupClass(class_name)); | 171 Library::Handle(Library::CoreImplLibrary()).LookupClass(class_name)); |
171 ASSERT(!cls.IsNull()); | 172 ASSERT(!cls.IsNull()); |
172 ASSERT(cls.HasTypeArguments()); | 173 ASSERT(cls.HasTypeArguments()); |
173 ASSERT(cls.NumTypeArguments() == 1); | 174 ASSERT(cls.NumTypeArguments() == 1); |
174 const intptr_t field_offset = cls.type_arguments_instance_field_offset(); | 175 const intptr_t field_offset = cls.type_arguments_instance_field_offset(); |
175 ASSERT(field_offset != Class::kNoTypeArguments); | 176 ASSERT(field_offset != Class::kNoTypeArguments); |
176 return field_offset; | 177 return field_offset; |
177 } | 178 } |
178 | 179 |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 ECX); | 234 ECX); |
234 // Caller is responsible of preserving the value if necessary. | 235 // Caller is responsible of preserving the value if necessary. |
235 __ ret(); | 236 __ ret(); |
236 __ Bind(&fall_through); | 237 __ Bind(&fall_through); |
237 return false; | 238 return false; |
238 } | 239 } |
239 | 240 |
240 | 241 |
241 static intptr_t GetOffsetForField(const char* class_name_p, | 242 static intptr_t GetOffsetForField(const char* class_name_p, |
242 const char* field_name_p) { | 243 const char* field_name_p) { |
243 const String& class_name = String::Handle(String::NewSymbol(class_name_p)); | 244 const String& class_name = String::Handle(Symbols::New(class_name_p)); |
244 const String& field_name = String::Handle(String::NewSymbol(field_name_p)); | 245 const String& field_name = String::Handle(Symbols::New(field_name_p)); |
245 const Class& cls = Class::Handle(Library::Handle( | 246 const Class& cls = Class::Handle(Library::Handle( |
246 Library::CoreImplLibrary()).LookupClass(class_name)); | 247 Library::CoreImplLibrary()).LookupClass(class_name)); |
247 ASSERT(!cls.IsNull()); | 248 ASSERT(!cls.IsNull()); |
248 const Field& field = Field::ZoneHandle(cls.LookupInstanceField(field_name)); | 249 const Field& field = Field::ZoneHandle(cls.LookupInstanceField(field_name)); |
249 ASSERT(!field.IsNull()); | 250 ASSERT(!field.IsNull()); |
250 return field.Offset(); | 251 return field.Offset(); |
251 } | 252 } |
252 | 253 |
253 | 254 |
254 // Allocate a GrowableObjectArray using the backing array specified. | 255 // Allocate a GrowableObjectArray using the backing array specified. |
(...skipping 1108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1363 __ Bind(&is_true); | 1364 __ Bind(&is_true); |
1364 __ LoadObject(EAX, bool_true); | 1365 __ LoadObject(EAX, bool_true); |
1365 __ ret(); | 1366 __ ret(); |
1366 return true; | 1367 return true; |
1367 } | 1368 } |
1368 | 1369 |
1369 #undef __ | 1370 #undef __ |
1370 } // namespace dart | 1371 } // namespace dart |
1371 | 1372 |
1372 #endif // defined TARGET_ARCH_IA32 | 1373 #endif // defined TARGET_ARCH_IA32 |
OLD | NEW |