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

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

Issue 1884713003: [turbofan] Change number operations to handle Undefined as well. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Remove TODOs for realz now 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/representation-change.h ('k') | src/compiler/simplified-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 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/representation-change.h" 5 #include "src/compiler/representation-change.h"
6 6
7 #include <sstream> 7 #include <sstream>
8 8
9 #include "src/base/bits.h" 9 #include "src/base/bits.h"
10 #include "src/code-factory.h" 10 #include "src/code-factory.h"
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 truncation.TruncatesToWord32()) { 246 truncation.TruncatesToWord32()) {
247 // Either the output is uint32 or the uses only care about the 247 // Either the output is uint32 or the uses only care about the
248 // low 32 bits (so we can pick uint32 safely). 248 // low 32 bits (so we can pick uint32 safely).
249 249
250 // uint32 -> float64 -> float32 250 // uint32 -> float64 -> float32
251 op = machine()->ChangeUint32ToFloat64(); 251 op = machine()->ChangeUint32ToFloat64();
252 node = jsgraph()->graph()->NewNode(op, node); 252 node = jsgraph()->graph()->NewNode(op, node);
253 op = machine()->TruncateFloat64ToFloat32(); 253 op = machine()->TruncateFloat64ToFloat32();
254 } 254 }
255 } else if (output_rep == MachineRepresentation::kTagged) { 255 } else if (output_rep == MachineRepresentation::kTagged) {
256 if (output_type->Is(Type::Number())) { 256 if (output_type->Is(Type::NumberOrUndefined())) {
257 op = simplified() 257 op = simplified()
258 ->ChangeTaggedToFloat64(); // tagged -> float64 -> float32 258 ->ChangeTaggedToFloat64(); // tagged -> float64 -> float32
259 node = jsgraph()->graph()->NewNode(op, node); 259 node = jsgraph()->graph()->NewNode(op, node);
260 op = machine()->TruncateFloat64ToFloat32(); 260 op = machine()->TruncateFloat64ToFloat32();
261 } 261 }
262 } else if (output_rep == MachineRepresentation::kFloat64) { 262 } else if (output_rep == MachineRepresentation::kFloat64) {
263 op = machine()->TruncateFloat64ToFloat32(); 263 op = machine()->TruncateFloat64ToFloat32();
264 } 264 }
265 if (op == nullptr) { 265 if (op == nullptr) {
266 return TypeError(node, output_rep, output_type, 266 return TypeError(node, output_rep, output_type,
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 if (IsWord(output_rep)) { 298 if (IsWord(output_rep)) {
299 if (output_type->Is(Type::Signed32())) { 299 if (output_type->Is(Type::Signed32())) {
300 op = machine()->ChangeInt32ToFloat64(); 300 op = machine()->ChangeInt32ToFloat64();
301 } else if (output_type->Is(Type::Unsigned32()) || 301 } else if (output_type->Is(Type::Unsigned32()) ||
302 truncation.TruncatesToWord32()) { 302 truncation.TruncatesToWord32()) {
303 // Either the output is uint32 or the uses only care about the 303 // Either the output is uint32 or the uses only care about the
304 // low 32 bits (so we can pick uint32 safely). 304 // low 32 bits (so we can pick uint32 safely).
305 op = machine()->ChangeUint32ToFloat64(); 305 op = machine()->ChangeUint32ToFloat64();
306 } 306 }
307 } else if (output_rep == MachineRepresentation::kTagged) { 307 } else if (output_rep == MachineRepresentation::kTagged) {
308 if (output_type->Is(Type::Number())) { 308 if (output_type->Is(Type::NumberOrUndefined())) {
309 op = simplified()->ChangeTaggedToFloat64(); 309 op = simplified()->ChangeTaggedToFloat64();
310 } 310 }
311 } else if (output_rep == MachineRepresentation::kFloat32) { 311 } else if (output_rep == MachineRepresentation::kFloat32) {
312 op = machine()->ChangeFloat32ToFloat64(); 312 op = machine()->ChangeFloat32ToFloat64();
313 } 313 }
314 if (op == nullptr) { 314 if (op == nullptr) {
315 return TypeError(node, output_rep, output_type, 315 return TypeError(node, output_rep, output_type,
316 MachineRepresentation::kFloat64); 316 MachineRepresentation::kFloat64);
317 } 317 }
318 return jsgraph()->graph()->NewNode(op, node); 318 return jsgraph()->graph()->NewNode(op, node);
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
530 530
531 531
532 Node* RepresentationChanger::InsertChangeTaggedToFloat64(Node* node) { 532 Node* RepresentationChanger::InsertChangeTaggedToFloat64(Node* node) {
533 return jsgraph()->graph()->NewNode(simplified()->ChangeTaggedToFloat64(), 533 return jsgraph()->graph()->NewNode(simplified()->ChangeTaggedToFloat64(),
534 node); 534 node);
535 } 535 }
536 536
537 } // namespace compiler 537 } // namespace compiler
538 } // namespace internal 538 } // namespace internal
539 } // namespace v8 539 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/representation-change.h ('k') | src/compiler/simplified-lowering.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698