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

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

Issue 22491002: MIPS: Fix Sunspider 1.0/crypto-aes. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
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 | Annotate | Revision Log
« no previous file with comments | « no previous file | 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 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 1039 matching lines...) Expand 10 before | Expand all | Expand 10 after
1050 // Record the address of the first unknown OSR value as the place to enter. 1050 // Record the address of the first unknown OSR value as the place to enter.
1051 if (osr_pc_offset_ == -1) osr_pc_offset_ = masm()->pc_offset(); 1051 if (osr_pc_offset_ == -1) osr_pc_offset_ = masm()->pc_offset();
1052 } 1052 }
1053 1053
1054 1054
1055 void LCodeGen::DoModI(LModI* instr) { 1055 void LCodeGen::DoModI(LModI* instr) {
1056 HMod* hmod = instr->hydrogen(); 1056 HMod* hmod = instr->hydrogen();
1057 HValue* left = hmod->left(); 1057 HValue* left = hmod->left();
1058 HValue* right = hmod->right(); 1058 HValue* right = hmod->right();
1059 if (hmod->HasPowerOf2Divisor()) { 1059 if (hmod->HasPowerOf2Divisor()) {
1060 const Register scratch = scratch0();
1061 const Register left_reg = ToRegister(instr->left()); 1060 const Register left_reg = ToRegister(instr->left());
1062 ASSERT(!left_reg.is(scratch));
1063 const Register result_reg = ToRegister(instr->result()); 1061 const Register result_reg = ToRegister(instr->result());
1064 1062
1065 // Note: The code below even works when right contains kMinInt. 1063 // Note: The code below even works when right contains kMinInt.
1066 int32_t divisor = Abs(right->GetInteger32Constant()); 1064 int32_t divisor = Abs(right->GetInteger32Constant());
1067 1065
1068 __ mov(scratch, left_reg);
1069
1070 Label left_is_not_negative, done; 1066 Label left_is_not_negative, done;
1071 if (left->CanBeNegative()) { 1067 if (left->CanBeNegative()) {
1072 __ Branch(USE_DELAY_SLOT, &left_is_not_negative, 1068 __ Branch(left_reg.is(result_reg) ? PROTECT : USE_DELAY_SLOT,
1073 ge, left_reg, Operand(zero_reg)); 1069 &left_is_not_negative, ge, left_reg, Operand(zero_reg));
1074 __ subu(result_reg, zero_reg, left_reg); 1070 __ subu(result_reg, zero_reg, left_reg);
1075 __ And(result_reg, result_reg, divisor - 1); 1071 __ And(result_reg, result_reg, divisor - 1);
1076 if (hmod->CheckFlag(HValue::kBailoutOnMinusZero)) { 1072 if (hmod->CheckFlag(HValue::kBailoutOnMinusZero)) {
1077 DeoptimizeIf(eq, instr->environment(), result_reg, Operand(zero_reg)); 1073 DeoptimizeIf(eq, instr->environment(), result_reg, Operand(zero_reg));
1078 } 1074 }
1079 __ Branch(USE_DELAY_SLOT, &done); 1075 __ Branch(USE_DELAY_SLOT, &done);
1080 __ subu(result_reg, zero_reg, result_reg); 1076 __ subu(result_reg, zero_reg, result_reg);
1081 } 1077 }
1082 1078
1083 __ bind(&left_is_not_negative); 1079 __ bind(&left_is_not_negative);
1084 __ And(result_reg, scratch, divisor - 1); 1080 __ And(result_reg, left_reg, divisor - 1);
1085 __ bind(&done); 1081 __ bind(&done);
1086 1082
1087 } else if (hmod->fixed_right_arg().has_value) { 1083 } else if (hmod->fixed_right_arg().has_value) {
1088 const Register scratch = scratch0();
1089 const Register left_reg = ToRegister(instr->left()); 1084 const Register left_reg = ToRegister(instr->left());
1090 const Register result_reg = ToRegister(instr->result()); 1085 const Register result_reg = ToRegister(instr->result());
1091 1086 const Register right_reg = ToRegister(instr->right());
1092 Register right_reg = EmitLoadRegister(instr->right(), scratch);
1093 1087
1094 int32_t divisor = hmod->fixed_right_arg().value; 1088 int32_t divisor = hmod->fixed_right_arg().value;
1095 ASSERT(IsPowerOf2(divisor)); 1089 ASSERT(IsPowerOf2(divisor));
1096 1090
1097 // Check if our assumption of a fixed right operand still holds. 1091 // Check if our assumption of a fixed right operand still holds.
1098 DeoptimizeIf(ne, instr->environment(), right_reg, Operand(divisor)); 1092 DeoptimizeIf(ne, instr->environment(), right_reg, Operand(divisor));
1099 1093
1100 Label left_is_not_negative, done; 1094 Label left_is_not_negative, done;
1101 if (left->CanBeNegative()) { 1095 if (left->CanBeNegative()) {
1102 __ Branch(USE_DELAY_SLOT, &left_is_not_negative, 1096 __ Branch(left_reg.is(result_reg) ? PROTECT : USE_DELAY_SLOT,
1103 ge, left_reg, Operand(zero_reg)); 1097 &left_is_not_negative, ge, left_reg, Operand(zero_reg));
1104 __ subu(result_reg, zero_reg, left_reg); 1098 __ subu(result_reg, zero_reg, left_reg);
1105 __ And(result_reg, result_reg, divisor - 1); 1099 __ And(result_reg, result_reg, divisor - 1);
1106 if (hmod->CheckFlag(HValue::kBailoutOnMinusZero)) { 1100 if (hmod->CheckFlag(HValue::kBailoutOnMinusZero)) {
1107 DeoptimizeIf(eq, instr->environment(), result_reg, Operand(zero_reg)); 1101 DeoptimizeIf(eq, instr->environment(), result_reg, Operand(zero_reg));
1108 } 1102 }
1109 __ Branch(USE_DELAY_SLOT, &done); 1103 __ Branch(USE_DELAY_SLOT, &done);
1110 __ subu(result_reg, zero_reg, result_reg); 1104 __ subu(result_reg, zero_reg, result_reg);
1111 } 1105 }
1112 1106
1113 __ bind(&left_is_not_negative); 1107 __ bind(&left_is_not_negative);
(...skipping 4738 matching lines...) Expand 10 before | Expand all | Expand 10 after
5852 __ Subu(scratch, result, scratch); 5846 __ Subu(scratch, result, scratch);
5853 __ lw(result, FieldMemOperand(scratch, 5847 __ lw(result, FieldMemOperand(scratch,
5854 FixedArray::kHeaderSize - kPointerSize)); 5848 FixedArray::kHeaderSize - kPointerSize));
5855 __ bind(&done); 5849 __ bind(&done);
5856 } 5850 }
5857 5851
5858 5852
5859 #undef __ 5853 #undef __
5860 5854
5861 } } // namespace v8::internal 5855 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698