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

Issue 23604024: Fix a compiler bug caused by Utils::IsPowerOfTwo treating zero as a power of two. (Closed)

Created:
7 years, 3 months ago by Florian Schneider
Modified:
7 years, 3 months ago
CC:
reviews_dartlang.org, vm-dev_dartlang.org
Visibility:
Public.

Description

Fix a compiler bug caused by Utils::IsPowerOfTwo treating zero as a power of two. The IsPowerOfTwo function is used together with ShiftForPowerOfTwo. Both function do not work with zero. This caused the optimizing compiler to generate invalid code for the expression x ? 0 : 0 where it assumed that if one of the constants is a power-of-two, it can be computed by (1 << n). We check for 0 in a number of places, but instead I decided to fix Utils::IsPowerOfTwo itself and remove unnecessary checks for the zero case. TEST=tests/language/vm/if_conversion_vm_test.dart, runtime/vm/utils_test.cc R=kmillikin@google.com Committed: https://code.google.com/p/dart/source/detail?r=27033

Patch Set 1 #

Patch Set 2 : #

Unified diffs Side-by-side diffs Delta from patch set Stats (+13 lines, -12 lines) Patch
M runtime/platform/utils.h View 1 chunk +1 line, -1 line 0 comments Download
M runtime/vm/flow_graph_optimizer.cc View 1 chunk +1 line, -1 line 0 comments Download
M runtime/vm/intermediate_language.cc View 1 chunk +0 lines, -1 line 0 comments Download
M runtime/vm/intermediate_language_arm.cc View 1 chunk +1 line, -1 line 0 comments Download
M runtime/vm/intermediate_language_ia32.cc View 1 chunk +1 line, -1 line 0 comments Download
M runtime/vm/intermediate_language_mips.cc View 1 chunk +1 line, -1 line 0 comments Download
M runtime/vm/intermediate_language_x64.cc View 1 chunk +1 line, -1 line 0 comments Download
M runtime/vm/utils_test.cc View 4 chunks +1 line, -5 lines 0 comments Download
M tests/language/vm/if_conversion_vm_test.dart View 1 3 chunks +6 lines, -0 lines 0 comments Download

Messages

Total messages: 3 (0 generated)
Florian Schneider
7 years, 3 months ago (2013-09-02 17:28:02 UTC) #1
Kevin Millikin (Google)
LGTM.
7 years, 3 months ago (2013-09-03 08:11:42 UTC) #2
Florian Schneider
7 years, 3 months ago (2013-09-03 09:29:04 UTC) #3
Message was sent while issue was closed.
Committed patchset #2 manually as r27033 (presubmit successful).

Powered by Google App Engine
This is Rietveld 408576698