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

Unified Diff: src/compiler/code-stub-assembler.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/compiler/code-stub-assembler.h ('k') | src/interpreter/interpreter.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/code-stub-assembler.cc
diff --git a/src/compiler/code-stub-assembler.cc b/src/compiler/code-stub-assembler.cc
index 772a1bf0c67a2ca19442428abca3743a88566ae1..3f52d21b5532d90e34092c6a1e9ee8c3b4b87d9a 100644
--- a/src/compiler/code-stub-assembler.cc
+++ b/src/compiler/code-stub-assembler.cc
@@ -883,6 +883,41 @@ Node* CodeStubAssembler::ChangeInt32ToTagged(Node* value) {
return var_result.value();
}
+Node* CodeStubAssembler::ChangeUint32ToTagged(Node* value) {
+ Label if_overflow(this, Label::kDeferred), if_not_overflow(this),
+ if_join(this);
+ Variable var_result(this, MachineRepresentation::kTagged);
+ // If {value} > 2^31 - 1, we need to store it in a HeapNumber.
+ Branch(Int32LessThan(value, Int32Constant(0)), &if_overflow,
+ &if_not_overflow);
+ Bind(&if_not_overflow);
+ {
+ if (raw_assembler_->machine()->Is64()) {
+ var_result.Bind(SmiTag(ChangeUint32ToUint64(value)));
+ } else {
+ // If tagging {value} results in an overflow, we need to use a HeapNumber
+ // to represent it.
+ Node* pair = Int32AddWithOverflow(value, value);
+ Node* overflow = Projection(1, pair);
+ GotoIf(overflow, &if_overflow);
+
+ Node* result = Projection(0, pair);
+ var_result.Bind(result);
+ }
+ }
+ Goto(&if_join);
+
+ Bind(&if_overflow);
+ {
+ Node* float64_value = ChangeUint32ToFloat64(value);
+ var_result.Bind(AllocateHeapNumberWithValue(float64_value));
+ }
+ Goto(&if_join);
+
+ Bind(&if_join);
+ return var_result.value();
+}
+
Node* CodeStubAssembler::TruncateTaggedToFloat64(Node* context, Node* value) {
// We might need to loop once due to ToNumber conversion.
Variable var_value(this, MachineRepresentation::kTagged),
« no previous file with comments | « src/compiler/code-stub-assembler.h ('k') | src/interpreter/interpreter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698