Index: src/compiler/code-assembler.cc |
diff --git a/src/compiler/code-assembler.cc b/src/compiler/code-assembler.cc |
index 334f5c428095044f6547ef531d12d18f213d8e6b..b9d11af4874366c725dca1f900ff44a12095ec8c 100644 |
--- a/src/compiler/code-assembler.cc |
+++ b/src/compiler/code-assembler.cc |
@@ -10,6 +10,7 @@ |
#include "src/compiler/graph.h" |
#include "src/compiler/instruction-selector.h" |
#include "src/compiler/linkage.h" |
+#include "src/compiler/node-matchers.h" |
#include "src/compiler/pipeline.h" |
#include "src/compiler/raw-machine-assembler.h" |
#include "src/compiler/schedule.h" |
@@ -87,10 +88,14 @@ bool CodeAssembler::IsFloat64RoundTruncateSupported() const { |
return raw_assembler_->machine()->Float64RoundTruncate().IsSupported(); |
} |
-Node* CodeAssembler::Int32Constant(int value) { |
+Node* CodeAssembler::Int32Constant(int32_t value) { |
return raw_assembler_->Int32Constant(value); |
} |
+Node* CodeAssembler::Int64Constant(int64_t value) { |
+ return raw_assembler_->Int64Constant(value); |
+} |
+ |
Node* CodeAssembler::IntPtrConstant(intptr_t value) { |
return raw_assembler_->IntPtrConstant(value); |
} |
@@ -123,6 +128,30 @@ Node* CodeAssembler::NaNConstant() { |
return LoadRoot(Heap::kNanValueRootIndex); |
} |
+bool CodeAssembler::ToInt32Constant(Node* node, int32_t& out_value) { |
+ Int64Matcher m(node); |
+ if (m.HasValue() && |
+ m.IsInRange(std::numeric_limits<int32_t>::min(), |
+ std::numeric_limits<int32_t>::max())) { |
+ out_value = static_cast<int32_t>(m.Value()); |
+ return true; |
+ } |
+ |
+ return false; |
+} |
+ |
+bool CodeAssembler::ToInt64Constant(Node* node, int64_t& out_value) { |
+ Int64Matcher m(node); |
+ if (m.HasValue()) out_value = m.Value(); |
+ return m.HasValue(); |
+} |
+ |
+bool CodeAssembler::ToIntPtrConstant(Node* node, intptr_t& out_value) { |
+ IntPtrMatcher m(node); |
+ if (m.HasValue()) out_value = m.Value(); |
+ return m.HasValue(); |
+} |
+ |
Node* CodeAssembler::Parameter(int value) { |
return raw_assembler_->Parameter(value); |
} |