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

Unified Diff: src/compiler/code-assembler.cc

Issue 1989363004: [turbofan] Add FixedArray peephole optimizations to CodeStubAssembler (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Final review feedback Created 4 years, 7 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-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-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);
}
« no previous file with comments | « src/compiler/code-assembler.h ('k') | src/interpreter/interpreter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698