OLD | NEW |
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 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
427 | 427 |
428 switch (input->opcode()) { | 428 switch (input->opcode()) { |
429 case IrOpcode::kInt32Constant: | 429 case IrOpcode::kInt32Constant: |
430 case IrOpcode::kInt64Constant: | 430 case IrOpcode::kInt64Constant: |
431 case IrOpcode::kNumberConstant: | 431 case IrOpcode::kNumberConstant: |
432 case IrOpcode::kFloat32Constant: | 432 case IrOpcode::kFloat32Constant: |
433 case IrOpcode::kFloat64Constant: | 433 case IrOpcode::kFloat64Constant: |
434 case IrOpcode::kHeapConstant: | 434 case IrOpcode::kHeapConstant: |
435 return g->UseImmediate(input); | 435 return g->UseImmediate(input); |
436 case IrOpcode::kObjectState: | 436 case IrOpcode::kObjectState: |
| 437 case IrOpcode::kTypedObjectState: |
437 UNREACHABLE(); | 438 UNREACHABLE(); |
438 break; | 439 break; |
439 default: | 440 default: |
440 switch (kind) { | 441 switch (kind) { |
441 case FrameStateInputKind::kStackSlot: | 442 case FrameStateInputKind::kStackSlot: |
442 return g->UseUniqueSlot(input); | 443 return g->UseUniqueSlot(input); |
443 case FrameStateInputKind::kAny: | 444 case FrameStateInputKind::kAny: |
444 // Currently deopts "wrap" other operations, so the deopt's inputs | 445 // Currently deopts "wrap" other operations, so the deopt's inputs |
445 // are potentially needed untill the end of the deoptimising code. | 446 // are potentially needed untill the end of the deoptimising code. |
446 return g->UseAnyAtEnd(input); | 447 return g->UseAnyAtEnd(input); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
478 | 479 |
479 // Returns the number of instruction operands added to inputs. | 480 // Returns the number of instruction operands added to inputs. |
480 size_t AddOperandToStateValueDescriptor(StateValueDescriptor* descriptor, | 481 size_t AddOperandToStateValueDescriptor(StateValueDescriptor* descriptor, |
481 InstructionOperandVector* inputs, | 482 InstructionOperandVector* inputs, |
482 OperandGenerator* g, | 483 OperandGenerator* g, |
483 StateObjectDeduplicator* deduplicator, | 484 StateObjectDeduplicator* deduplicator, |
484 Node* input, MachineType type, | 485 Node* input, MachineType type, |
485 FrameStateInputKind kind, Zone* zone) { | 486 FrameStateInputKind kind, Zone* zone) { |
486 switch (input->opcode()) { | 487 switch (input->opcode()) { |
487 case IrOpcode::kObjectState: { | 488 case IrOpcode::kObjectState: { |
| 489 UNREACHABLE(); |
| 490 return 0; |
| 491 } |
| 492 case IrOpcode::kTypedObjectState: { |
488 size_t id = deduplicator->GetObjectId(input); | 493 size_t id = deduplicator->GetObjectId(input); |
489 if (id == StateObjectDeduplicator::kNotDuplicated) { | 494 if (id == StateObjectDeduplicator::kNotDuplicated) { |
490 size_t entries = 0; | 495 size_t entries = 0; |
491 id = deduplicator->InsertObject(input); | 496 id = deduplicator->InsertObject(input); |
492 descriptor->fields().push_back( | 497 descriptor->fields().push_back( |
493 StateValueDescriptor::Recursive(zone, id)); | 498 StateValueDescriptor::Recursive(zone, id)); |
494 StateValueDescriptor* new_desc = &descriptor->fields().back(); | 499 StateValueDescriptor* new_desc = &descriptor->fields().back(); |
495 for (Edge edge : input->input_edges()) { | 500 int const input_count = input->op()->ValueInputCount(); |
| 501 ZoneVector<MachineType> const* types = MachineTypesOf(input->op()); |
| 502 for (int i = 0; i < input_count; ++i) { |
496 entries += AddOperandToStateValueDescriptor( | 503 entries += AddOperandToStateValueDescriptor( |
497 new_desc, inputs, g, deduplicator, edge.to(), | 504 new_desc, inputs, g, deduplicator, input->InputAt(i), |
498 MachineType::AnyTagged(), kind, zone); | 505 types->at(i), kind, zone); |
499 } | 506 } |
500 return entries; | 507 return entries; |
501 } else { | 508 } else { |
502 // Crankshaft counts duplicate objects for the running id, so we have | 509 // Crankshaft counts duplicate objects for the running id, so we have |
503 // to push the input again. | 510 // to push the input again. |
504 deduplicator->InsertObject(input); | 511 deduplicator->InsertObject(input); |
505 descriptor->fields().push_back( | 512 descriptor->fields().push_back( |
506 StateValueDescriptor::Duplicate(zone, id)); | 513 StateValueDescriptor::Duplicate(zone, id)); |
507 return 0; | 514 return 0; |
508 } | 515 } |
509 break; | |
510 } | 516 } |
511 default: { | 517 default: { |
512 inputs->push_back(OperandForDeopt(g, input, kind, type.representation())); | 518 inputs->push_back(OperandForDeopt(g, input, kind, type.representation())); |
513 descriptor->fields().push_back(StateValueDescriptor::Plain(zone, type)); | 519 descriptor->fields().push_back(StateValueDescriptor::Plain(zone, type)); |
514 return 1; | 520 return 1; |
515 } | 521 } |
516 } | 522 } |
517 } | 523 } |
518 | 524 |
519 | 525 |
(...skipping 1583 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2103 return new (instruction_zone()) FrameStateDescriptor( | 2109 return new (instruction_zone()) FrameStateDescriptor( |
2104 instruction_zone(), state_info.type(), state_info.bailout_id(), | 2110 instruction_zone(), state_info.type(), state_info.bailout_id(), |
2105 state_info.state_combine(), parameters, locals, stack, | 2111 state_info.state_combine(), parameters, locals, stack, |
2106 state_info.shared_info(), outer_state); | 2112 state_info.shared_info(), outer_state); |
2107 } | 2113 } |
2108 | 2114 |
2109 | 2115 |
2110 } // namespace compiler | 2116 } // namespace compiler |
2111 } // namespace internal | 2117 } // namespace internal |
2112 } // namespace v8 | 2118 } // namespace v8 |
OLD | NEW |