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

Unified Diff: src/compiler/wasm-compiler.cc

Issue 2413343002: [wasm] Use branch hint for the -1 check in I(32|64)Div. (Closed)
Patch Set: Created 4 years, 2 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/wasm-compiler.cc
diff --git a/src/compiler/wasm-compiler.cc b/src/compiler/wasm-compiler.cc
index 4392896c644b8796b013903a81c22a5804f71e5b..5813bcb4ab285dbed1244f5bfa965abd0d0fe798 100644
--- a/src/compiler/wasm-compiler.cc
+++ b/src/compiler/wasm-compiler.cc
@@ -1796,11 +1796,13 @@ Node* WasmGraphBuilder::BuildI32DivS(Node* left, Node* right,
MachineOperatorBuilder* m = jsgraph()->machine();
trap_->ZeroCheck32(wasm::kTrapDivByZero, right, position);
Node* before = *control_;
- Node* denom_is_m1;
- Node* denom_is_not_m1;
- Branch(
- graph()->NewNode(m->Word32Equal(), right, jsgraph()->Int32Constant(-1)),
- &denom_is_m1, &denom_is_not_m1);
+ Node* is_denom_m1 =
titzer 2016/10/17 13:44:16 Can you add a branch hint to the old method so tha
+ graph()->NewNode(m->Word32Equal(), right, jsgraph()->Int32Constant(-1));
+ Node* branch = graph()->NewNode(
+ jsgraph()->common()->Branch(BranchHint::kFalse), is_denom_m1, *control_);
+ Node* denom_is_m1 = graph()->NewNode(jsgraph()->common()->IfTrue(), branch);
+ Node* denom_is_not_m1 =
+ graph()->NewNode(jsgraph()->common()->IfFalse(), branch);
*control_ = denom_is_m1;
trap_->TrapIfEq32(wasm::kTrapDivUnrepresentable, left, kMinInt, position);
if (*control_ != denom_is_m1) {
@@ -1931,18 +1933,21 @@ Node* WasmGraphBuilder::BuildI32AsmjsRemU(Node* left, Node* right) {
Node* WasmGraphBuilder::BuildI64DivS(Node* left, Node* right,
wasm::WasmCodePosition position) {
- if (jsgraph()->machine()->Is32()) {
+ MachineOperatorBuilder* m = jsgraph()->machine();
+ if (m->Is32()) {
return BuildDiv64Call(
left, right, ExternalReference::wasm_int64_div(jsgraph()->isolate()),
MachineType::Int64(), wasm::kTrapDivByZero, position);
}
trap_->ZeroCheck64(wasm::kTrapDivByZero, right, position);
Node* before = *control_;
- Node* denom_is_m1;
- Node* denom_is_not_m1;
- Branch(graph()->NewNode(jsgraph()->machine()->Word64Equal(), right,
- jsgraph()->Int64Constant(-1)),
- &denom_is_m1, &denom_is_not_m1);
+ Node* is_denom_m1 =
+ graph()->NewNode(m->Word64Equal(), right, jsgraph()->Int64Constant(-1));
+ Node* branch = graph()->NewNode(
+ jsgraph()->common()->Branch(BranchHint::kFalse), is_denom_m1, *control_);
+ Node* denom_is_m1 = graph()->NewNode(jsgraph()->common()->IfTrue(), branch);
+ Node* denom_is_not_m1 =
+ graph()->NewNode(jsgraph()->common()->IfFalse(), branch);
*control_ = denom_is_m1;
trap_->TrapIfEq64(wasm::kTrapDivUnrepresentable, left,
std::numeric_limits<int64_t>::min(), position);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698