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

Side by Side Diff: src/compiler/instruction-selector.cc

Issue 2266823002: [turbofan] Insert dummy values when changing from None type. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebase Created 4 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
« no previous file with comments | « src/compiler/instruction-scheduler.cc ('k') | src/compiler/machine-operator.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/instruction-selector.h" 5 #include "src/compiler/instruction-selector.h"
6 6
7 #include <limits> 7 #include <limits>
8 8
9 #include "src/base/adapters.h" 9 #include "src/base/adapters.h"
10 #include "src/compiler/instruction-selector-impl.h" 10 #include "src/compiler/instruction-selector-impl.h"
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after
343 } 343 }
344 344
345 345
346 namespace { 346 namespace {
347 347
348 enum class FrameStateInputKind { kAny, kStackSlot }; 348 enum class FrameStateInputKind { kAny, kStackSlot };
349 349
350 InstructionOperand OperandForDeopt(OperandGenerator* g, Node* input, 350 InstructionOperand OperandForDeopt(OperandGenerator* g, Node* input,
351 FrameStateInputKind kind, 351 FrameStateInputKind kind,
352 MachineRepresentation rep) { 352 MachineRepresentation rep) {
353 if (rep == MachineRepresentation::kNone) {
354 return g->TempImmediate(FrameStateDescriptor::kImpossibleValue);
355 }
356
353 switch (input->opcode()) { 357 switch (input->opcode()) {
354 case IrOpcode::kInt32Constant: 358 case IrOpcode::kInt32Constant:
355 case IrOpcode::kInt64Constant: 359 case IrOpcode::kInt64Constant:
356 case IrOpcode::kNumberConstant: 360 case IrOpcode::kNumberConstant:
357 case IrOpcode::kFloat32Constant: 361 case IrOpcode::kFloat32Constant:
358 case IrOpcode::kFloat64Constant: 362 case IrOpcode::kFloat64Constant:
359 case IrOpcode::kHeapConstant: 363 case IrOpcode::kHeapConstant:
360 return g->UseImmediate(input); 364 return g->UseImmediate(input);
361 case IrOpcode::kObjectState: 365 case IrOpcode::kObjectState:
362 UNREACHABLE(); 366 UNREACHABLE();
363 break; 367 break;
364 default: 368 default:
365 if (rep == MachineRepresentation::kNone) { 369 switch (kind) {
366 return g->TempImmediate(FrameStateDescriptor::kImpossibleValue); 370 case FrameStateInputKind::kStackSlot:
367 } else { 371 return g->UseUniqueSlot(input);
368 switch (kind) { 372 case FrameStateInputKind::kAny:
369 case FrameStateInputKind::kStackSlot: 373 // Currently deopts "wrap" other operations, so the deopt's inputs
370 return g->UseUniqueSlot(input); 374 // are potentially needed untill the end of the deoptimising code.
371 case FrameStateInputKind::kAny: 375 return g->UseAnyAtEnd(input);
372 // Currently deopts "wrap" other operations, so the deopt's inputs
373 // are potentially needed untill the end of the deoptimising code.
374 return g->UseAnyAtEnd(input);
375 }
376 } 376 }
377 } 377 }
378 UNREACHABLE(); 378 UNREACHABLE();
379 return InstructionOperand(); 379 return InstructionOperand();
380 } 380 }
381 381
382 382
383 class StateObjectDeduplicator { 383 class StateObjectDeduplicator {
384 public: 384 public:
385 explicit StateObjectDeduplicator(Zone* zone) : objects_(zone) {} 385 explicit StateObjectDeduplicator(Zone* zone) : objects_(zone) {}
(...skipping 674 matching lines...) Expand 10 before | Expand all | Expand 10 after
1060 case IrOpcode::kChangeFloat32ToFloat64: 1060 case IrOpcode::kChangeFloat32ToFloat64:
1061 return MarkAsFloat64(node), VisitChangeFloat32ToFloat64(node); 1061 return MarkAsFloat64(node), VisitChangeFloat32ToFloat64(node);
1062 case IrOpcode::kChangeInt32ToFloat64: 1062 case IrOpcode::kChangeInt32ToFloat64:
1063 return MarkAsFloat64(node), VisitChangeInt32ToFloat64(node); 1063 return MarkAsFloat64(node), VisitChangeInt32ToFloat64(node);
1064 case IrOpcode::kChangeUint32ToFloat64: 1064 case IrOpcode::kChangeUint32ToFloat64:
1065 return MarkAsFloat64(node), VisitChangeUint32ToFloat64(node); 1065 return MarkAsFloat64(node), VisitChangeUint32ToFloat64(node);
1066 case IrOpcode::kChangeFloat64ToInt32: 1066 case IrOpcode::kChangeFloat64ToInt32:
1067 return MarkAsWord32(node), VisitChangeFloat64ToInt32(node); 1067 return MarkAsWord32(node), VisitChangeFloat64ToInt32(node);
1068 case IrOpcode::kChangeFloat64ToUint32: 1068 case IrOpcode::kChangeFloat64ToUint32:
1069 return MarkAsWord32(node), VisitChangeFloat64ToUint32(node); 1069 return MarkAsWord32(node), VisitChangeFloat64ToUint32(node);
1070 case IrOpcode::kImpossibleToWord32:
1071 return MarkAsWord32(node), VisitImpossibleToWord32(node);
1072 case IrOpcode::kImpossibleToWord64:
1073 return MarkAsWord64(node), VisitImpossibleToWord64(node);
1074 case IrOpcode::kImpossibleToFloat32:
1075 return MarkAsFloat32(node), VisitImpossibleToFloat32(node);
1076 case IrOpcode::kImpossibleToFloat64:
1077 return MarkAsFloat64(node), VisitImpossibleToFloat64(node);
1078 case IrOpcode::kImpossibleToTagged:
1079 MarkAsRepresentation(MachineType::PointerRepresentation(), node);
1080 return VisitImpossibleToTagged(node);
1081 case IrOpcode::kImpossibleToBit:
1082 return MarkAsWord32(node), VisitImpossibleToBit(node);
1083 case IrOpcode::kFloat64SilenceNaN: 1070 case IrOpcode::kFloat64SilenceNaN:
1084 MarkAsFloat64(node); 1071 MarkAsFloat64(node);
1085 if (CanProduceSignalingNaN(node->InputAt(0))) { 1072 if (CanProduceSignalingNaN(node->InputAt(0))) {
1086 return VisitFloat64SilenceNaN(node); 1073 return VisitFloat64SilenceNaN(node);
1087 } else { 1074 } else {
1088 return EmitIdentity(node); 1075 return EmitIdentity(node);
1089 } 1076 }
1090 case IrOpcode::kTruncateFloat64ToUint32: 1077 case IrOpcode::kTruncateFloat64ToUint32:
1091 return MarkAsWord32(node), VisitTruncateFloat64ToUint32(node); 1078 return MarkAsWord32(node), VisitTruncateFloat64ToUint32(node);
1092 case IrOpcode::kTruncateFloat32ToInt32: 1079 case IrOpcode::kTruncateFloat32ToInt32:
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
1313 return MarkAsSimd128(node), VisitCreateInt32x4(node); 1300 return MarkAsSimd128(node), VisitCreateInt32x4(node);
1314 case IrOpcode::kInt32x4ExtractLane: 1301 case IrOpcode::kInt32x4ExtractLane:
1315 return MarkAsWord32(node), VisitInt32x4ExtractLane(node); 1302 return MarkAsWord32(node), VisitInt32x4ExtractLane(node);
1316 default: 1303 default:
1317 V8_Fatal(__FILE__, __LINE__, "Unexpected operator #%d:%s @ node #%d", 1304 V8_Fatal(__FILE__, __LINE__, "Unexpected operator #%d:%s @ node #%d",
1318 node->opcode(), node->op()->mnemonic(), node->id()); 1305 node->opcode(), node->op()->mnemonic(), node->id());
1319 break; 1306 break;
1320 } 1307 }
1321 } 1308 }
1322 1309
1323 void InstructionSelector::VisitImpossibleToWord32(Node* node) {
1324 OperandGenerator g(this);
1325 Emit(kArchImpossible, g.DefineAsConstant(node, Constant(0)));
1326 }
1327
1328 void InstructionSelector::VisitImpossibleToWord64(Node* node) {
1329 OperandGenerator g(this);
1330 Emit(kArchImpossible,
1331 g.DefineAsConstant(node, Constant(static_cast<int64_t>(0))));
1332 }
1333
1334 void InstructionSelector::VisitImpossibleToFloat32(Node* node) {
1335 OperandGenerator g(this);
1336 Emit(kArchImpossible, g.DefineAsConstant(node, Constant(0.0f)));
1337 }
1338
1339 void InstructionSelector::VisitImpossibleToFloat64(Node* node) {
1340 OperandGenerator g(this);
1341 Emit(kArchImpossible, g.DefineAsConstant(node, Constant(0.0)));
1342 }
1343
1344 void InstructionSelector::VisitImpossibleToBit(Node* node) {
1345 OperandGenerator g(this);
1346 Emit(kArchImpossible, g.DefineAsConstant(node, Constant(0)));
1347 }
1348
1349 void InstructionSelector::VisitImpossibleToTagged(Node* node) {
1350 OperandGenerator g(this);
1351 #if V8_TARGET_ARCH_64_BIT
1352 Emit(kArchImpossible,
1353 g.DefineAsConstant(node, Constant(static_cast<int64_t>(0))));
1354 #else // V8_TARGET_ARCH_64_BIT
1355 Emit(kArchImpossible, g.DefineAsConstant(node, Constant(0)));
1356 #endif // V8_TARGET_ARCH_64_BIT
1357 }
1358
1359 void InstructionSelector::VisitLoadStackPointer(Node* node) { 1310 void InstructionSelector::VisitLoadStackPointer(Node* node) {
1360 OperandGenerator g(this); 1311 OperandGenerator g(this);
1361 Emit(kArchStackPointer, g.DefineAsRegister(node)); 1312 Emit(kArchStackPointer, g.DefineAsRegister(node));
1362 } 1313 }
1363 1314
1364 void InstructionSelector::VisitLoadFramePointer(Node* node) { 1315 void InstructionSelector::VisitLoadFramePointer(Node* node) {
1365 OperandGenerator g(this); 1316 OperandGenerator g(this);
1366 Emit(kArchFramePointer, g.DefineAsRegister(node)); 1317 Emit(kArchFramePointer, g.DefineAsRegister(node));
1367 } 1318 }
1368 1319
(...skipping 712 matching lines...) Expand 10 before | Expand all | Expand 10 after
2081 return new (instruction_zone()) FrameStateDescriptor( 2032 return new (instruction_zone()) FrameStateDescriptor(
2082 instruction_zone(), state_info.type(), state_info.bailout_id(), 2033 instruction_zone(), state_info.type(), state_info.bailout_id(),
2083 state_info.state_combine(), parameters, locals, stack, 2034 state_info.state_combine(), parameters, locals, stack,
2084 state_info.shared_info(), outer_state); 2035 state_info.shared_info(), outer_state);
2085 } 2036 }
2086 2037
2087 2038
2088 } // namespace compiler 2039 } // namespace compiler
2089 } // namespace internal 2040 } // namespace internal
2090 } // namespace v8 2041 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/instruction-scheduler.cc ('k') | src/compiler/machine-operator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698