Chromium Code Reviews| 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/compiler-source-position-table.h" | 10 #include "src/compiler/compiler-source-position-table.h" |
| (...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 473 | 473 |
| 474 private: | 474 private: |
| 475 ZoneVector<Node*> objects_; | 475 ZoneVector<Node*> objects_; |
| 476 }; | 476 }; |
| 477 | 477 |
| 478 // Returns the number of instruction operands added to inputs. | 478 // Returns the number of instruction operands added to inputs. |
| 479 size_t InstructionSelector::AddOperandToStateValueDescriptor( | 479 size_t InstructionSelector::AddOperandToStateValueDescriptor( |
| 480 StateValueList* values, InstructionOperandVector* inputs, | 480 StateValueList* values, InstructionOperandVector* inputs, |
| 481 OperandGenerator* g, StateObjectDeduplicator* deduplicator, Node* input, | 481 OperandGenerator* g, StateObjectDeduplicator* deduplicator, Node* input, |
| 482 MachineType type, FrameStateInputKind kind, Zone* zone) { | 482 MachineType type, FrameStateInputKind kind, Zone* zone) { |
| 483 if (input == nullptr) { | |
| 484 values->PushOptimizedOut(); | |
| 485 return 0; | |
| 486 } | |
| 487 | |
| 483 switch (input->opcode()) { | 488 switch (input->opcode()) { |
| 484 case IrOpcode::kObjectState: { | 489 case IrOpcode::kObjectState: { |
| 485 UNREACHABLE(); | 490 UNREACHABLE(); |
| 486 return 0; | 491 return 0; |
| 487 } | 492 } |
| 488 case IrOpcode::kTypedObjectState: { | 493 case IrOpcode::kTypedObjectState: { |
| 489 size_t id = deduplicator->GetObjectId(input); | 494 size_t id = deduplicator->GetObjectId(input); |
| 490 if (id == StateObjectDeduplicator::kNotDuplicated) { | 495 if (id == StateObjectDeduplicator::kNotDuplicated) { |
| 491 size_t entries = 0; | 496 size_t entries = 0; |
| 492 id = deduplicator->InsertObject(input); | 497 id = deduplicator->InsertObject(input); |
| 493 StateValueList* nested = values->PushRecursiveField(zone, id); | 498 StateValueList* nested = values->PushRecursiveField(zone, id); |
| 494 int const input_count = input->op()->ValueInputCount(); | 499 int const input_count = input->op()->ValueInputCount(); |
| 495 ZoneVector<MachineType> const* types = MachineTypesOf(input->op()); | 500 ZoneVector<MachineType> const* types = MachineTypesOf(input->op()); |
| 496 for (int i = 0; i < input_count; ++i) { | 501 for (int i = 0; i < input_count; ++i) { |
| 497 entries += AddOperandToStateValueDescriptor( | 502 entries += AddOperandToStateValueDescriptor( |
| 498 nested, inputs, g, deduplicator, input->InputAt(i), types->at(i), | 503 nested, inputs, g, deduplicator, input->InputAt(i), types->at(i), |
| 499 kind, zone); | 504 kind, zone); |
| 500 } | 505 } |
| 501 return entries; | 506 return entries; |
| 502 } else { | 507 } else { |
| 503 // Crankshaft counts duplicate objects for the running id, so we have | 508 // Crankshaft counts duplicate objects for the running id, so we have |
| 504 // to push the input again. | 509 // to push the input again. |
| 505 deduplicator->InsertObject(input); | 510 deduplicator->InsertObject(input); |
| 506 values->PushDuplicate(id); | 511 values->PushDuplicate(id); |
| 507 return 0; | 512 return 0; |
| 508 } | 513 } |
| 509 } | 514 } |
| 510 default: { | 515 default: { |
| 511 Heap* const heap = isolate()->heap(); | 516 Heap* const heap = isolate()->heap(); |
| 512 if (input->opcode() == IrOpcode::kHeapConstant) { | 517 if (input->opcode() == IrOpcode::kHeapConstant) { |
|
Jarin
2016/12/07 08:56:20
Maybe we can remove this ugly dance will now?
Leszek Swirski
2016/12/08 15:44:30
Not yet, I don't think, there still could be optim
| |
| 513 Handle<HeapObject> constant = OpParameter<Handle<HeapObject>>(input); | 518 Handle<HeapObject> constant = OpParameter<Handle<HeapObject>>(input); |
| 514 Heap::RootListIndex root_index; | 519 Heap::RootListIndex root_index; |
| 515 if (heap->IsRootHandle(constant, &root_index) && | 520 if (heap->IsRootHandle(constant, &root_index) && |
| 516 root_index == Heap::kOptimizedOutRootIndex) { | 521 root_index == Heap::kOptimizedOutRootIndex) { |
| 517 values->PushOptimizedOut(); | 522 values->PushOptimizedOut(); |
| 518 return 0; | 523 return 0; |
| 519 } | 524 } |
| 520 } | 525 } |
| 521 inputs->push_back(OperandForDeopt(g, input, kind, type.representation())); | 526 inputs->push_back(OperandForDeopt(g, input, kind, type.representation())); |
| 522 values->PushPlain(type); | 527 values->PushPlain(type); |
| (...skipping 1587 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2110 return new (instruction_zone()) FrameStateDescriptor( | 2115 return new (instruction_zone()) FrameStateDescriptor( |
| 2111 instruction_zone(), state_info.type(), state_info.bailout_id(), | 2116 instruction_zone(), state_info.type(), state_info.bailout_id(), |
| 2112 state_info.state_combine(), parameters, locals, stack, | 2117 state_info.state_combine(), parameters, locals, stack, |
| 2113 state_info.shared_info(), outer_state); | 2118 state_info.shared_info(), outer_state); |
| 2114 } | 2119 } |
| 2115 | 2120 |
| 2116 | 2121 |
| 2117 } // namespace compiler | 2122 } // namespace compiler |
| 2118 } // namespace internal | 2123 } // namespace internal |
| 2119 } // namespace v8 | 2124 } // namespace v8 |
| OLD | NEW |