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

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

Issue 2974953002: Revise assertions and fix bug in the implementation of shifts (Closed)
Patch Set: Created 3 years, 5 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
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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/globals.h" // Needed here to get TARGET_ARCH_ARM. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM.
6 #if defined(TARGET_ARCH_ARM) 6 #if defined(TARGET_ARCH_ARM)
7 7
8 #include "vm/intermediate_language.h" 8 #include "vm/intermediate_language.h"
9 9
10 #include "vm/compiler.h" 10 #include "vm/compiler.h"
(...skipping 6528 matching lines...) Expand 10 before | Expand all | Expand 10 after
6539 6539
6540 Label* deopt = NULL; 6540 Label* deopt = NULL;
6541 if (CanDeoptimize()) { 6541 if (CanDeoptimize()) {
6542 deopt = compiler->AddDeoptStub(deopt_id(), ICData::kDeoptBinaryMintOp); 6542 deopt = compiler->AddDeoptStub(deopt_id(), ICData::kDeoptBinaryMintOp);
6543 } 6543 }
6544 if (locs()->in(1).IsConstant()) { 6544 if (locs()->in(1).IsConstant()) {
6545 // Code for a constant shift amount. 6545 // Code for a constant shift amount.
6546 ASSERT(locs()->in(1).constant().IsSmi()); 6546 ASSERT(locs()->in(1).constant().IsSmi());
6547 const int32_t shift = 6547 const int32_t shift =
6548 reinterpret_cast<int32_t>(locs()->in(1).constant().raw()) >> 1; 6548 reinterpret_cast<int32_t>(locs()->in(1).constant().raw()) >> 1;
6549 // TODO(alexmarkov): revise and uncomment the following assertions 6549 ASSERT(shift >= 0);
6550 // ASSERT(!has_shift_count_check());
6551 // ASSERT(shift >= 0);
6552 switch (op_kind()) { 6550 switch (op_kind()) {
6553 case Token::kSHR: { 6551 case Token::kSHR: {
6554 if (shift < 32) { 6552 if (shift < 32) {
6555 __ Lsl(out_lo, left_hi, Operand(32 - shift)); 6553 __ Lsl(out_lo, left_hi, Operand(32 - shift));
6556 __ orr(out_lo, out_lo, Operand(left_lo, LSR, shift)); 6554 __ orr(out_lo, out_lo, Operand(left_lo, LSR, shift));
6557 __ Asr(out_hi, left_hi, Operand(shift)); 6555 __ Asr(out_hi, left_hi, Operand(shift));
6558 } else { 6556 } else {
6559 if (shift == 32) { 6557 if (shift == 32) {
6560 __ mov(out_lo, Operand(left_hi)); 6558 __ mov(out_lo, Operand(left_hi));
6561 } else if (shift < 64) { 6559 } else if (shift < 64) {
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
6603 UNREACHABLE(); 6601 UNREACHABLE();
6604 } 6602 }
6605 } else { 6603 } else {
6606 // Code for a variable shift amount. 6604 // Code for a variable shift amount.
6607 Register shift = locs()->in(1).reg(); 6605 Register shift = locs()->in(1).reg();
6608 6606
6609 // Untag shift count. 6607 // Untag shift count.
6610 __ SmiUntag(shift); 6608 __ SmiUntag(shift);
6611 6609
6612 // Deopt if shift is larger than 63 or less than 0. 6610 // Deopt if shift is larger than 63 or less than 0.
6613 if (has_shift_count_check()) { 6611 if (!IsShiftCountInRange()) {
6614 __ CompareImmediate(shift, kMintShiftCountLimit); 6612 __ CompareImmediate(shift, kMintShiftCountLimit);
6615 __ b(deopt, HI); 6613 __ b(deopt, HI);
6616 } 6614 }
6617 6615
6618 switch (op_kind()) { 6616 switch (op_kind()) {
6619 case Token::kSHR: { 6617 case Token::kSHR: {
6620 __ rsbs(IP, shift, Operand(32)); 6618 __ rsbs(IP, shift, Operand(32));
6621 __ sub(IP, shift, Operand(32), MI); 6619 __ sub(IP, shift, Operand(32), MI);
6622 __ mov(out_lo, Operand(left_hi, ASR, IP), MI); 6620 __ mov(out_lo, Operand(left_hi, ASR, IP), MI);
6623 __ mov(out_lo, Operand(left_lo, LSR, shift), PL); 6621 __ mov(out_lo, Operand(left_lo, LSR, shift), PL);
(...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after
7152 ASSERT(!compiler->is_optimizing()); 7150 ASSERT(!compiler->is_optimizing());
7153 __ BranchLinkPatchable(*StubCode::DebugStepCheck_entry()); 7151 __ BranchLinkPatchable(*StubCode::DebugStepCheck_entry());
7154 compiler->AddCurrentDescriptor(stub_kind_, deopt_id_, token_pos()); 7152 compiler->AddCurrentDescriptor(stub_kind_, deopt_id_, token_pos());
7155 compiler->RecordSafepoint(locs()); 7153 compiler->RecordSafepoint(locs());
7156 } 7154 }
7157 7155
7158 7156
7159 } // namespace dart 7157 } // namespace dart
7160 7158
7161 #endif // defined TARGET_ARCH_ARM 7159 #endif // defined TARGET_ARCH_ARM
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698