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

Unified Diff: src/code-stubs.cc

Issue 2138633002: [turbofan] Introduce CheckedInt32Div and CheckedInt32Mod operators. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Comments Created 4 years, 5 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/code-stub-assembler.cc ('k') | src/compiler/code-assembler.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/code-stubs.cc
diff --git a/src/code-stubs.cc b/src/code-stubs.cc
index ed64ea58a1d6831f3482206efcb4b88b0600f36a..f4ec29b65c98dd1c71807a0b2547b9eb3695ee1c 100644
--- a/src/code-stubs.cc
+++ b/src/code-stubs.cc
@@ -1432,6 +1432,9 @@ compiler::Node* ModulusStub::Generate(CodeStubAssembler* assembler,
typedef CodeStubAssembler::Label Label;
typedef CodeStubAssembler::Variable Variable;
+ Variable var_result(assembler, MachineRepresentation::kTagged);
+ Label return_result(assembler, &var_result);
+
// Shared entry point for floating point modulus.
Label do_fmod(assembler);
Variable var_dividend_float64(assembler, MachineRepresentation::kFloat64),
@@ -1465,9 +1468,9 @@ compiler::Node* ModulusStub::Generate(CodeStubAssembler* assembler,
assembler->Bind(&divisor_is_smi);
{
- var_dividend_float64.Bind(assembler->SmiToFloat64(dividend));
- var_divisor_float64.Bind(assembler->SmiToFloat64(divisor));
- assembler->Goto(&do_fmod);
+ // Compute the modulus of two Smis.
+ var_result.Bind(assembler->SmiMod(dividend, divisor));
+ assembler->Goto(&return_result);
}
assembler->Bind(&divisor_is_not_smi);
@@ -1571,9 +1574,12 @@ compiler::Node* ModulusStub::Generate(CodeStubAssembler* assembler,
{
Node* value = assembler->Float64Mod(var_dividend_float64.value(),
var_divisor_float64.value());
- Node* result = assembler->ChangeFloat64ToTagged(value);
- return result;
+ var_result.Bind(assembler->ChangeFloat64ToTagged(value));
+ assembler->Goto(&return_result);
}
+
+ assembler->Bind(&return_result);
+ return var_result.value();
}
// static
« no previous file with comments | « src/code-stub-assembler.cc ('k') | src/compiler/code-assembler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698