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

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

Issue 195793016: Remove uses of CanBeNegative() in HMod. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 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 | « src/hydrogen-instructions.cc ('k') | src/x64/lithium-codegen-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 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 1367 matching lines...) Expand 10 before | Expand all | Expand 10 after
1378 1378
1379 // Theoretically, a variation of the branch-free code for integer division by 1379 // Theoretically, a variation of the branch-free code for integer division by
1380 // a power of 2 (calculating the remainder via an additional multiplication 1380 // a power of 2 (calculating the remainder via an additional multiplication
1381 // (which gets simplified to an 'and') and subtraction) should be faster, and 1381 // (which gets simplified to an 'and') and subtraction) should be faster, and
1382 // this is exactly what GCC and clang emit. Nevertheless, benchmarks seem to 1382 // this is exactly what GCC and clang emit. Nevertheless, benchmarks seem to
1383 // indicate that positive dividends are heavily favored, so the branching 1383 // indicate that positive dividends are heavily favored, so the branching
1384 // version performs better. 1384 // version performs better.
1385 HMod* hmod = instr->hydrogen(); 1385 HMod* hmod = instr->hydrogen();
1386 int32_t mask = divisor < 0 ? -(divisor + 1) : (divisor - 1); 1386 int32_t mask = divisor < 0 ? -(divisor + 1) : (divisor - 1);
1387 Label dividend_is_not_negative, done; 1387 Label dividend_is_not_negative, done;
1388 if (hmod->left()->CanBeNegative()) { 1388 if (hmod->CheckFlag(HValue::kLeftCanBeNegative)) {
1389 __ test(dividend, dividend); 1389 __ test(dividend, dividend);
1390 __ j(not_sign, &dividend_is_not_negative, Label::kNear); 1390 __ j(not_sign, &dividend_is_not_negative, Label::kNear);
1391 // Note that this is correct even for kMinInt operands. 1391 // Note that this is correct even for kMinInt operands.
1392 __ neg(dividend); 1392 __ neg(dividend);
1393 __ and_(dividend, mask); 1393 __ and_(dividend, mask);
1394 __ neg(dividend); 1394 __ neg(dividend);
1395 if (hmod->CheckFlag(HValue::kBailoutOnMinusZero)) { 1395 if (hmod->CheckFlag(HValue::kBailoutOnMinusZero)) {
1396 DeoptimizeIf(zero, instr->environment()); 1396 DeoptimizeIf(zero, instr->environment());
1397 } 1397 }
1398 __ jmp(&done, Label::kNear); 1398 __ jmp(&done, Label::kNear);
(...skipping 4932 matching lines...) Expand 10 before | Expand all | Expand 10 after
6331 FixedArray::kHeaderSize - kPointerSize)); 6331 FixedArray::kHeaderSize - kPointerSize));
6332 __ bind(&done); 6332 __ bind(&done);
6333 } 6333 }
6334 6334
6335 6335
6336 #undef __ 6336 #undef __
6337 6337
6338 } } // namespace v8::internal 6338 } } // namespace v8::internal
6339 6339
6340 #endif // V8_TARGET_ARCH_IA32 6340 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/hydrogen-instructions.cc ('k') | src/x64/lithium-codegen-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698