OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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-intrinsic-lowering.h" | 5 #include "src/compiler/js-intrinsic-lowering.h" |
6 | 6 |
7 #include <stack> | 7 #include <stack> |
8 | 8 |
9 #include "src/code-factory.h" | 9 #include "src/code-factory.h" |
10 #include "src/compiler/access-builder.h" | 10 #include "src/compiler/access-builder.h" |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 case Runtime::kInlineToNumber: | 82 case Runtime::kInlineToNumber: |
83 return ReduceToNumber(node); | 83 return ReduceToNumber(node); |
84 case Runtime::kInlineToObject: | 84 case Runtime::kInlineToObject: |
85 return ReduceToObject(node); | 85 return ReduceToObject(node); |
86 case Runtime::kInlineToPrimitive: | 86 case Runtime::kInlineToPrimitive: |
87 return ReduceToPrimitive(node); | 87 return ReduceToPrimitive(node); |
88 case Runtime::kInlineToString: | 88 case Runtime::kInlineToString: |
89 return ReduceToString(node); | 89 return ReduceToString(node); |
90 case Runtime::kInlineCall: | 90 case Runtime::kInlineCall: |
91 return ReduceCall(node); | 91 return ReduceCall(node); |
| 92 case Runtime::kInlineNewObject: |
| 93 return ReduceNewObject(node); |
92 case Runtime::kInlineGetSuperConstructor: | 94 case Runtime::kInlineGetSuperConstructor: |
93 return ReduceGetSuperConstructor(node); | 95 return ReduceGetSuperConstructor(node); |
94 case Runtime::kInlineGetOrdinaryHasInstance: | 96 case Runtime::kInlineGetOrdinaryHasInstance: |
95 return ReduceGetOrdinaryHasInstance(node); | 97 return ReduceGetOrdinaryHasInstance(node); |
96 default: | 98 default: |
97 break; | 99 break; |
98 } | 100 } |
99 return NoChange(); | 101 return NoChange(); |
100 } | 102 } |
101 | 103 |
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
470 | 472 |
471 Reduction JSIntrinsicLowering::ReduceCall(Node* node) { | 473 Reduction JSIntrinsicLowering::ReduceCall(Node* node) { |
472 size_t const arity = CallRuntimeParametersOf(node->op()).arity(); | 474 size_t const arity = CallRuntimeParametersOf(node->op()).arity(); |
473 NodeProperties::ChangeOp(node, | 475 NodeProperties::ChangeOp(node, |
474 javascript()->CallFunction(arity, VectorSlotPair(), | 476 javascript()->CallFunction(arity, VectorSlotPair(), |
475 ConvertReceiverMode::kAny, | 477 ConvertReceiverMode::kAny, |
476 TailCallMode::kDisallow)); | 478 TailCallMode::kDisallow)); |
477 return Changed(node); | 479 return Changed(node); |
478 } | 480 } |
479 | 481 |
| 482 Reduction JSIntrinsicLowering::ReduceNewObject(Node* node) { |
| 483 Node* constructor = NodeProperties::GetValueInput(node, 0); |
| 484 Node* new_target = NodeProperties::GetValueInput(node, 1); |
| 485 Node* context = NodeProperties::GetContextInput(node); |
| 486 Node* effect = NodeProperties::GetEffectInput(node); |
| 487 Node* frame_state = NodeProperties::GetFrameStateInput(node, 0); |
| 488 Node* value = graph()->NewNode(javascript()->Create(), constructor, |
| 489 new_target, context, frame_state, effect); |
| 490 ReplaceWithValue(node, value, value); |
| 491 return Replace(value); |
| 492 } |
480 | 493 |
481 Reduction JSIntrinsicLowering::ReduceGetSuperConstructor(Node* node) { | 494 Reduction JSIntrinsicLowering::ReduceGetSuperConstructor(Node* node) { |
482 Node* active_function = NodeProperties::GetValueInput(node, 0); | 495 Node* active_function = NodeProperties::GetValueInput(node, 0); |
483 Node* effect = NodeProperties::GetEffectInput(node); | 496 Node* effect = NodeProperties::GetEffectInput(node); |
484 Node* control = NodeProperties::GetControlInput(node); | 497 Node* control = NodeProperties::GetControlInput(node); |
485 Node* active_function_map = effect = | 498 Node* active_function_map = effect = |
486 graph()->NewNode(simplified()->LoadField(AccessBuilder::ForMap()), | 499 graph()->NewNode(simplified()->LoadField(AccessBuilder::ForMap()), |
487 active_function, effect, control); | 500 active_function, effect, control); |
488 return Change(node, simplified()->LoadField(AccessBuilder::ForMapPrototype()), | 501 return Change(node, simplified()->LoadField(AccessBuilder::ForMapPrototype()), |
489 active_function_map, effect, control); | 502 active_function_map, effect, control); |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
574 } | 587 } |
575 | 588 |
576 | 589 |
577 SimplifiedOperatorBuilder* JSIntrinsicLowering::simplified() const { | 590 SimplifiedOperatorBuilder* JSIntrinsicLowering::simplified() const { |
578 return jsgraph()->simplified(); | 591 return jsgraph()->simplified(); |
579 } | 592 } |
580 | 593 |
581 } // namespace compiler | 594 } // namespace compiler |
582 } // namespace internal | 595 } // namespace internal |
583 } // namespace v8 | 596 } // namespace v8 |
OLD | NEW |