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

Unified Diff: src/code-stubs.cc

Issue 1881003002: [stubs] Introduce LeftShift, SignedRightShift and UnsignedRightShift stubs. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Update after rollback Created 4 years, 8 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-stubs.h ('k') | src/compiler/code-stub-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 4b6761aa5e658e42621f383faf384f86236a845c..c572164636ef74a31eeaccb565f656cfab7f6f10 100644
--- a/src/code-stubs.cc
+++ b/src/code-stubs.cc
@@ -1542,6 +1542,54 @@ void ModulusStub::GenerateAssembly(
}
}
+void ShiftLeftStub::GenerateAssembly(
+ compiler::CodeStubAssembler* assembler) const {
+ using compiler::Node;
+
+ Node* lhs = assembler->Parameter(0);
+ Node* rhs = assembler->Parameter(1);
+ Node* context = assembler->Parameter(2);
+ Node* lhs_value = assembler->TruncateTaggedToWord32(context, lhs);
+ Node* rhs_value = assembler->TruncateTaggedToWord32(context, rhs);
+ Node* shift_count =
+ assembler->Word32And(rhs_value, assembler->Int32Constant(0x1f));
+ Node* value = assembler->Word32Shl(lhs_value, shift_count);
+ Node* result = assembler->ChangeInt32ToTagged(value);
+ assembler->Return(result);
+}
+
+void ShiftRightStub::GenerateAssembly(
+ compiler::CodeStubAssembler* assembler) const {
+ using compiler::Node;
+
+ Node* lhs = assembler->Parameter(0);
+ Node* rhs = assembler->Parameter(1);
+ Node* context = assembler->Parameter(2);
+ Node* lhs_value = assembler->TruncateTaggedToWord32(context, lhs);
+ Node* rhs_value = assembler->TruncateTaggedToWord32(context, rhs);
+ Node* shift_count =
+ assembler->Word32And(rhs_value, assembler->Int32Constant(0x1f));
+ Node* value = assembler->Word32Sar(lhs_value, shift_count);
+ Node* result = assembler->ChangeInt32ToTagged(value);
+ assembler->Return(result);
+}
+
+void ShiftRightLogicalStub::GenerateAssembly(
+ compiler::CodeStubAssembler* assembler) const {
+ using compiler::Node;
+
+ Node* lhs = assembler->Parameter(0);
+ Node* rhs = assembler->Parameter(1);
+ Node* context = assembler->Parameter(2);
+ Node* lhs_value = assembler->TruncateTaggedToWord32(context, lhs);
+ Node* rhs_value = assembler->TruncateTaggedToWord32(context, rhs);
+ Node* shift_count =
+ assembler->Word32And(rhs_value, assembler->Int32Constant(0x1f));
+ Node* value = assembler->Word32Shr(lhs_value, shift_count);
+ Node* result = assembler->ChangeUint32ToTagged(value);
+ assembler->Return(result);
+}
+
void BitwiseOrStub::GenerateAssembly(
compiler::CodeStubAssembler* assembler) const {
using compiler::Node;
« no previous file with comments | « src/code-stubs.h ('k') | src/compiler/code-stub-assembler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698