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

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

Issue 6673064: Fix incorrect assumption on bit-and on ARM (Closed) Base URL: http://v8.googlecode.com/svn/branches/2.5/
Patch Set: Created 9 years, 9 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 | « no previous file | src/version.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 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 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 1132 matching lines...) Expand 10 before | Expand all | Expand 10 after
1143 case Token::SHL: 1143 case Token::SHL:
1144 ASSERT(!reversed_); 1144 ASSERT(!reversed_);
1145 if (shift_value != 0) { 1145 if (shift_value != 0) {
1146 __ mov(int32, Operand(int32, LSL, shift_value)); 1146 __ mov(int32, Operand(int32, LSL, shift_value));
1147 } 1147 }
1148 break; 1148 break;
1149 default: UNREACHABLE(); 1149 default: UNREACHABLE();
1150 } 1150 }
1151 // Check that the *signed* result fits in a smi. Not necessary for AND, SAR 1151 // Check that the *signed* result fits in a smi. Not necessary for AND, SAR
1152 // if the shift if more than 0 or SHR if the shit is more than 1. 1152 // if the shift if more than 0 or SHR if the shit is more than 1.
1153 if (!( (op_ == Token::AND) || 1153 if (!( (op_ == Token::AND && value_ >= 0) ||
1154 ((op_ == Token::SAR) && (shift_value > 0)) || 1154 ((op_ == Token::SAR) && (shift_value > 0)) ||
1155 ((op_ == Token::SHR) && (shift_value > 1)))) { 1155 ((op_ == Token::SHR) && (shift_value > 1)))) {
1156 __ add(r3, int32, Operand(0x40000000), SetCC); 1156 __ add(r3, int32, Operand(0x40000000), SetCC);
1157 __ b(mi, &result_not_a_smi); 1157 __ b(mi, &result_not_a_smi);
1158 } 1158 }
1159 __ mov(tos_register_, Operand(int32, LSL, kSmiTagSize)); 1159 __ mov(tos_register_, Operand(int32, LSL, kSmiTagSize));
1160 Exit(); 1160 Exit();
1161 1161
1162 if (result_not_a_smi.is_linked()) { 1162 if (result_not_a_smi.is_linked()) {
1163 __ bind(&result_not_a_smi); 1163 __ bind(&result_not_a_smi);
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
1404 new DeferredInlineSmiOperation(op, int_value, reversed, mode, tos); 1404 new DeferredInlineSmiOperation(op, int_value, reversed, mode, tos);
1405 __ tst(tos, Operand(kSmiTagMask)); 1405 __ tst(tos, Operand(kSmiTagMask));
1406 deferred->JumpToNonSmiInput(ne); 1406 deferred->JumpToNonSmiInput(ne);
1407 switch (op) { 1407 switch (op) {
1408 case Token::BIT_OR: __ orr(tos, tos, Operand(value)); break; 1408 case Token::BIT_OR: __ orr(tos, tos, Operand(value)); break;
1409 case Token::BIT_XOR: __ eor(tos, tos, Operand(value)); break; 1409 case Token::BIT_XOR: __ eor(tos, tos, Operand(value)); break;
1410 case Token::BIT_AND: __ And(tos, tos, Operand(value)); break; 1410 case Token::BIT_AND: __ And(tos, tos, Operand(value)); break;
1411 default: UNREACHABLE(); 1411 default: UNREACHABLE();
1412 } 1412 }
1413 deferred->BindExit(); 1413 deferred->BindExit();
1414 TypeInfo result_type = 1414 TypeInfo result_type = TypeInfo::Integer32();
1415 (op == Token::BIT_AND) ? TypeInfo::Smi() : TypeInfo::Integer32(); 1415 if (op == Token::BIT_AND && int_value >= 0) {
1416 result_type = TypeInfo::Smi();
1417 }
1416 frame_->EmitPush(tos, result_type); 1418 frame_->EmitPush(tos, result_type);
1417 } 1419 }
1418 break; 1420 break;
1419 } 1421 }
1420 1422
1421 case Token::SHL: 1423 case Token::SHL:
1422 if (reversed) { 1424 if (reversed) {
1423 ASSERT(both_sides_are_smi); 1425 ASSERT(both_sides_are_smi);
1424 int max_shift = 0; 1426 int max_shift = 0;
1425 int max_result = int_value == 0 ? 1 : int_value; 1427 int max_result = int_value == 0 ? 1 : int_value;
(...skipping 6010 matching lines...) Expand 10 before | Expand all | Expand 10 after
7436 BinaryOpIC::GetName(runtime_operands_type_)); 7438 BinaryOpIC::GetName(runtime_operands_type_));
7437 return name_; 7439 return name_;
7438 } 7440 }
7439 7441
7440 7442
7441 #undef __ 7443 #undef __
7442 7444
7443 } } // namespace v8::internal 7445 } } // namespace v8::internal
7444 7446
7445 #endif // V8_TARGET_ARCH_ARM 7447 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « no previous file | src/version.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698