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

Unified Diff: src/builtins/builtins-number.cc

Issue 2415133002: [stubs] Gets rid of the Smi(Add/Sub)WithOverflow macros. (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 | src/code-stub-assembler.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/builtins/builtins-number.cc
diff --git a/src/builtins/builtins-number.cc b/src/builtins/builtins-number.cc
index 0b95f053c3945b737760e2b5cfc3060c869624a3..6cfc37b5602e400a8b17742b0b3c2f25df68abe2 100644
--- a/src/builtins/builtins-number.cc
+++ b/src/builtins/builtins-number.cc
@@ -524,7 +524,9 @@ void Builtins::Generate_Add(CodeStubAssembler* assembler) {
assembler->Bind(&if_rhsissmi);
{
// Try fast Smi addition first.
- Node* pair = assembler->SmiAddWithOverflow(lhs, rhs);
+ Node* pair = assembler->IntPtrAddWithOverflow(
+ assembler->BitcastTaggedToWord(lhs),
+ assembler->BitcastTaggedToWord(rhs));
Node* overflow = assembler->Projection(1, pair);
// Check if the Smi additon overflowed.
@@ -539,7 +541,8 @@ void Builtins::Generate_Add(CodeStubAssembler* assembler) {
}
assembler->Bind(&if_notoverflow);
- var_result.Bind(assembler->Projection(0, pair));
+ var_result.Bind(assembler->BitcastWordToTaggedSigned(
+ assembler->Projection(0, pair)));
assembler->Goto(&end);
}
@@ -886,7 +889,9 @@ void Builtins::Generate_Subtract(CodeStubAssembler* assembler) {
assembler->Bind(&if_rhsissmi);
{
// Try a fast Smi subtraction first.
- Node* pair = assembler->SmiSubWithOverflow(lhs, rhs);
+ Node* pair = assembler->IntPtrSubWithOverflow(
+ assembler->BitcastTaggedToWord(lhs),
+ assembler->BitcastTaggedToWord(rhs));
Node* overflow = assembler->Projection(1, pair);
// Check if the Smi subtraction overflowed.
@@ -902,7 +907,8 @@ void Builtins::Generate_Subtract(CodeStubAssembler* assembler) {
}
assembler->Bind(&if_notoverflow);
- var_result.Bind(assembler->Projection(0, pair));
+ var_result.Bind(assembler->BitcastWordToTaggedSigned(
+ assembler->Projection(0, pair)));
assembler->Goto(&end);
}
« no previous file with comments | « no previous file | src/code-stub-assembler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698