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

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

Issue 330263002: Eliminate overflow check for non-overflowing smi << operations. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 6 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 | « runtime/vm/intermediate_language_mips.cc ('k') | runtime/vm/intermediate_language_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 #include "vm/intermediate_language.h" 5 #include "vm/intermediate_language.h"
6 #include "vm/unit_test.h" 6 #include "vm/unit_test.h"
7 7
8 namespace dart { 8 namespace dart {
9 9
10 TEST_CASE(InstructionTests) { 10 TEST_CASE(InstructionTests) {
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 RangeBoundary::PositiveInfinity()); 105 RangeBoundary::PositiveInfinity());
106 TEST_RANGE_OP(Range::Shl, -1, 1, 62, 62, 106 TEST_RANGE_OP(Range::Shl, -1, 1, 62, 62,
107 RangeBoundary::NegativeInfinity(), 107 RangeBoundary::NegativeInfinity(),
108 RangeBoundary::PositiveInfinity()); 108 RangeBoundary::PositiveInfinity());
109 } 109 }
110 TEST_RANGE_OP(Range::Shl, 0, 100, 0, 64, 110 TEST_RANGE_OP(Range::Shl, 0, 100, 0, 64,
111 RangeBoundary(0), RangeBoundary::PositiveInfinity()); 111 RangeBoundary(0), RangeBoundary::PositiveInfinity());
112 TEST_RANGE_OP(Range::Shl, -100, 0, 0, 64, 112 TEST_RANGE_OP(Range::Shl, -100, 0, 0, 64,
113 RangeBoundary::NegativeInfinity(), RangeBoundary(0)); 113 RangeBoundary::NegativeInfinity(), RangeBoundary(0));
114 114
115 TEST_RANGE_OP(Range::Shr, -8, 8, 1, 2, RangeBoundary(-4), RangeBoundary(4));
116 TEST_RANGE_OP(Range::Shr, 1, 8, 1, 2, RangeBoundary(0), RangeBoundary(4));
117 TEST_RANGE_OP(Range::Shr, -16, -8, 1, 2,
118 RangeBoundary(-8), RangeBoundary(-2));
119 TEST_RANGE_OP(Range::Shr, 2, 4, -1, 1, RangeBoundary(1), RangeBoundary(4));
120 TEST_RANGE_OP(Range::Shr, kMaxInt64, kMaxInt64, 0, 1,
121 RangeBoundary(kMaxInt64 >> 1), RangeBoundary(kMaxInt64));
122 TEST_RANGE_OP(Range::Shr, kMinInt64, kMinInt64, 0, 1,
123 RangeBoundary(kMinInt64), RangeBoundary(kMinInt64 >> 1));
115 #undef TEST_RANGE_OP 124 #undef TEST_RANGE_OP
116 } 125 }
117 126
118 127
119 TEST_CASE(RangeTestsInfinity) { 128 TEST_CASE(RangeTestsInfinity) {
120 // +/- inf overflowed. 129 // +/- inf overflowed.
121 EXPECT(RangeBoundary::NegativeInfinity().OverflowedSmi()); 130 EXPECT(RangeBoundary::NegativeInfinity().OverflowedSmi());
122 EXPECT(RangeBoundary::PositiveInfinity().OverflowedSmi()); 131 EXPECT(RangeBoundary::PositiveInfinity().OverflowedSmi());
123 132
124 EXPECT(RangeBoundary::NegativeInfinity().OverflowedMint()); 133 EXPECT(RangeBoundary::NegativeInfinity().OverflowedMint());
(...skipping 518 matching lines...) Expand 10 before | Expand all | Expand 10 after
643 RangeBoundary(static_cast<int64_t>(kMaxInt32)), 652 RangeBoundary(static_cast<int64_t>(kMaxInt32)),
644 RangeBoundary::kRangeBoundaryInt64).ConstantValue() == kMaxInt32); 653 RangeBoundary::kRangeBoundaryInt64).ConstantValue() == kMaxInt32);
645 654
646 EXPECT(RangeBoundary::Max( 655 EXPECT(RangeBoundary::Max(
647 RangeBoundary(static_cast<int64_t>(kMaxInt64)), 656 RangeBoundary(static_cast<int64_t>(kMaxInt64)),
648 RangeBoundary(static_cast<int64_t>(kMaxInt32)), 657 RangeBoundary(static_cast<int64_t>(kMaxInt32)),
649 RangeBoundary::kRangeBoundaryInt64).ConstantValue() == kMaxInt64); 658 RangeBoundary::kRangeBoundaryInt64).ConstantValue() == kMaxInt64);
650 } 659 }
651 660
652 } // namespace dart 661 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/intermediate_language_mips.cc ('k') | runtime/vm/intermediate_language_x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698