Commit f26c4d2d authored by jgruber's avatar jgruber Committed by Commit bot

[stubs] Add SmiMax and refactor SmiMin to use Select

SmiMax will be used in a follow-up commit.

BUG=

Review-Url: https://codereview.chromium.org/2372543002
Cr-Commit-Position: refs/heads/master@{#39783}
parent 0d1e15d6
......@@ -349,19 +349,12 @@ Node* CodeStubAssembler::SmiLessThanOrEqual(Node* a, Node* b) {
return IntPtrLessThanOrEqual(a, b);
}
Node* CodeStubAssembler::SmiMax(Node* a, Node* b) {
return Select(SmiLessThan(a, b), b, a);
}
Node* CodeStubAssembler::SmiMin(Node* a, Node* b) {
// TODO(bmeurer): Consider using Select once available.
Variable min(this, MachineRepresentation::kTagged);
Label if_a(this), if_b(this), join(this);
BranchIfSmiLessThan(a, b, &if_a, &if_b);
Bind(&if_a);
min.Bind(a);
Goto(&join);
Bind(&if_b);
min.Bind(b);
Goto(&join);
Bind(&join);
return min.value();
return Select(SmiLessThan(a, b), a, b);
}
Node* CodeStubAssembler::SmiMod(Node* a, Node* b) {
......
......@@ -120,6 +120,7 @@ class CodeStubAssembler : public compiler::CodeAssembler {
compiler::Node* SmiAboveOrEqual(compiler::Node* a, compiler::Node* b);
compiler::Node* SmiLessThan(compiler::Node* a, compiler::Node* b);
compiler::Node* SmiLessThanOrEqual(compiler::Node* a, compiler::Node* b);
compiler::Node* SmiMax(compiler::Node* a, compiler::Node* b);
compiler::Node* SmiMin(compiler::Node* a, compiler::Node* b);
// Computes a % b for Smi inputs a and b; result is not necessarily a Smi.
compiler::Node* SmiMod(compiler::Node* a, compiler::Node* b);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment