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

Unified Diff: src/hydrogen-instructions.h

Issue 528993002: First step to cleanup the power-of-2 mess. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: clang-format Created 6 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/heap/spaces.cc ('k') | src/ia32/assembler-ia32.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/hydrogen-instructions.h
diff --git a/src/hydrogen-instructions.h b/src/hydrogen-instructions.h
index 5ddf6c584b507cdb19fa52b47f6c0f1e1f48eaf0..d866630b19ad944c9deb4201bdc52eda49d310ee 100644
--- a/src/hydrogen-instructions.h
+++ b/src/hydrogen-instructions.h
@@ -8,6 +8,7 @@
#include "src/v8.h"
#include "src/allocation.h"
+#include "src/base/bits.h"
#include "src/code-stubs.h"
#include "src/conversions.h"
#include "src/data-flow.h"
@@ -3845,7 +3846,10 @@ class HBinaryOperation : public HTemplateInstruction<3> {
bool RightIsPowerOf2() {
if (!right()->IsInteger32Constant()) return false;
int32_t value = right()->GetInteger32Constant();
- return IsPowerOf2(value) || IsPowerOf2(-value);
+ if (value < 0) {
+ return base::bits::IsPowerOfTwo32(static_cast<uint32_t>(-value));
+ }
+ return base::bits::IsPowerOfTwo32(static_cast<uint32_t>(value));
}
DECLARE_ABSTRACT_INSTRUCTION(BinaryOperation)
« no previous file with comments | « src/heap/spaces.cc ('k') | src/ia32/assembler-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698