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

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

Issue 11144021: Fix crashes in intrinsified float32/float64 array setters when attempting to store a Smi. Added tes… (Closed) Base URL: http://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
« no previous file with comments | « no previous file | runtime/vm/intrinsifier_x64.cc » ('j') | 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) 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 588 matching lines...) Expand 10 before | Expand all | Expand 10 after
599 __ Bind(&fall_through); 599 __ Bind(&fall_through);
600 600
601 return false; 601 return false;
602 } 602 }
603 603
604 604
605 bool Intrinsifier::Float32Array_setIndexed(Assembler* assembler) { 605 bool Intrinsifier::Float32Array_setIndexed(Assembler* assembler) {
606 Label fall_through; 606 Label fall_through;
607 __ movl(EAX, Address(ESP, + 1 * kWordSize)); // Value. 607 __ movl(EAX, Address(ESP, + 1 * kWordSize)); // Value.
608 // If EAX is not an instance of double, jump to fall through. 608 // If EAX is not an instance of double, jump to fall through.
609 __ testl(EAX, Immediate(kSmiTagMask));
610 __ j(ZERO, &fall_through);
609 __ CompareClassId(EAX, kDoubleCid, EDI); 611 __ CompareClassId(EAX, kDoubleCid, EDI);
610 __ j(NOT_EQUAL, &fall_through); 612 __ j(NOT_EQUAL, &fall_through, Assembler::kNearJump);
611 // Load double value into XMM7. 613 // Load double value into XMM7.
612 __ movsd(XMM7, FieldAddress(EAX, Double::value_offset())); 614 __ movsd(XMM7, FieldAddress(EAX, Double::value_offset()));
613 TestByteArraySetIndex(assembler, &fall_through); 615 TestByteArraySetIndex(assembler, &fall_through);
614 // After TestByteArraySetIndex: 616 // After TestByteArraySetIndex:
615 // * EAX has the base address of the byte array. 617 // * EAX has the base address of the byte array.
616 // * EBX has the index into the array. 618 // * EBX has the index into the array.
617 // EBX contains the SMI index which is shifted by 1. 619 // EBX contains the SMI index which is shifted by 1.
618 // This shift means we only multiply the index by 2 not 4 (sizeof float). 620 // This shift means we only multiply the index by 2 not 4 (sizeof float).
619 // Convert from double precision float to single precision float. 621 // Convert from double precision float to single precision float.
620 __ cvtsd2ss(XMM7, XMM7); 622 __ cvtsd2ss(XMM7, XMM7);
(...skipping 29 matching lines...) Expand all
650 __ ret(); 652 __ ret();
651 __ Bind(&fall_through); 653 __ Bind(&fall_through);
652 return false; 654 return false;
653 } 655 }
654 656
655 657
656 bool Intrinsifier::Float64Array_setIndexed(Assembler* assembler) { 658 bool Intrinsifier::Float64Array_setIndexed(Assembler* assembler) {
657 Label fall_through; 659 Label fall_through;
658 __ movl(EAX, Address(ESP, + 1 * kWordSize)); // Value. 660 __ movl(EAX, Address(ESP, + 1 * kWordSize)); // Value.
659 // If EAX is not an instance of double, jump to fall through. 661 // If EAX is not an instance of double, jump to fall through.
662 __ testl(EAX, Immediate(kSmiTagMask));
663 __ j(ZERO, &fall_through, Assembler::kNearJump);
660 __ CompareClassId(EAX, kDoubleCid, EDI); 664 __ CompareClassId(EAX, kDoubleCid, EDI);
661 __ j(NOT_EQUAL, &fall_through); 665 __ j(NOT_EQUAL, &fall_through, Assembler::kNearJump);
662 // Load double value into XMM7. 666 // Load double value into XMM7.
663 __ movsd(XMM7, FieldAddress(EAX, Double::value_offset())); 667 __ movsd(XMM7, FieldAddress(EAX, Double::value_offset()));
664 TestByteArraySetIndex(assembler, &fall_through); 668 TestByteArraySetIndex(assembler, &fall_through);
665 // After TestByteArraySetIndex: 669 // After TestByteArraySetIndex:
666 // * EAX has the base address of the byte array. 670 // * EAX has the base address of the byte array.
667 // * EBX has the index into the array. 671 // * EBX has the index into the array.
668 // EBX contains the SMI index which is shifted by 1. 672 // EBX contains the SMI index which is shifted by 1.
669 // This shift means we only multiply the index by 4 not 8 (sizeof float). 673 // This shift means we only multiply the index by 4 not 8 (sizeof float).
670 // Store into array. 674 // Store into array.
671 __ movsd(FieldAddress(EAX, EBX, TIMES_4, Float64Array::data_offset()), XMM7); 675 __ movsd(FieldAddress(EAX, EBX, TIMES_4, Float64Array::data_offset()), XMM7);
(...skipping 874 matching lines...) Expand 10 before | Expand all | Expand 10 after
1546 __ Bind(&is_true); 1550 __ Bind(&is_true);
1547 __ LoadObject(EAX, bool_true); 1551 __ LoadObject(EAX, bool_true);
1548 __ ret(); 1552 __ ret();
1549 return true; 1553 return true;
1550 } 1554 }
1551 1555
1552 #undef __ 1556 #undef __
1553 } // namespace dart 1557 } // namespace dart
1554 1558
1555 #endif // defined TARGET_ARCH_IA32 1559 #endif // defined TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/intrinsifier_x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698