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

Side by Side Diff: vm/intrinsifier_ia32.cc

Issue 8931016: Fix truncate divide bug (reported by sra) when dividing MIN_SMI by -1. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 9 years 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 | vm/opt_code_generator_ia32.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) 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 350 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 static bool Integer_truncDivide(Assembler* assembler) { 361 static bool Integer_truncDivide(Assembler* assembler) {
362 Label fall_through; 362 Label fall_through;
363 TestBothArgumentsSmis(assembler, &fall_through); 363 TestBothArgumentsSmis(assembler, &fall_through);
364 // EAX: right argument (divisor) 364 // EAX: right argument (divisor)
365 __ cmpl(EAX, Immediate(0)); 365 __ cmpl(EAX, Immediate(0));
366 __ j(EQUAL, &fall_through, Assembler::kNearJump); 366 __ j(EQUAL, &fall_through, Assembler::kNearJump);
367 __ movl(EBX, EAX); 367 __ movl(EBX, EAX);
368 __ SmiUntag(EBX); 368 __ SmiUntag(EBX);
369 __ movl(EAX, Address(ESP, + 2 * kWordSize)); // Left argument (dividend). 369 __ movl(EAX, Address(ESP, + 2 * kWordSize)); // Left argument (dividend).
370 __ SmiUntag(EAX); 370 __ SmiUntag(EAX);
371 __ pushl(EDX); // Preserve EDX in case of 'fall_through'.
371 __ cdq(); 372 __ cdq();
372 __ idivl(EBX); 373 __ idivl(EBX);
374 __ popl(EDX);
375 // Check the corner case of dividing the 'MIN_SMI' with -1, in which case we
376 // cannot tag the result.
377 __ cmpl(EAX, Immediate(0x40000000));
378 __ j(EQUAL, &fall_through);
373 __ SmiTag(EAX); 379 __ SmiTag(EAX);
374 __ ret(); 380 __ ret();
375 __ Bind(&fall_through); 381 __ Bind(&fall_through);
376 return false; 382 return false;
377 } 383 }
378 384
379 385
380 static bool Integer_negate(Assembler* assembler) { 386 static bool Integer_negate(Assembler* assembler) {
381 Label fall_through; 387 Label fall_through;
382 __ movl(EAX, Address(ESP, + 1 * kWordSize)); 388 __ movl(EAX, Address(ESP, + 1 * kWordSize));
(...skipping 618 matching lines...) Expand 10 before | Expand all | Expand 10 after
1001 } \ 1007 } \
1002 1008
1003 INTRINSIC_LIST(FIND_INTRINSICS); 1009 INTRINSIC_LIST(FIND_INTRINSICS);
1004 #undef FIND_INTRINSICS 1010 #undef FIND_INTRINSICS
1005 return false; 1011 return false;
1006 } 1012 }
1007 1013
1008 } // namespace dart 1014 } // namespace dart
1009 1015
1010 #endif // defined TARGET_ARCH_IA32 1016 #endif // defined TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « no previous file | vm/opt_code_generator_ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698