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

Side by Side 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: 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/compiler/code-assembler.h" 5 #include "src/compiler/code-assembler.h"
6 6
7 #include <ostream> 7 #include <ostream>
8 8
9 #include "src/code-factory.h" 9 #include "src/code-factory.h"
10 #include "src/compiler/graph.h" 10 #include "src/compiler/graph.h"
11 #include "src/compiler/instruction-selector.h" 11 #include "src/compiler/instruction-selector.h"
12 #include "src/compiler/linkage.h" 12 #include "src/compiler/linkage.h"
13 #include "src/compiler/node-matchers.h"
13 #include "src/compiler/pipeline.h" 14 #include "src/compiler/pipeline.h"
14 #include "src/compiler/raw-machine-assembler.h" 15 #include "src/compiler/raw-machine-assembler.h"
15 #include "src/compiler/schedule.h" 16 #include "src/compiler/schedule.h"
16 #include "src/frames.h" 17 #include "src/frames.h"
17 #include "src/interface-descriptors.h" 18 #include "src/interface-descriptors.h"
18 #include "src/interpreter/bytecodes.h" 19 #include "src/interpreter/bytecodes.h"
19 #include "src/machine-type.h" 20 #include "src/machine-type.h"
20 #include "src/macro-assembler.h" 21 #include "src/macro-assembler.h"
21 #include "src/zone.h" 22 #include "src/zone.h"
22 23
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 } 81 }
81 82
82 bool CodeAssembler::IsFloat64RoundDownSupported() const { 83 bool CodeAssembler::IsFloat64RoundDownSupported() const {
83 return raw_assembler_->machine()->Float64RoundDown().IsSupported(); 84 return raw_assembler_->machine()->Float64RoundDown().IsSupported();
84 } 85 }
85 86
86 bool CodeAssembler::IsFloat64RoundTruncateSupported() const { 87 bool CodeAssembler::IsFloat64RoundTruncateSupported() const {
87 return raw_assembler_->machine()->Float64RoundTruncate().IsSupported(); 88 return raw_assembler_->machine()->Float64RoundTruncate().IsSupported();
88 } 89 }
89 90
90 Node* CodeAssembler::Int32Constant(int value) { 91 Node* CodeAssembler::Int32Constant(int32_t value) {
91 return raw_assembler_->Int32Constant(value); 92 return raw_assembler_->Int32Constant(value);
92 } 93 }
93 94
95 Node* CodeAssembler::Int64Constant(int64_t value) {
96 return raw_assembler_->Int64Constant(value);
97 }
98
94 Node* CodeAssembler::IntPtrConstant(intptr_t value) { 99 Node* CodeAssembler::IntPtrConstant(intptr_t value) {
95 return raw_assembler_->IntPtrConstant(value); 100 return raw_assembler_->IntPtrConstant(value);
96 } 101 }
97 102
98 Node* CodeAssembler::NumberConstant(double value) { 103 Node* CodeAssembler::NumberConstant(double value) {
99 return raw_assembler_->NumberConstant(value); 104 return raw_assembler_->NumberConstant(value);
100 } 105 }
101 106
102 Node* CodeAssembler::SmiConstant(Smi* value) { 107 Node* CodeAssembler::SmiConstant(Smi* value) {
103 return IntPtrConstant(bit_cast<intptr_t>(value)); 108 return IntPtrConstant(bit_cast<intptr_t>(value));
(...skipping 12 matching lines...) Expand all
116 } 121 }
117 122
118 Node* CodeAssembler::Float64Constant(double value) { 123 Node* CodeAssembler::Float64Constant(double value) {
119 return raw_assembler_->Float64Constant(value); 124 return raw_assembler_->Float64Constant(value);
120 } 125 }
121 126
122 Node* CodeAssembler::NaNConstant() { 127 Node* CodeAssembler::NaNConstant() {
123 return LoadRoot(Heap::kNanValueRootIndex); 128 return LoadRoot(Heap::kNanValueRootIndex);
124 } 129 }
125 130
131 bool CodeAssembler::ToInt32Constant(Node* node, int32_t& out_value) {
132 Int32Matcher m32(node);
133 if (m32.HasValue()) {
134 out_value = m32.Value();
135 return true;
136 }
137
138 Int64Matcher m64(node);
139 if (m64.HasValue() &&
140 m64.IsInRange(std::numeric_limits<int32_t>::min(),
141 std::numeric_limits<int32_t>::max())) {
142 out_value = static_cast<int32_t>(m64.Value());
143 return true;
144 }
145
146 return false;
147 }
148
149 bool CodeAssembler::ToInt64Constant(Node* node, int64_t& out_value) {
150 Int64Matcher m(node);
151 if (m.HasValue()) out_value = m.Value();
152 return m.HasValue();
153 }
154
155 bool CodeAssembler::ToIntPtrConstant(Node* node, intptr_t& out_value) {
156 IntPtrMatcher m(node);
157 if (m.HasValue()) out_value = m.Value();
158 return m.HasValue();
159 }
160
126 Node* CodeAssembler::Parameter(int value) { 161 Node* CodeAssembler::Parameter(int value) {
127 return raw_assembler_->Parameter(value); 162 return raw_assembler_->Parameter(value);
128 } 163 }
129 164
130 void CodeAssembler::Return(Node* value) { 165 void CodeAssembler::Return(Node* value) {
131 return raw_assembler_->Return(value); 166 return raw_assembler_->Return(value);
132 } 167 }
133 168
134 void CodeAssembler::Bind(CodeAssembler::Label* label) { return label->Bind(); } 169 void CodeAssembler::Bind(CodeAssembler::Label* label) { return label->Bind(); }
135 170
(...skipping 563 matching lines...) Expand 10 before | Expand all | Expand 10 after
699 } 734 }
700 } 735 }
701 } 736 }
702 737
703 bound_ = true; 738 bound_ = true;
704 } 739 }
705 740
706 } // namespace compiler 741 } // namespace compiler
707 } // namespace internal 742 } // namespace internal
708 } // namespace v8 743 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698