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

Side by Side Diff: src/compiler/change-lowering.cc

Issue 1916763003: [turbofan] Move ChangeTaggedToFoo lowerings to EffectControlLinearizer. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 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 unified diff | Download patch
« no previous file with comments | « src/compiler/change-lowering.h ('k') | src/compiler/effect-control-linearizer.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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/change-lowering.h" 5 #include "src/compiler/change-lowering.h"
6 6
7 #include "src/address-map.h" 7 #include "src/address-map.h"
8 #include "src/code-factory.h" 8 #include "src/code-factory.h"
9 #include "src/compiler/js-graph.h" 9 #include "src/compiler/js-graph.h"
10 #include "src/compiler/linkage.h" 10 #include "src/compiler/linkage.h"
(...skipping 13 matching lines...) Expand all
24 Node* control = graph()->start(); 24 Node* control = graph()->start();
25 switch (node->opcode()) { 25 switch (node->opcode()) {
26 case IrOpcode::kChangeBitToBool: 26 case IrOpcode::kChangeBitToBool:
27 return ChangeBitToBool(node->InputAt(0), control); 27 return ChangeBitToBool(node->InputAt(0), control);
28 case IrOpcode::kChangeBoolToBit: 28 case IrOpcode::kChangeBoolToBit:
29 return ChangeBoolToBit(node->InputAt(0)); 29 return ChangeBoolToBit(node->InputAt(0));
30 case IrOpcode::kChangeInt31ToTagged: 30 case IrOpcode::kChangeInt31ToTagged:
31 return ChangeInt31ToTagged(node->InputAt(0), control); 31 return ChangeInt31ToTagged(node->InputAt(0), control);
32 case IrOpcode::kChangeTaggedSignedToInt32: 32 case IrOpcode::kChangeTaggedSignedToInt32:
33 return ChangeTaggedSignedToInt32(node->InputAt(0)); 33 return ChangeTaggedSignedToInt32(node->InputAt(0));
34 case IrOpcode::kChangeTaggedToFloat64:
35 return ChangeTaggedToFloat64(node->InputAt(0), control);
36 case IrOpcode::kChangeTaggedToInt32:
37 return ChangeTaggedToUI32(node->InputAt(0), control, kSigned);
38 case IrOpcode::kChangeTaggedToUint32:
39 return ChangeTaggedToUI32(node->InputAt(0), control, kUnsigned);
40 case IrOpcode::kTruncateTaggedToWord32:
41 return TruncateTaggedToWord32(node->InputAt(0), control);
42 case IrOpcode::kLoadField: 34 case IrOpcode::kLoadField:
43 return LoadField(node); 35 return LoadField(node);
44 case IrOpcode::kStoreField: 36 case IrOpcode::kStoreField:
45 return StoreField(node); 37 return StoreField(node);
46 case IrOpcode::kLoadElement: 38 case IrOpcode::kLoadElement:
47 return LoadElement(node); 39 return LoadElement(node);
48 case IrOpcode::kStoreElement: 40 case IrOpcode::kStoreElement:
49 return StoreElement(node); 41 return StoreElement(node);
50 case IrOpcode::kAllocate: 42 case IrOpcode::kAllocate:
51 return Allocate(node); 43 return Allocate(node);
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 } 130 }
139 131
140 Reduction ChangeLowering::ChangeInt31ToTagged(Node* value, Node* control) { 132 Reduction ChangeLowering::ChangeInt31ToTagged(Node* value, Node* control) {
141 return Replace(ChangeInt32ToSmi(value)); 133 return Replace(ChangeInt32ToSmi(value));
142 } 134 }
143 135
144 Reduction ChangeLowering::ChangeTaggedSignedToInt32(Node* value) { 136 Reduction ChangeLowering::ChangeTaggedSignedToInt32(Node* value) {
145 return Replace(ChangeSmiToWord32(value)); 137 return Replace(ChangeSmiToWord32(value));
146 } 138 }
147 139
148 Reduction ChangeLowering::ChangeTaggedToUI32(Node* value, Node* control,
149 Signedness signedness) {
150 const Operator* op = (signedness == kSigned)
151 ? machine()->ChangeFloat64ToInt32()
152 : machine()->ChangeFloat64ToUint32();
153
154 if (NodeProperties::GetType(value)->Is(Type::TaggedPointer()) &&
155 NodeProperties::GetType(value)->Is(Type::Number())) {
156 return Replace(graph()->NewNode(op, LoadHeapNumberValue(value, control)));
157 }
158
159 Node* check = TestNotSmi(value);
160 Node* branch =
161 graph()->NewNode(common()->Branch(BranchHint::kFalse), check, control);
162
163 Node* if_not_smi = graph()->NewNode(common()->IfTrue(), branch);
164
165 STATIC_ASSERT(HeapNumber::kValueOffset == Oddball::kToNumberRawOffset);
166 Node* vnot_smi = graph()->NewNode(op, LoadHeapNumberValue(value, if_not_smi));
167
168 Node* if_smi = graph()->NewNode(common()->IfFalse(), branch);
169 Node* vfrom_smi = ChangeSmiToWord32(value);
170
171 Node* merge = graph()->NewNode(common()->Merge(2), if_not_smi, if_smi);
172 Node* phi = graph()->NewNode(common()->Phi(MachineRepresentation::kWord32, 2),
173 vnot_smi, vfrom_smi, merge);
174
175 return Replace(phi);
176 }
177
178
179 Reduction ChangeLowering::ChangeTaggedToFloat64(Node* value, Node* control) {
180 Node* check = TestNotSmi(value);
181 Node* branch =
182 graph()->NewNode(common()->Branch(BranchHint::kFalse), check, control);
183
184 Node* if_not_smi = graph()->NewNode(common()->IfTrue(), branch);
185
186 STATIC_ASSERT(HeapNumber::kValueOffset == Oddball::kToNumberRawOffset);
187 Node* vnot_smi = LoadHeapNumberValue(value, if_not_smi);
188
189 Node* if_smi = graph()->NewNode(common()->IfFalse(), branch);
190 Node* vfrom_smi = ChangeSmiToFloat64(value);
191
192 Node* merge = graph()->NewNode(common()->Merge(2), if_not_smi, if_smi);
193 Node* phi =
194 graph()->NewNode(common()->Phi(MachineRepresentation::kFloat64, 2),
195 vnot_smi, vfrom_smi, merge);
196
197 return Replace(phi);
198 }
199
200 Reduction ChangeLowering::TruncateTaggedToWord32(Node* value, Node* control) {
201 Node* check = TestNotSmi(value);
202 Node* branch =
203 graph()->NewNode(common()->Branch(BranchHint::kFalse), check, control);
204
205 Node* if_not_smi = graph()->NewNode(common()->IfTrue(), branch);
206
207 STATIC_ASSERT(HeapNumber::kValueOffset == Oddball::kToNumberRawOffset);
208 Node* vnot_smi = graph()->NewNode(machine()->TruncateFloat64ToWord32(),
209 LoadHeapNumberValue(value, if_not_smi));
210
211 Node* if_smi = graph()->NewNode(common()->IfFalse(), branch);
212 Node* vfrom_smi = ChangeSmiToWord32(value);
213
214 Node* merge = graph()->NewNode(common()->Merge(2), if_not_smi, if_smi);
215 Node* phi = graph()->NewNode(common()->Phi(MachineRepresentation::kWord32, 2),
216 vnot_smi, vfrom_smi, merge);
217
218 return Replace(phi);
219 }
220
221 namespace { 140 namespace {
222 141
223 WriteBarrierKind ComputeWriteBarrierKind(BaseTaggedness base_is_tagged, 142 WriteBarrierKind ComputeWriteBarrierKind(BaseTaggedness base_is_tagged,
224 MachineRepresentation representation, 143 MachineRepresentation representation,
225 Type* field_type, Type* input_type) { 144 Type* field_type, Type* input_type) {
226 if (field_type->Is(Type::TaggedSigned()) || 145 if (field_type->Is(Type::TaggedSigned()) ||
227 input_type->Is(Type::TaggedSigned())) { 146 input_type->Is(Type::TaggedSigned())) {
228 // Write barriers are only for writes of heap objects. 147 // Write barriers are only for writes of heap objects.
229 return kNoWriteBarrier; 148 return kNoWriteBarrier;
230 } 149 }
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
412 } 331 }
413 332
414 333
415 MachineOperatorBuilder* ChangeLowering::machine() const { 334 MachineOperatorBuilder* ChangeLowering::machine() const {
416 return jsgraph()->machine(); 335 return jsgraph()->machine();
417 } 336 }
418 337
419 } // namespace compiler 338 } // namespace compiler
420 } // namespace internal 339 } // namespace internal
421 } // namespace v8 340 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/change-lowering.h ('k') | src/compiler/effect-control-linearizer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698