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/change-lowering.h" | 5 #include "src/compiler/change-lowering.h" |
6 | 6 |
7 #include "src/address-map.h" | 7 #include "src/address-map.h" |
8 #include "src/code-factory.h" | 8 #include "src/code-factory.h" |
9 #include "src/compiler/js-graph.h" | 9 #include "src/compiler/js-graph.h" |
10 #include "src/compiler/linkage.h" | 10 #include "src/compiler/linkage.h" |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 Node* context = jsgraph()->NoContextConstant(); | 80 Node* context = jsgraph()->NoContextConstant(); |
81 Node* effect = graph()->NewNode(common()->BeginRegion(), graph()->start()); | 81 Node* effect = graph()->NewNode(common()->BeginRegion(), graph()->start()); |
82 if (!allocate_heap_number_operator_.is_set()) { | 82 if (!allocate_heap_number_operator_.is_set()) { |
83 CallDescriptor* descriptor = Linkage::GetStubCallDescriptor( | 83 CallDescriptor* descriptor = Linkage::GetStubCallDescriptor( |
84 isolate(), jsgraph()->zone(), callable.descriptor(), 0, | 84 isolate(), jsgraph()->zone(), callable.descriptor(), 0, |
85 CallDescriptor::kNoFlags, Operator::kNoThrow); | 85 CallDescriptor::kNoFlags, Operator::kNoThrow); |
86 allocate_heap_number_operator_.set(common()->Call(descriptor)); | 86 allocate_heap_number_operator_.set(common()->Call(descriptor)); |
87 } | 87 } |
88 Node* heap_number = graph()->NewNode(allocate_heap_number_operator_.get(), | 88 Node* heap_number = graph()->NewNode(allocate_heap_number_operator_.get(), |
89 target, context, effect, control); | 89 target, context, effect, control); |
90 Node* store = graph()->NewNode(machine()->Store(StoreRepresentation( | 90 Node* store = graph()->NewNode( |
91 MachineType::Float64(), kNoWriteBarrier)), | 91 machine()->Store(StoreRepresentation(MachineRepresentation::kFloat64, |
92 heap_number, HeapNumberValueIndexConstant(), | 92 kNoWriteBarrier)), |
93 value, heap_number, control); | 93 heap_number, HeapNumberValueIndexConstant(), value, heap_number, control); |
94 return graph()->NewNode(common()->FinishRegion(), heap_number, store); | 94 return graph()->NewNode(common()->FinishRegion(), heap_number, store); |
95 } | 95 } |
96 | 96 |
97 | 97 |
98 Node* ChangeLowering::ChangeInt32ToFloat64(Node* value) { | 98 Node* ChangeLowering::ChangeInt32ToFloat64(Node* value) { |
99 return graph()->NewNode(machine()->ChangeInt32ToFloat64(), value); | 99 return graph()->NewNode(machine()->ChangeInt32ToFloat64(), value); |
100 } | 100 } |
101 | 101 |
102 | 102 |
103 Node* ChangeLowering::ChangeInt32ToSmi(Node* value) { | 103 Node* ChangeLowering::ChangeInt32ToSmi(Node* value) { |
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
478 | 478 |
479 | 479 |
480 Reduction ChangeLowering::StoreField(Node* node) { | 480 Reduction ChangeLowering::StoreField(Node* node) { |
481 const FieldAccess& access = FieldAccessOf(node->op()); | 481 const FieldAccess& access = FieldAccessOf(node->op()); |
482 Type* type = NodeProperties::GetType(node->InputAt(1)); | 482 Type* type = NodeProperties::GetType(node->InputAt(1)); |
483 WriteBarrierKind kind = ComputeWriteBarrierKind( | 483 WriteBarrierKind kind = ComputeWriteBarrierKind( |
484 access.base_is_tagged, access.machine_type.representation(), access.type, | 484 access.base_is_tagged, access.machine_type.representation(), access.type, |
485 type); | 485 type); |
486 Node* offset = jsgraph()->IntPtrConstant(access.offset - access.tag()); | 486 Node* offset = jsgraph()->IntPtrConstant(access.offset - access.tag()); |
487 node->InsertInput(graph()->zone(), 1, offset); | 487 node->InsertInput(graph()->zone(), 1, offset); |
488 NodeProperties::ChangeOp( | 488 NodeProperties::ChangeOp(node, |
489 node, machine()->Store(StoreRepresentation(access.machine_type, kind))); | 489 machine()->Store(StoreRepresentation( |
| 490 access.machine_type.representation(), kind))); |
490 return Changed(node); | 491 return Changed(node); |
491 } | 492 } |
492 | 493 |
493 | 494 |
494 Node* ChangeLowering::ComputeIndex(const ElementAccess& access, | 495 Node* ChangeLowering::ComputeIndex(const ElementAccess& access, |
495 Node* const key) { | 496 Node* const key) { |
496 Node* index = key; | 497 Node* index = key; |
497 const int element_size_shift = | 498 const int element_size_shift = |
498 ElementSizeLog2Of(access.machine_type.representation()); | 499 ElementSizeLog2Of(access.machine_type.representation()); |
499 if (element_size_shift) { | 500 if (element_size_shift) { |
(...skipping 22 matching lines...) Expand all Loading... |
522 return Changed(node); | 523 return Changed(node); |
523 } | 524 } |
524 | 525 |
525 | 526 |
526 Reduction ChangeLowering::StoreElement(Node* node) { | 527 Reduction ChangeLowering::StoreElement(Node* node) { |
527 const ElementAccess& access = ElementAccessOf(node->op()); | 528 const ElementAccess& access = ElementAccessOf(node->op()); |
528 Type* type = NodeProperties::GetType(node->InputAt(2)); | 529 Type* type = NodeProperties::GetType(node->InputAt(2)); |
529 node->ReplaceInput(1, ComputeIndex(access, node->InputAt(1))); | 530 node->ReplaceInput(1, ComputeIndex(access, node->InputAt(1))); |
530 NodeProperties::ChangeOp( | 531 NodeProperties::ChangeOp( |
531 node, machine()->Store(StoreRepresentation( | 532 node, machine()->Store(StoreRepresentation( |
532 access.machine_type, | 533 access.machine_type.representation(), |
533 ComputeWriteBarrierKind(access.base_is_tagged, | 534 ComputeWriteBarrierKind(access.base_is_tagged, |
534 access.machine_type.representation(), | 535 access.machine_type.representation(), |
535 access.type, type)))); | 536 access.type, type)))); |
536 return Changed(node); | 537 return Changed(node); |
537 } | 538 } |
538 | 539 |
539 | 540 |
540 Reduction ChangeLowering::Allocate(Node* node) { | 541 Reduction ChangeLowering::Allocate(Node* node) { |
541 PretenureFlag pretenure = OpParameter<PretenureFlag>(node->op()); | 542 PretenureFlag pretenure = OpParameter<PretenureFlag>(node->op()); |
542 if (pretenure == NOT_TENURED) { | 543 if (pretenure == NOT_TENURED) { |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
580 } | 581 } |
581 | 582 |
582 | 583 |
583 MachineOperatorBuilder* ChangeLowering::machine() const { | 584 MachineOperatorBuilder* ChangeLowering::machine() const { |
584 return jsgraph()->machine(); | 585 return jsgraph()->machine(); |
585 } | 586 } |
586 | 587 |
587 } // namespace compiler | 588 } // namespace compiler |
588 } // namespace internal | 589 } // namespace internal |
589 } // namespace v8 | 590 } // namespace v8 |
OLD | NEW |