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

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: Fix test 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 0a90b9e9251130c1b5fe1d872aa9d3d24f73ef8d..4b84dc093418a691e31ee9d4437a2852ecb5d85d 100644
--- a/src/compiler/code-assembler.cc
+++ b/src/compiler/code-assembler.cc
@@ -87,10 +87,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 +127,52 @@ Node* CodeAssembler::NaNConstant() {
return LoadRoot(Heap::kNanValueRootIndex);
}
+bool CodeAssembler::ToInt32Constant(Node* node, int32_t& out_value) {
+ if (node->opcode() == IrOpcode::kInt32Constant) {
Michael Starzinger 2016/05/19 10:54:21 Can we use an Int32Matcher to do this kind of matc
danno 2016/05/19 11:10:18 Done.
+ out_value = OpParameter<int32_t>(node);
+ return true;
+ }
+
+ if (node->opcode() == IrOpcode::kInt64Constant) {
Michael Starzinger 2016/05/19 10:54:21 Can we use an Int64Matcher (and the IsInRange meth
danno 2016/05/19 11:10:18 Done.
+ int64_t big_value = OpParameter<int64_t>(node);
+ if (big_value <= std::numeric_limits<int32_t>::max() &&
+ big_value >= std::numeric_limits<int32_t>::min()) {
+ out_value = static_cast<int32_t>(big_value);
+ return true;
+ }
+ }
+
+ return false;
+}
+
+bool CodeAssembler::ToInt64Constant(Node* node, int64_t& out_value) {
+ if (node->opcode() == IrOpcode::kInt32Constant) {
Michael Starzinger 2016/05/19 10:54:21 Can we use an Int64Matcher to do this kind of matc
danno 2016/05/19 11:10:18 Done.
+ out_value = OpParameter<int32_t>(node);
+ return true;
+ }
+ if (node->opcode() == IrOpcode::kInt64Constant) {
+ out_value = OpParameter<int64_t>(node);
+ return true;
+ }
+ return false;
+}
+
+bool CodeAssembler::ToIntPtrConstant(Node* node, intptr_t& out_value) {
+ if (kPointerSize == 8) {
Michael Starzinger 2016/05/19 10:54:21 Can we use an IntPtrMatcher to do this kind of mat
danno 2016/05/19 11:10:18 Done.
+ if (node->opcode() == IrOpcode::kInt64Constant) {
+ out_value = OpParameter<intptr_t>(node);
+ return true;
+ }
+ } else {
+ DCHECK_EQ(4, kPointerSize);
+ if (node->opcode() == IrOpcode::kInt32Constant) {
+ out_value = OpParameter<intptr_t>(node);
+ return true;
+ }
+ }
+ return false;
+}
+
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