OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 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/js-create-lowering.h" | 5 #include "src/compiler/js-create-lowering.h" |
6 | 6 |
7 #include "src/allocation-site-scopes.h" | 7 #include "src/allocation-site-scopes.h" |
8 #include "src/code-factory.h" | 8 #include "src/code-factory.h" |
9 #include "src/compilation-dependencies.h" | 9 #include "src/compilation-dependencies.h" |
10 #include "src/compiler/access-builder.h" | 10 #include "src/compiler/access-builder.h" |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 | 95 |
96 private: | 96 private: |
97 JSGraph* const jsgraph_; | 97 JSGraph* const jsgraph_; |
98 Node* allocation_; | 98 Node* allocation_; |
99 Node* effect_; | 99 Node* effect_; |
100 Node* control_; | 100 Node* control_; |
101 }; | 101 }; |
102 | 102 |
103 // Retrieves the frame state holding actual argument values. | 103 // Retrieves the frame state holding actual argument values. |
104 Node* GetArgumentsFrameState(Node* frame_state) { | 104 Node* GetArgumentsFrameState(Node* frame_state) { |
105 Node* const outer_state = NodeProperties::GetFrameStateInput(frame_state, 0); | 105 Node* const outer_state = NodeProperties::GetFrameStateInput(frame_state); |
106 FrameStateInfo outer_state_info = OpParameter<FrameStateInfo>(outer_state); | 106 FrameStateInfo outer_state_info = OpParameter<FrameStateInfo>(outer_state); |
107 return outer_state_info.type() == FrameStateType::kArgumentsAdaptor | 107 return outer_state_info.type() == FrameStateType::kArgumentsAdaptor |
108 ? outer_state | 108 ? outer_state |
109 : frame_state; | 109 : frame_state; |
110 } | 110 } |
111 | 111 |
112 // Checks whether allocation using the given target and new.target can be | 112 // Checks whether allocation using the given target and new.target can be |
113 // inlined. | 113 // inlined. |
114 bool IsAllocationInlineable(Handle<JSFunction> target, | 114 bool IsAllocationInlineable(Handle<JSFunction> target, |
115 Handle<JSFunction> new_target) { | 115 Handle<JSFunction> new_target) { |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
272 a.FinishAndChange(node); | 272 a.FinishAndChange(node); |
273 return Changed(node); | 273 return Changed(node); |
274 } | 274 } |
275 } | 275 } |
276 return NoChange(); | 276 return NoChange(); |
277 } | 277 } |
278 | 278 |
279 Reduction JSCreateLowering::ReduceJSCreateArguments(Node* node) { | 279 Reduction JSCreateLowering::ReduceJSCreateArguments(Node* node) { |
280 DCHECK_EQ(IrOpcode::kJSCreateArguments, node->opcode()); | 280 DCHECK_EQ(IrOpcode::kJSCreateArguments, node->opcode()); |
281 CreateArgumentsType type = CreateArgumentsTypeOf(node->op()); | 281 CreateArgumentsType type = CreateArgumentsTypeOf(node->op()); |
282 Node* const frame_state = NodeProperties::GetFrameStateInput(node, 0); | 282 Node* const frame_state = NodeProperties::GetFrameStateInput(node); |
283 Node* const outer_state = frame_state->InputAt(kFrameStateOuterStateInput); | 283 Node* const outer_state = frame_state->InputAt(kFrameStateOuterStateInput); |
284 Node* const control = graph()->start(); | 284 Node* const control = graph()->start(); |
285 FrameStateInfo state_info = OpParameter<FrameStateInfo>(frame_state); | 285 FrameStateInfo state_info = OpParameter<FrameStateInfo>(frame_state); |
286 | 286 |
287 // Use the ArgumentsAccessStub for materializing both mapped and unmapped | 287 // Use the ArgumentsAccessStub for materializing both mapped and unmapped |
288 // arguments object, but only for non-inlined (i.e. outermost) frames. | 288 // arguments object, but only for non-inlined (i.e. outermost) frames. |
289 if (outer_state->opcode() != IrOpcode::kFrameState) { | 289 if (outer_state->opcode() != IrOpcode::kFrameState) { |
290 switch (type) { | 290 switch (type) { |
291 case CreateArgumentsType::kMappedArguments: { | 291 case CreateArgumentsType::kMappedArguments: { |
292 // TODO(mstarzinger): Duplicate parameters are not handled yet. | 292 // TODO(mstarzinger): Duplicate parameters are not handled yet. |
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
558 Node* equal = graph()->NewNode(simplified()->ReferenceEqual(Type::Any()), | 558 Node* equal = graph()->NewNode(simplified()->ReferenceEqual(Type::Any()), |
559 length, jsgraph()->ZeroConstant()); | 559 length, jsgraph()->ZeroConstant()); |
560 | 560 |
561 Node* branch = | 561 Node* branch = |
562 graph()->NewNode(common()->Branch(BranchHint::kFalse), equal, control); | 562 graph()->NewNode(common()->Branch(BranchHint::kFalse), equal, control); |
563 Node* call_holey; | 563 Node* call_holey; |
564 Node* call_packed; | 564 Node* call_packed; |
565 Node* if_success_packed; | 565 Node* if_success_packed; |
566 Node* if_success_holey; | 566 Node* if_success_holey; |
567 Node* context = NodeProperties::GetContextInput(node); | 567 Node* context = NodeProperties::GetContextInput(node); |
568 Node* frame_state = NodeProperties::GetFrameStateInput(node, 0); | 568 Node* frame_state = NodeProperties::GetFrameStateInput(node); |
569 Node* if_equal = graph()->NewNode(common()->IfTrue(), branch); | 569 Node* if_equal = graph()->NewNode(common()->IfTrue(), branch); |
570 { | 570 { |
571 ArraySingleArgumentConstructorStub stub(isolate(), elements_kind, | 571 ArraySingleArgumentConstructorStub stub(isolate(), elements_kind, |
572 override_mode); | 572 override_mode); |
573 CallDescriptor* desc = Linkage::GetStubCallDescriptor( | 573 CallDescriptor* desc = Linkage::GetStubCallDescriptor( |
574 isolate(), graph()->zone(), stub.GetCallInterfaceDescriptor(), 2, | 574 isolate(), graph()->zone(), stub.GetCallInterfaceDescriptor(), 2, |
575 CallDescriptor::kNeedsFrameState); | 575 CallDescriptor::kNeedsFrameState); |
576 | 576 |
577 Node* inputs[] = {jsgraph()->HeapConstant(stub.GetCode()), | 577 Node* inputs[] = {jsgraph()->HeapConstant(stub.GetCode()), |
578 node->InputAt(1), | 578 node->InputAt(1), |
(...skipping 683 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1262 return jsgraph()->simplified(); | 1262 return jsgraph()->simplified(); |
1263 } | 1263 } |
1264 | 1264 |
1265 MachineOperatorBuilder* JSCreateLowering::machine() const { | 1265 MachineOperatorBuilder* JSCreateLowering::machine() const { |
1266 return jsgraph()->machine(); | 1266 return jsgraph()->machine(); |
1267 } | 1267 } |
1268 | 1268 |
1269 } // namespace compiler | 1269 } // namespace compiler |
1270 } // namespace internal | 1270 } // namespace internal |
1271 } // namespace v8 | 1271 } // namespace v8 |
OLD | NEW |