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 543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
554 access.machine_type.representation(), | 554 access.machine_type.representation(), |
555 ComputeWriteBarrierKind(access.base_is_tagged, | 555 ComputeWriteBarrierKind(access.base_is_tagged, |
556 access.machine_type.representation(), | 556 access.machine_type.representation(), |
557 access.type, type)))); | 557 access.type, type)))); |
558 return Changed(node); | 558 return Changed(node); |
559 } | 559 } |
560 | 560 |
561 | 561 |
562 Reduction ChangeLowering::Allocate(Node* node) { | 562 Reduction ChangeLowering::Allocate(Node* node) { |
563 PretenureFlag pretenure = OpParameter<PretenureFlag>(node->op()); | 563 PretenureFlag pretenure = OpParameter<PretenureFlag>(node->op()); |
564 if (pretenure == NOT_TENURED) { | 564 Callable callable = CodeFactory::Allocate(isolate(), pretenure); |
565 Callable callable = CodeFactory::AllocateInNewSpace(isolate()); | 565 Node* target = jsgraph()->HeapConstant(callable.code()); |
566 Node* target = jsgraph()->HeapConstant(callable.code()); | 566 CallDescriptor* descriptor = Linkage::GetStubCallDescriptor( |
567 CallDescriptor* descriptor = Linkage::GetStubCallDescriptor( | 567 isolate(), jsgraph()->zone(), callable.descriptor(), 0, |
568 isolate(), jsgraph()->zone(), callable.descriptor(), 0, | 568 CallDescriptor::kNoFlags, Operator::kNoThrow); |
569 CallDescriptor::kNoFlags, Operator::kNoThrow); | 569 const Operator* op = common()->Call(descriptor); |
570 const Operator* op = common()->Call(descriptor); | 570 node->InsertInput(graph()->zone(), 0, target); |
571 node->InsertInput(graph()->zone(), 0, target); | 571 node->InsertInput(graph()->zone(), 2, jsgraph()->NoContextConstant()); |
572 node->InsertInput(graph()->zone(), 2, jsgraph()->NoContextConstant()); | 572 NodeProperties::ChangeOp(node, op); |
573 NodeProperties::ChangeOp(node, op); | |
574 } else { | |
575 DCHECK_EQ(TENURED, pretenure); | |
576 AllocationSpace space = OLD_SPACE; | |
577 Runtime::FunctionId f = Runtime::kAllocateInTargetSpace; | |
578 Operator::Properties props = node->op()->properties(); | |
579 CallDescriptor* desc = Linkage::GetRuntimeCallDescriptor( | |
580 jsgraph()->zone(), f, 2, props, CallDescriptor::kNeedsFrameState); | |
581 ExternalReference ref(f, jsgraph()->isolate()); | |
582 int32_t flags = AllocateTargetSpace::encode(space); | |
583 node->InsertInput(graph()->zone(), 0, jsgraph()->CEntryStubConstant(1)); | |
584 node->InsertInput(graph()->zone(), 2, jsgraph()->SmiConstant(flags)); | |
585 node->InsertInput(graph()->zone(), 3, jsgraph()->ExternalConstant(ref)); | |
586 node->InsertInput(graph()->zone(), 4, jsgraph()->Int32Constant(2)); | |
587 node->InsertInput(graph()->zone(), 5, jsgraph()->NoContextConstant()); | |
588 NodeProperties::ChangeOp(node, common()->Call(desc)); | |
589 } | |
590 return Changed(node); | 573 return Changed(node); |
591 } | 574 } |
592 | 575 |
593 Node* ChangeLowering::IsSmi(Node* value) { | 576 Node* ChangeLowering::IsSmi(Node* value) { |
594 return graph()->NewNode( | 577 return graph()->NewNode( |
595 machine()->WordEqual(), | 578 machine()->WordEqual(), |
596 graph()->NewNode(machine()->WordAnd(), value, | 579 graph()->NewNode(machine()->WordAnd(), value, |
597 jsgraph()->IntPtrConstant(kSmiTagMask)), | 580 jsgraph()->IntPtrConstant(kSmiTagMask)), |
598 jsgraph()->IntPtrConstant(kSmiTag)); | 581 jsgraph()->IntPtrConstant(kSmiTag)); |
599 } | 582 } |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
739 } | 722 } |
740 | 723 |
741 | 724 |
742 MachineOperatorBuilder* ChangeLowering::machine() const { | 725 MachineOperatorBuilder* ChangeLowering::machine() const { |
743 return jsgraph()->machine(); | 726 return jsgraph()->machine(); |
744 } | 727 } |
745 | 728 |
746 } // namespace compiler | 729 } // namespace compiler |
747 } // namespace internal | 730 } // namespace internal |
748 } // namespace v8 | 731 } // namespace v8 |
OLD | NEW |