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

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

Issue 11139004: Intrinsify natural word size typed array getters on IA32 and X64 (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 2 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 546 matching lines...) Expand 10 before | Expand all | Expand 10 after
557 TIMES_1, 557 TIMES_1,
558 Uint16Array::data_offset())); 558 Uint16Array::data_offset()));
559 __ SmiTag(EAX); 559 __ SmiTag(EAX);
560 __ ret(); 560 __ ret();
561 __ Bind(&fall_through); 561 __ Bind(&fall_through);
562 return false; 562 return false;
563 } 563 }
564 564
565 565
566 bool Intrinsifier::Int32Array_getIndexed(Assembler* assembler) { 566 bool Intrinsifier::Int32Array_getIndexed(Assembler* assembler) {
567 Label fall_through;
568 TestByteArrayIndex(assembler, &fall_through);
569 __ movl(EAX, FieldAddress(EAX,
570 EBX,
571 TIMES_2,
572 Int32Array::data_offset()));
573 // Copy EBX into EAX.
574 // We destroy EBX while testing if EAX can fit inside a Smi.
575 __ movl(EBX, EAX);
576 // Verify that the signed value in EBX can be stored in a Smi.
srdjan 2012/10/12 22:52:48 Quicker way is to test with: __ testl(EAX
Florian Schneider 2012/10/15 14:29:17 For signed ints it should be __ cmpl(EAX, Immedi
577 __ shll(EBX, Immediate(0x1));
578 __ j(OVERFLOW, &fall_through, Assembler::kNearJump); // Won't fit Smi.
579 __ SmiTag(EAX);
580 __ ret();
581 __ Bind(&fall_through);
567 return false; 582 return false;
568 } 583 }
569 584
570 585
571 bool Intrinsifier::Uint32Array_getIndexed(Assembler* assembler) { 586 bool Intrinsifier::Uint32Array_getIndexed(Assembler* assembler) {
587 Label fall_through;
588 TestByteArrayIndex(assembler, &fall_through);
589 __ movl(EAX, FieldAddress(EAX,
590 EBX,
591 TIMES_2,
592 Uint32Array::data_offset()));
593 // Copy EBX into EAX.
594 // We destroy EBX while testing if EAX can fit inside a Smi.
595 __ movl(EBX, EAX);
596 // Verify that the unsigned value in EAX can be stored in a Smi.
cshapiro 2012/10/12 22:33:52 Indentation...
597 __ shrl(EBX, Immediate(30));
cshapiro 2012/10/12 22:33:52 Please use the named constant kSmiBits instead of
598 __ j(NOT_ZERO, &fall_through, Assembler::kNearJump); // Won't fit Smi.
srdjan 2012/10/12 22:52:48 I believe quicker test for unsigned is: __ testl(
599 __ SmiTag(EAX);
600 __ ret();
601 __ Bind(&fall_through);
572 return false; 602 return false;
573 } 603 }
574 604
605
606 bool Intrinsifier::Int64Array_getIndexed(Assembler* assembler) {
srdjan 2012/10/12 22:52:48 You could add here code that checks if the result
607 return false;
608 }
609
610
611 bool Intrinsifier::Uint64Array_getIndexed(Assembler* assembler) {
612 return false;
613 }
614
575 615
576 bool Intrinsifier::Float32Array_getIndexed(Assembler* assembler) { 616 bool Intrinsifier::Float32Array_getIndexed(Assembler* assembler) {
577 Label fall_through; 617 Label fall_through;
578 TestByteArrayIndex(assembler, &fall_through); 618 TestByteArrayIndex(assembler, &fall_through);
579 // After TestByteArrayIndex: 619 // After TestByteArrayIndex:
580 // * EAX has the base address of the byte array. 620 // * EAX has the base address of the byte array.
581 // * EBX has the index into the array. 621 // * EBX has the index into the array.
582 // EBX contains the SMI index which is shifted left by 1. 622 // EBX contains the SMI index which is shifted left by 1.
583 // This shift means we only multiply the index by 2 not 4 (sizeof float). 623 // This shift means we only multiply the index by 2 not 4 (sizeof float).
584 // Load single precision float into XMM7. 624 // Load single precision float into XMM7.
(...skipping 961 matching lines...) Expand 10 before | Expand all | Expand 10 after
1546 __ Bind(&is_true); 1586 __ Bind(&is_true);
1547 __ LoadObject(EAX, bool_true); 1587 __ LoadObject(EAX, bool_true);
1548 __ ret(); 1588 __ ret();
1549 return true; 1589 return true;
1550 } 1590 }
1551 1591
1552 #undef __ 1592 #undef __
1553 } // namespace dart 1593 } // namespace dart
1554 1594
1555 #endif // defined TARGET_ARCH_IA32 1595 #endif // defined TARGET_ARCH_IA32
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698