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

Side by Side Diff: src/crankshaft/s390/lithium-codegen-s390.cc

Issue 2639853002: PPC/s390: Check for overflow when SubI IntMin (Closed)
Patch Set: addressed comments Created 3 years, 11 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 | « src/crankshaft/ppc/lithium-codegen-ppc.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // 2 //
3 // Use of this source code is governed by a BSD-style license that can be 3 // Use of this source code is governed by a BSD-style license that can be
4 // found in the LICENSE file. 4 // found in the LICENSE file.
5 5
6 #include "src/crankshaft/s390/lithium-codegen-s390.h" 6 #include "src/crankshaft/s390/lithium-codegen-s390.h"
7 7
8 #include "src/base/bits.h" 8 #include "src/base/bits.h"
9 #include "src/builtins/builtins-constructor.h" 9 #include "src/builtins/builtins-constructor.h"
10 #include "src/code-factory.h" 10 #include "src/code-factory.h"
(...skipping 1664 matching lines...) Expand 10 before | Expand all | Expand 10 after
1675 #if V8_TARGET_ARCH_S390X 1675 #if V8_TARGET_ARCH_S390X
1676 // The overflow detection needs to be tested on the lower 32-bits. 1676 // The overflow detection needs to be tested on the lower 32-bits.
1677 // As a result, on 64-bit, we need to force 32-bit arithmetic operations 1677 // As a result, on 64-bit, we need to force 32-bit arithmetic operations
1678 // to set the CC overflow bit properly. The result is then sign-extended. 1678 // to set the CC overflow bit properly. The result is then sign-extended.
1679 bool checkOverflow = instr->hydrogen()->CheckFlag(HValue::kCanOverflow); 1679 bool checkOverflow = instr->hydrogen()->CheckFlag(HValue::kCanOverflow);
1680 #else 1680 #else
1681 bool checkOverflow = true; 1681 bool checkOverflow = true;
1682 #endif 1682 #endif
1683 1683
1684 if (right->IsConstantOperand()) { 1684 if (right->IsConstantOperand()) {
1685 if (!isInteger || !checkOverflow) 1685 if (!isInteger || !checkOverflow) {
1686 __ SubP(ToRegister(result), ToRegister(left), ToOperand(right)); 1686 __ SubP(ToRegister(result), ToRegister(left), ToOperand(right));
1687 else 1687 } else {
1688 __ Sub32(ToRegister(result), ToRegister(left), ToOperand(right)); 1688 // -(MinInt) will overflow
1689 if (ToInteger32(LConstantOperand::cast(right)) == kMinInt) {
1690 __ Load(scratch0(), ToOperand(right));
1691 __ Sub32(ToRegister(result), ToRegister(left), scratch0());
1692 } else {
1693 __ Sub32(ToRegister(result), ToRegister(left), ToOperand(right));
1694 }
1695 }
1689 } else if (right->IsRegister()) { 1696 } else if (right->IsRegister()) {
1690 if (!isInteger) 1697 if (!isInteger)
1691 __ SubP(ToRegister(result), ToRegister(left), ToRegister(right)); 1698 __ SubP(ToRegister(result), ToRegister(left), ToRegister(right));
1692 else if (!checkOverflow) 1699 else if (!checkOverflow)
1693 __ SubP_ExtendSrc(ToRegister(result), ToRegister(left), 1700 __ SubP_ExtendSrc(ToRegister(result), ToRegister(left),
1694 ToRegister(right)); 1701 ToRegister(right));
1695 else 1702 else
1696 __ Sub32(ToRegister(result), ToRegister(left), ToRegister(right)); 1703 __ Sub32(ToRegister(result), ToRegister(left), ToRegister(right));
1697 } else { 1704 } else {
1698 if (!left->Equals(instr->result())) 1705 if (!left->Equals(instr->result()))
(...skipping 3854 matching lines...) Expand 10 before | Expand all | Expand 10 after
5553 __ LoadP(result, 5560 __ LoadP(result,
5554 FieldMemOperand(scratch, FixedArray::kHeaderSize - kPointerSize)); 5561 FieldMemOperand(scratch, FixedArray::kHeaderSize - kPointerSize));
5555 __ bind(deferred->exit()); 5562 __ bind(deferred->exit());
5556 __ bind(&done); 5563 __ bind(&done);
5557 } 5564 }
5558 5565
5559 #undef __ 5566 #undef __
5560 5567
5561 } // namespace internal 5568 } // namespace internal
5562 } // namespace v8 5569 } // namespace v8
OLDNEW
« no previous file with comments | « src/crankshaft/ppc/lithium-codegen-ppc.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698