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

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

Issue 512753002: Disable some changes tests on ARM64. Also, fix the changes lowering to not use the more expensive T… (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « src/compiler/change-lowering.h ('k') | test/cctest/compiler/test-changes-lowering.cc » ('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/compiler/js-graph.h" 7 #include "src/compiler/js-graph.h"
8 8
9 namespace v8 { 9 namespace v8 {
10 namespace internal { 10 namespace internal {
11 namespace compiler { 11 namespace compiler {
12 12
13 ChangeLowering::~ChangeLowering() {} 13 ChangeLowering::~ChangeLowering() {}
14 14
15 15
16 Reduction ChangeLowering::Reduce(Node* node) { 16 Reduction ChangeLowering::Reduce(Node* node) {
17 Node* control = graph()->start(); 17 Node* control = graph()->start();
18 switch (node->opcode()) { 18 switch (node->opcode()) {
19 case IrOpcode::kChangeBitToBool: 19 case IrOpcode::kChangeBitToBool:
20 return ChangeBitToBool(node->InputAt(0), control); 20 return ChangeBitToBool(node->InputAt(0), control);
21 case IrOpcode::kChangeBoolToBit: 21 case IrOpcode::kChangeBoolToBit:
22 return ChangeBoolToBit(node->InputAt(0)); 22 return ChangeBoolToBit(node->InputAt(0));
23 case IrOpcode::kChangeFloat64ToTagged: 23 case IrOpcode::kChangeFloat64ToTagged:
24 return ChangeFloat64ToTagged(node->InputAt(0), control); 24 return ChangeFloat64ToTagged(node->InputAt(0), control);
25 case IrOpcode::kChangeInt32ToTagged: 25 case IrOpcode::kChangeInt32ToTagged:
26 return ChangeInt32ToTagged(node->InputAt(0), control); 26 return ChangeInt32ToTagged(node->InputAt(0), control);
27 case IrOpcode::kChangeTaggedToFloat64: 27 case IrOpcode::kChangeTaggedToFloat64:
28 return ChangeTaggedToFloat64(node->InputAt(0), control); 28 return ChangeTaggedToFloat64(node->InputAt(0), control);
29 case IrOpcode::kChangeTaggedToInt32: 29 case IrOpcode::kChangeTaggedToInt32:
30 return ChangeTaggedToI32(node->InputAt(0), control, true);
30 case IrOpcode::kChangeTaggedToUint32: 31 case IrOpcode::kChangeTaggedToUint32:
31 // ToInt32 and ToUint32 perform exactly the same operation, just the 32 return ChangeTaggedToI32(node->InputAt(0), control, false);
32 // interpretation of the resulting 32 bit value is different, so we can
33 // use the same subgraph for both operations.
34 // See ECMA-262 9.5: ToInt32 and ECMA-262 9.6: ToUint32.
35 return ChangeTaggedToInt32(node->InputAt(0), control);
36 case IrOpcode::kChangeUint32ToTagged: 33 case IrOpcode::kChangeUint32ToTagged:
37 return ChangeUint32ToTagged(node->InputAt(0), control); 34 return ChangeUint32ToTagged(node->InputAt(0), control);
38 default: 35 default:
39 return NoChange(); 36 return NoChange();
40 } 37 }
41 UNREACHABLE(); 38 UNREACHABLE();
42 return NoChange(); 39 return NoChange();
43 } 40 }
44 41
45 42
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 Node* if_false = graph()->NewNode(common()->IfFalse(), branch); 160 Node* if_false = graph()->NewNode(common()->IfFalse(), branch);
164 Node* smi = graph()->NewNode(common()->Projection(0), add); 161 Node* smi = graph()->NewNode(common()->Projection(0), add);
165 162
166 Node* merge = graph()->NewNode(common()->Merge(2), if_true, if_false); 163 Node* merge = graph()->NewNode(common()->Merge(2), if_true, if_false);
167 Node* phi = graph()->NewNode(common()->Phi(2), heap_number, smi, merge); 164 Node* phi = graph()->NewNode(common()->Phi(2), heap_number, smi, merge);
168 165
169 return Replace(phi); 166 return Replace(phi);
170 } 167 }
171 168
172 169
173 Reduction ChangeLowering::ChangeTaggedToInt32(Node* val, Node* control) { 170 Reduction ChangeLowering::ChangeTaggedToI32(Node* val, Node* control,
171 bool is_signed) {
174 STATIC_ASSERT(kSmiTag == 0); 172 STATIC_ASSERT(kSmiTag == 0);
175 STATIC_ASSERT(kSmiTagMask == 1); 173 STATIC_ASSERT(kSmiTagMask == 1);
176 174
177 Node* tag = graph()->NewNode(machine()->WordAnd(), val, 175 Node* tag = graph()->NewNode(machine()->WordAnd(), val,
178 jsgraph()->Int32Constant(kSmiTagMask)); 176 jsgraph()->Int32Constant(kSmiTagMask));
179 Node* branch = graph()->NewNode(common()->Branch(), tag, control); 177 Node* branch = graph()->NewNode(common()->Branch(), tag, control);
180 178
181 Node* if_true = graph()->NewNode(common()->IfTrue(), branch); 179 Node* if_true = graph()->NewNode(common()->IfTrue(), branch);
182 Node* change = graph()->NewNode(machine()->TruncateFloat64ToInt32(), 180 Operator* op = is_signed ? machine()->ChangeFloat64ToInt32()
183 LoadHeapNumberValue(val, if_true)); 181 : machine()->ChangeFloat64ToUint32();
182 Node* change = graph()->NewNode(op, LoadHeapNumberValue(val, if_true));
184 183
185 Node* if_false = graph()->NewNode(common()->IfFalse(), branch); 184 Node* if_false = graph()->NewNode(common()->IfFalse(), branch);
186 Node* number = ChangeSmiToInt32(val); 185 Node* number = ChangeSmiToInt32(val);
187 186
188 Node* merge = graph()->NewNode(common()->Merge(2), if_true, if_false); 187 Node* merge = graph()->NewNode(common()->Merge(2), if_true, if_false);
189 Node* phi = graph()->NewNode(common()->Phi(2), change, number, merge); 188 Node* phi = graph()->NewNode(common()->Phi(2), change, number, merge);
190 189
191 return Replace(phi); 190 return Replace(phi);
192 } 191 }
193 192
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 Graph* ChangeLowering::graph() const { return jsgraph()->graph(); } 246 Graph* ChangeLowering::graph() const { return jsgraph()->graph(); }
248 247
249 248
250 CommonOperatorBuilder* ChangeLowering::common() const { 249 CommonOperatorBuilder* ChangeLowering::common() const {
251 return jsgraph()->common(); 250 return jsgraph()->common();
252 } 251 }
253 252
254 } // namespace compiler 253 } // namespace compiler
255 } // namespace internal 254 } // namespace internal
256 } // namespace v8 255 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/change-lowering.h ('k') | test/cctest/compiler/test-changes-lowering.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698