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

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

Issue 10379018: Revert "Revert "Implement {Int,Uint}{8,16,32,64} and Float{32,64} typed arrays."" (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 7 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
OLDNEW
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
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after
425 return false; 425 return false;
426 } 426 }
427 __ movl(EAX, Address(ESP, + 2 * kWordSize)); 427 __ movl(EAX, Address(ESP, + 2 * kWordSize));
428 __ movl(EBX, Address(ESP, + 1 * kWordSize)); 428 __ movl(EBX, Address(ESP, + 1 * kWordSize));
429 __ movl(FieldAddress(EAX, GrowableObjectArray::data_offset()), EBX); 429 __ movl(FieldAddress(EAX, GrowableObjectArray::data_offset()), EBX);
430 __ ret(); 430 __ ret();
431 return true; 431 return true;
432 } 432 }
433 433
434 434
435 // Handles only class InternalByteArray.
436 bool Intrinsifier::ByteArrayBase_getLength(Assembler* assembler) {
437 ObjectStore* object_store = Isolate::Current()->object_store();
438 Label fall_through;
439 __ movl(EAX, Address(ESP, + 1 * kWordSize));
440 __ movl(EBX, FieldAddress(EAX, Object::class_offset()));
441 __ CompareObject(EBX,
442 Class::ZoneHandle(object_store->internal_byte_array_class()));
443 __ j(NOT_EQUAL, &fall_through);
444 __ movl(EAX, FieldAddress(EAX, InternalByteArray::length_offset()));
445 __ ret();
446 __ Bind(&fall_through);
447 return false;
448 }
449
450
451 // Handles only class InternalByteArray.
452 bool Intrinsifier::ByteArrayBase_getIndexed(Assembler* assembler) {
453 ObjectStore* object_store = Isolate::Current()->object_store();
454 Label fall_through;
455 __ movl(EAX, Address(ESP, + 2 * kWordSize)); // Array.
456 __ movl(EBX, FieldAddress(EAX, Object::class_offset()));
457 __ CompareObject(EBX,
458 Class::ZoneHandle(object_store->internal_byte_array_class()));
459 __ j(NOT_EQUAL, &fall_through);
460 __ movl(EBX, Address(ESP, + 1 * kWordSize)); // Index.
461 __ testl(EBX, Immediate(kSmiTagMask));
462 __ j(NOT_ZERO, &fall_through, Assembler::kNearJump); // Non-smi index.
463 // Range check.
464 __ cmpl(EBX, FieldAddress(EAX, InternalByteArray::length_offset()));
465 // Runtime throws exception.
466 __ j(ABOVE_EQUAL, &fall_through, Assembler::kNearJump);
467 __ SmiUntag(EBX);
468 __ movzxb(EAX,
469 FieldAddress(EAX, EBX, TIMES_1, InternalByteArray::data_offset()));
470 // The values stored in the byte array are regular, untagged values,
471 // therefore they need to be tagged.
472 __ SmiTag(EAX);
473 __ ret();
474 __ Bind(&fall_through);
475 return false;
476 }
477
478
479 // Tests if two top most arguments are smis, jumps to label not_smi if not. 435 // Tests if two top most arguments are smis, jumps to label not_smi if not.
480 // Topmost argument is in EAX. 436 // Topmost argument is in EAX.
481 static void TestBothArgumentsSmis(Assembler* assembler, Label* not_smi) { 437 static void TestBothArgumentsSmis(Assembler* assembler, Label* not_smi) {
482 __ movl(EAX, Address(ESP, + 1 * kWordSize)); 438 __ movl(EAX, Address(ESP, + 1 * kWordSize));
483 __ movl(EBX, Address(ESP, + 2 * kWordSize)); 439 __ movl(EBX, Address(ESP, + 2 * kWordSize));
484 __ orl(EBX, EAX); 440 __ orl(EBX, EAX);
485 __ testl(EBX, Immediate(kSmiTagMask)); 441 __ testl(EBX, Immediate(kSmiTagMask));
486 __ j(NOT_ZERO, not_smi, Assembler::kNearJump); 442 __ j(NOT_ZERO, not_smi, Assembler::kNearJump);
487 } 443 }
488 444
(...skipping 848 matching lines...) Expand 10 before | Expand all | Expand 10 after
1337 __ Bind(&is_true); 1293 __ Bind(&is_true);
1338 __ LoadObject(EAX, bool_true); 1294 __ LoadObject(EAX, bool_true);
1339 __ ret(); 1295 __ ret();
1340 return true; 1296 return true;
1341 } 1297 }
1342 1298
1343 #undef __ 1299 #undef __
1344 } // namespace dart 1300 } // namespace dart
1345 1301
1346 #endif // defined TARGET_ARCH_IA32 1302 #endif // defined TARGET_ARCH_IA32
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698