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

Side by Side Diff: src/arm/lithium-codegen-arm.cc

Issue 22964004: Fix a bug in Div when all uses are truncating (Closed) Base URL: https://github.com/v8/v8.git@master
Patch Set: Created 7 years, 4 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
« no previous file with comments | « no previous file | src/ia32/lithium-codegen-ia32.cc » ('j') | test/mjsunit/shift-for-integer-div.js » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 1376 matching lines...) Expand 10 before | Expand all | Expand 10 after
1387 __ cmp(dividend, Operand(kMinInt)); 1387 __ cmp(dividend, Operand(kMinInt));
1388 DeoptimizeIf(eq, instr->environment()); 1388 DeoptimizeIf(eq, instr->environment());
1389 } 1389 }
1390 test_value = - divisor - 1; 1390 test_value = - divisor - 1;
1391 power = WhichPowerOf2(-divisor); 1391 power = WhichPowerOf2(-divisor);
1392 } 1392 }
1393 1393
1394 if (test_value != 0) { 1394 if (test_value != 0) {
1395 if (instr->hydrogen()->CheckFlag( 1395 if (instr->hydrogen()->CheckFlag(
1396 HInstruction::kAllUsesTruncatingToInt32)) { 1396 HInstruction::kAllUsesTruncatingToInt32)) {
1397 Label negative, done;
1397 __ cmp(dividend, Operand(0)); 1398 __ cmp(dividend, Operand(0));
1399 __ b(lt, &negative);
1400 __ mov(dividend, Operand(dividend, ASR, power));
1401 if (divisor < 0) __ rsb(dividend, dividend, Operand(0));
1402 __ jmp(&done);
1403
1404 __ bind(&negative);
1398 __ rsb(dividend, dividend, Operand(0), LeaveCC, lt); 1405 __ rsb(dividend, dividend, Operand(0), LeaveCC, lt);
1399 __ mov(dividend, Operand(dividend, ASR, power)); 1406 __ mov(dividend, Operand(dividend, ASR, power));
1400 if (divisor > 0) __ rsb(dividend, dividend, Operand(0), LeaveCC, lt); 1407 if (divisor > 0) __ rsb(dividend, dividend, Operand(0));
1408 __ bind(&done);
1401 return; // Don't fall through to "__ rsb" below. 1409 return; // Don't fall through to "__ rsb" below.
1402 } else { 1410 } else {
1403 // Deoptimize if remainder is not 0. 1411 // Deoptimize if remainder is not 0.
1404 __ tst(dividend, Operand(test_value)); 1412 __ tst(dividend, Operand(test_value));
1405 DeoptimizeIf(ne, instr->environment()); 1413 DeoptimizeIf(ne, instr->environment());
1406 __ mov(dividend, Operand(dividend, ASR, power)); 1414 __ mov(dividend, Operand(dividend, ASR, power));
1407 } 1415 }
1408 } 1416 }
1409 if (divisor < 0) __ rsb(dividend, dividend, Operand(0)); 1417 if (divisor < 0) __ rsb(dividend, dividend, Operand(0));
1410 1418
(...skipping 4364 matching lines...) Expand 10 before | Expand all | Expand 10 after
5775 __ sub(scratch, result, Operand::PointerOffsetFromSmiKey(index)); 5783 __ sub(scratch, result, Operand::PointerOffsetFromSmiKey(index));
5776 __ ldr(result, FieldMemOperand(scratch, 5784 __ ldr(result, FieldMemOperand(scratch,
5777 FixedArray::kHeaderSize - kPointerSize)); 5785 FixedArray::kHeaderSize - kPointerSize));
5778 __ bind(&done); 5786 __ bind(&done);
5779 } 5787 }
5780 5788
5781 5789
5782 #undef __ 5790 #undef __
5783 5791
5784 } } // namespace v8::internal 5792 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/ia32/lithium-codegen-ia32.cc » ('j') | test/mjsunit/shift-for-integer-div.js » ('J')

Powered by Google App Engine
This is Rietveld 408576698