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

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

Issue 233013004: Version 3.25.28.12 (merged r20544, r20645, r20664, r20553) (Closed) Base URL: https://v8.googlecode.com/svn/branches/3.25
Patch Set: Created 6 years, 8 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 | « src/ia32/lithium-codegen-ia32.cc ('k') | 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 2012 the V8 project authors. All rights reserved.7 1 // Copyright 2012 the V8 project authors. All rights reserved.7
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 1313 matching lines...) Expand 10 before | Expand all | Expand 10 after
1324 } 1324 }
1325 1325
1326 // If the divisor is negative, we have to negate and handle edge cases. 1326 // If the divisor is negative, we have to negate and handle edge cases.
1327 if (instr->hydrogen()->CheckFlag(HValue::kLeftCanBeMinInt)) { 1327 if (instr->hydrogen()->CheckFlag(HValue::kLeftCanBeMinInt)) {
1328 __ Move(scratch, dividend); 1328 __ Move(scratch, dividend);
1329 } 1329 }
1330 __ Subu(result, zero_reg, dividend); 1330 __ Subu(result, zero_reg, dividend);
1331 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) { 1331 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) {
1332 DeoptimizeIf(eq, instr->environment(), result, Operand(zero_reg)); 1332 DeoptimizeIf(eq, instr->environment(), result, Operand(zero_reg));
1333 } 1333 }
1334 if (instr->hydrogen()->CheckFlag(HValue::kLeftCanBeMinInt)) { 1334
1335 // Note that we could emit branch-free code, but that would need one more 1335 // If the negation could not overflow, simply shifting is OK.
1336 // register. 1336 if (!instr->hydrogen()->CheckFlag(HValue::kLeftCanBeMinInt)) {
1337 __ Xor(at, scratch, result);
1338 if (divisor == -1) {
1339 DeoptimizeIf(ge, instr->environment(), at, Operand(zero_reg));
1340 __ sra(result, dividend, shift);
1341 } else {
1342 Label no_overflow, done;
1343 __ Branch(&no_overflow, lt, at, Operand(zero_reg));
1344 __ li(result, Operand(kMinInt / divisor));
1345 __ Branch(&done);
1346 __ bind(&no_overflow);
1347 __ sra(result, dividend, shift);
1348 __ bind(&done);
1349 }
1350 } else {
1351 __ sra(result, dividend, shift); 1337 __ sra(result, dividend, shift);
1338 return;
1352 } 1339 }
1340
1341 // Dividing by -1 is basically negation, unless we overflow.
1342 __ Xor(at, scratch, result);
1343 if (divisor == -1) {
1344 DeoptimizeIf(ge, instr->environment(), at, Operand(zero_reg));
1345 return;
1346 }
1347
1348 Label no_overflow, done;
1349 __ Branch(&no_overflow, lt, at, Operand(zero_reg));
1350 __ li(result, Operand(kMinInt / divisor));
1351 __ Branch(&done);
1352 __ bind(&no_overflow);
1353 __ sra(result, dividend, shift);
1354 __ bind(&done);
1353 } 1355 }
1354 1356
1355 1357
1356 void LCodeGen::DoFlooringDivByConstI(LFlooringDivByConstI* instr) { 1358 void LCodeGen::DoFlooringDivByConstI(LFlooringDivByConstI* instr) {
1357 Register dividend = ToRegister(instr->dividend()); 1359 Register dividend = ToRegister(instr->dividend());
1358 int32_t divisor = instr->divisor(); 1360 int32_t divisor = instr->divisor();
1359 Register result = ToRegister(instr->result()); 1361 Register result = ToRegister(instr->result());
1360 ASSERT(!dividend.is(result)); 1362 ASSERT(!dividend.is(result));
1361 1363
1362 if (divisor == 0) { 1364 if (divisor == 0) {
(...skipping 4452 matching lines...) Expand 10 before | Expand all | Expand 10 after
5815 __ Subu(scratch, result, scratch); 5817 __ Subu(scratch, result, scratch);
5816 __ lw(result, FieldMemOperand(scratch, 5818 __ lw(result, FieldMemOperand(scratch,
5817 FixedArray::kHeaderSize - kPointerSize)); 5819 FixedArray::kHeaderSize - kPointerSize));
5818 __ bind(&done); 5820 __ bind(&done);
5819 } 5821 }
5820 5822
5821 5823
5822 #undef __ 5824 #undef __
5823 5825
5824 } } // namespace v8::internal 5826 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/ia32/lithium-codegen-ia32.cc ('k') | src/version.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698