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

Issue 23717039: Tweak the Better{Left,Right}Operand() heuristic

Created:
7 years, 3 months ago by weiliang.lin2
Modified:
6 years, 4 months ago
CC:
v8-dev
Base URL:
git://github.com/v8/v8.git@master
Visibility:
Public.

Description

Seems a bit complicated 1. only double constant is not enough for double instructions to place in right operand. double constant can't be directly inlined in instruction. But if double constant usecount is more than 1, it would be better not to clobber it. 2. Simply check the (a = a + b) and (a = b + a) inside a loop just as the mentioned benchmark. At each case, we'd better place the "a" operand in the left operand. General benchmarks(octane,sunspider,kraken) measurement shows that the new heuristic does not have measurable negative impact. BUG=

Patch Set 1 #

Patch Set 2 : Tune Better{Left,Right}Operand() heuristic #

Total comments: 1
Unified diffs Side-by-side diffs Delta from patch set Stats (+20 lines, -2 lines) Patch
M src/hydrogen-instructions.h View 1 2 chunks +12 lines, -2 lines 1 comment Download
M src/hydrogen-instructions.cc View 1 1 chunk +8 lines, -0 lines 0 comments Download

Messages

Total messages: 7 (0 generated)
weiliang.lin2
7 years, 3 months ago (2013-09-09 14:35:52 UTC) #1
Benedikt Meurer
What is the benefit?
7 years, 3 months ago (2013-09-09 14:39:02 UTC) #2
weiliang.lin2
On 2013/09/09 14:39:02, Benedikt Meurer wrote: > What is the benefit? Avoid unnecessary register move. ...
7 years, 3 months ago (2013-09-09 14:49:43 UTC) #3
Jakob Kummerow
This does not lgtm. It is very unintuitive why Double vs. Int32 representation would have ...
7 years, 3 months ago (2013-09-09 19:08:22 UTC) #4
weiliang.lin2
On 2013/09/09 19:08:22, Jakob wrote: > This does not lgtm. It is very unintuitive why ...
7 years, 3 months ago (2013-09-10 14:50:26 UTC) #5
weiliang.lin2
A new fix direction based on comments. Please have a review. Thanks
7 years, 3 months ago (2013-09-11 12:23:24 UTC) #6
haitao.feng
6 years, 7 months ago (2014-05-15 05:56:20 UTC) #7
https://codereview.chromium.org/23717039/diff/8001/src/hydrogen-instructions.h
File src/hydrogen-instructions.h (left):

https://codereview.chromium.org/23717039/diff/8001/src/hydrogen-instructions....
src/hydrogen-instructions.h:3550: 
How about writing codes in this way?
-    if (left()->IsConstant()) return true;
-    if (right()->IsConstant()) return false;
+    if (left()->IsConstant() && left()->EmitAtUses()) return true;
+    if (right()->IsConstant() && right()->EmitAtUses()) return false;
+
+    // If destination is one operand of the phi node, they might be allocated
+    // to the same register by hinting.
+    if (left()->IsPhi()) {
+      HPhi* phi = HPhi::cast(left());
+      for (int i = 0; i < phi->OperandCount(); i++) {
+        if (phi->OperandAt(i) == this) return false;
+      }
+    } else if (right()->IsPhi()) {
+      HPhi* phi = HPhi::cast(right());
+      for (int i = 0; i < phi->OperandCount(); i++) {
+        if (phi->OperandAt(i) == this) return true;
+      }
+    }

Powered by Google App Engine
This is Rietveld 408576698