Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(117)

Side by Side Diff: runtime/vm/intrinsifier_ia32.cc

Issue 9836097: Fortgot the changes as requested by Regis. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 return false; 213 return false;
214 } 214 }
215 215
216 216
217 static intptr_t ComputeObjectArrayTypeArgumentsOffset() { 217 static intptr_t ComputeObjectArrayTypeArgumentsOffset() {
218 const String& class_name = String::Handle(String::NewSymbol("ObjectArray")); 218 const String& class_name = String::Handle(String::NewSymbol("ObjectArray"));
219 const Class& cls = Class::Handle( 219 const Class& cls = Class::Handle(
220 Library::Handle(Library::CoreImplLibrary()).LookupClass(class_name)); 220 Library::Handle(Library::CoreImplLibrary()).LookupClass(class_name));
221 ASSERT(!cls.IsNull()); 221 ASSERT(!cls.IsNull());
222 ASSERT(cls.HasTypeArguments()); 222 ASSERT(cls.HasTypeArguments());
223 ASSERT(cls.NumTypeParameters() == 1); 223 ASSERT(cls.NumTypeArguments() == 1);
224 const intptr_t field_offset = cls.type_arguments_instance_field_offset(); 224 const intptr_t field_offset = cls.type_arguments_instance_field_offset();
225 ASSERT(field_offset != Class::kNoTypeArguments); 225 ASSERT(field_offset != Class::kNoTypeArguments);
226 return field_offset; 226 return field_offset;
227 } 227 }
228 228
229 229
230 // Intrinsify only for Smi value and index. Non-smi values need a store buffer 230 // Intrinsify only for Smi value and index. Non-smi values need a store buffer
231 // update. Array length is always a Smi. 231 // update. Array length is always a Smi.
232 static bool Array_setIndexed(Assembler* assembler) { 232 static bool Array_setIndexed(Assembler* assembler) {
233 Label fall_through; 233 Label fall_through;
234 if (FLAG_enable_type_checks) { 234 if (FLAG_enable_type_checks) {
235 const intptr_t type_args_field_offset = 235 const intptr_t type_args_field_offset =
236 ComputeObjectArrayTypeArgumentsOffset(); 236 ComputeObjectArrayTypeArgumentsOffset();
237 // Inline simple tests (Smi, null), fallthrough if not positive. 237 // Inline simple tests (Smi, null), fallthrough if not positive.
238 const Immediate raw_null = 238 const Immediate raw_null =
239 Immediate(reinterpret_cast<intptr_t>(Object::null())); 239 Immediate(reinterpret_cast<intptr_t>(Object::null()));
240 Label checked_ok; 240 Label checked_ok;
241 __ movl(EAX, Address(ESP, + 1 * kWordSize)); 241 __ movl(EAX, Address(ESP, + 1 * kWordSize)); // Value.
242 __ cmpl(EAX, raw_null); 242 __ cmpl(EAX, raw_null);
243 __ j(EQUAL, &checked_ok, Assembler::kNearJump); 243 __ j(EQUAL, &checked_ok, Assembler::kNearJump);
244 __ testl(EAX, Immediate(kSmiTagMask)); 244 __ testl(EAX, Immediate(kSmiTagMask));
245 __ j(NOT_ZERO, &fall_through, Assembler::kNearJump); // Non-smi value. 245 __ j(NOT_ZERO, &fall_through, Assembler::kNearJump); // Non-smi value.
246 246
247 __ movl(EBX, Address(ESP, + 3 * kWordSize)); // Array. 247 __ movl(EBX, Address(ESP, + 3 * kWordSize)); // Array.
248 __ movl(EBX, FieldAddress(EBX, type_args_field_offset)); 248 __ movl(EBX, FieldAddress(EBX, type_args_field_offset));
249 // EBX: Type arguments of array. 249 // EBX: Type arguments of array.
250 __ movl(EAX, FieldAddress(EBX, Object::class_offset())); 250 __ movl(EAX, FieldAddress(EBX, Object::class_offset()));
251 // Check if it's Dynamic, int, or num. 251 // Check if it's Dynamic, int, or num.
252 __ cmpl(EAX, raw_null); // Dynamic? 252 __ cmpl(EAX, raw_null); // Dynamic?
253 __ j(EQUAL, &checked_ok, Assembler::kNearJump); 253 __ j(EQUAL, &checked_ok, Assembler::kNearJump);
254 // For now handle only TypeArguments and bail out if InstantiatedTypeArgs. 254 // For now handle only TypeArguments and bail out if InstantiatedTypeArgs.
255 __ CompareObject(EAX, Object::ZoneHandle(Object::type_arguments_class())); 255 __ CompareObject(EAX, Object::ZoneHandle(Object::type_arguments_class()));
256 __ j(NOT_EQUAL, &fall_through, Assembler::kNearJump); 256 __ j(NOT_EQUAL, &fall_through, Assembler::kNearJump);
257 // Get type at index 0. 257 // Get type at index 0.
258 __ movl(EAX, FieldAddress(EBX, TypeArguments::type_at_offset(0))); 258 __ movl(EAX, FieldAddress(EBX, TypeArguments::type_at_offset(0)));
259 __ CompareObject(EAX, Type::ZoneHandle(Type::DynamicType())); 259 __ CompareObject(EAX, Type::ZoneHandle(Type::DynamicType()));
260 __ j(EQUAL, &checked_ok, Assembler::kNearJump); 260 __ j(EQUAL, &checked_ok, Assembler::kNearJump);
261 __ CompareObject(EAX, Type::ZoneHandle(Type::IntInterface())); 261 __ CompareObject(EAX, Type::ZoneHandle(Type::IntInterface()));
262 __ j(EQUAL, &checked_ok, Assembler::kNearJump); 262 __ j(EQUAL, &checked_ok, Assembler::kNearJump);
263 __ CompareObject(EAX, Type::ZoneHandle(Type::NumberInterface())); 263 __ CompareObject(EAX, Type::ZoneHandle(Type::NumberInterface()));
264 __ j(NOT_EQUAL, &fall_through, Assembler::kNearJump); 264 __ j(NOT_EQUAL, &fall_through, Assembler::kNearJump);
265 // TODO(srdjan): Check classes.
266 __ Bind(&checked_ok); 265 __ Bind(&checked_ok);
267 } 266 }
268 __ movl(EBX, Address(ESP, + 2 * kWordSize)); // Index. 267 __ movl(EBX, Address(ESP, + 2 * kWordSize)); // Index.
269 __ testl(EBX, Immediate(kSmiTagMask)); 268 __ testl(EBX, Immediate(kSmiTagMask));
270 // Index not Smi. 269 // Index not Smi.
271 __ j(NOT_ZERO, &fall_through, Assembler::kNearJump); 270 __ j(NOT_ZERO, &fall_through, Assembler::kNearJump);
272 __ movl(EAX, Address(ESP, + 3 * kWordSize)); // Array. 271 __ movl(EAX, Address(ESP, + 3 * kWordSize)); // Array.
273 // Range check. 272 // Range check.
274 __ cmpl(EBX, FieldAddress(EAX, Array::length_offset())); 273 __ cmpl(EBX, FieldAddress(EAX, Array::length_offset()));
275 // Runtime throws exception. 274 // Runtime throws exception.
(...skipping 1012 matching lines...) Expand 10 before | Expand all | Expand 10 after
1288 } \ 1287 } \
1289 1288
1290 INTRINSIC_LIST(FIND_INTRINSICS); 1289 INTRINSIC_LIST(FIND_INTRINSICS);
1291 #undef FIND_INTRINSICS 1290 #undef FIND_INTRINSICS
1292 return false; 1291 return false;
1293 } 1292 }
1294 1293
1295 } // namespace dart 1294 } // namespace dart
1296 1295
1297 #endif // defined TARGET_ARCH_IA32 1296 #endif // defined TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698