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 20 matching lines...) Expand all Loading... |
31 if (f->intrinsic_type != Runtime::IntrinsicType::INLINE) return NoChange(); | 31 if (f->intrinsic_type != Runtime::IntrinsicType::INLINE) return NoChange(); |
32 switch (f->function_id) { | 32 switch (f->function_id) { |
33 case Runtime::kInlineCreateIterResultObject: | 33 case Runtime::kInlineCreateIterResultObject: |
34 return ReduceCreateIterResultObject(node); | 34 return ReduceCreateIterResultObject(node); |
35 case Runtime::kInlineDebugIsActive: | 35 case Runtime::kInlineDebugIsActive: |
36 return ReduceDebugIsActive(node); | 36 return ReduceDebugIsActive(node); |
37 case Runtime::kInlineDeoptimizeNow: | 37 case Runtime::kInlineDeoptimizeNow: |
38 return ReduceDeoptimizeNow(node); | 38 return ReduceDeoptimizeNow(node); |
39 case Runtime::kInlineGeneratorClose: | 39 case Runtime::kInlineGeneratorClose: |
40 return ReduceGeneratorClose(node); | 40 return ReduceGeneratorClose(node); |
| 41 case Runtime::kInlineCreateJSGeneratorObject: |
| 42 return ReduceCreateJSGeneratorObject(node); |
41 case Runtime::kInlineGeneratorGetInputOrDebugPos: | 43 case Runtime::kInlineGeneratorGetInputOrDebugPos: |
42 return ReduceGeneratorGetInputOrDebugPos(node); | 44 return ReduceGeneratorGetInputOrDebugPos(node); |
43 case Runtime::kInlineAsyncGeneratorGetAwaitInputOrDebugPos: | 45 case Runtime::kInlineAsyncGeneratorGetAwaitInputOrDebugPos: |
44 return ReduceAsyncGeneratorGetAwaitInputOrDebugPos(node); | 46 return ReduceAsyncGeneratorGetAwaitInputOrDebugPos(node); |
45 case Runtime::kInlineAsyncGeneratorReject: | 47 case Runtime::kInlineAsyncGeneratorReject: |
46 return ReduceAsyncGeneratorReject(node); | 48 return ReduceAsyncGeneratorReject(node); |
47 case Runtime::kInlineAsyncGeneratorResolve: | 49 case Runtime::kInlineAsyncGeneratorResolve: |
48 return ReduceAsyncGeneratorResolve(node); | 50 return ReduceAsyncGeneratorResolve(node); |
49 case Runtime::kInlineGeneratorGetResumeMode: | 51 case Runtime::kInlineGeneratorGetResumeMode: |
50 return ReduceGeneratorGetResumeMode(node); | 52 return ReduceGeneratorGetResumeMode(node); |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 common()->Deoptimize(DeoptimizeKind::kEager, DeoptimizeReason::kNoReason), | 154 common()->Deoptimize(DeoptimizeKind::kEager, DeoptimizeReason::kNoReason), |
153 frame_state, effect, control); | 155 frame_state, effect, control); |
154 NodeProperties::MergeControlToEnd(graph(), common(), deoptimize); | 156 NodeProperties::MergeControlToEnd(graph(), common(), deoptimize); |
155 Revisit(graph()->end()); | 157 Revisit(graph()->end()); |
156 | 158 |
157 node->TrimInputCount(0); | 159 node->TrimInputCount(0); |
158 NodeProperties::ChangeOp(node, common()->Dead()); | 160 NodeProperties::ChangeOp(node, common()->Dead()); |
159 return Changed(node); | 161 return Changed(node); |
160 } | 162 } |
161 | 163 |
| 164 Reduction JSIntrinsicLowering::ReduceCreateJSGeneratorObject(Node* node) { |
| 165 Node* const closure = NodeProperties::GetValueInput(node, 0); |
| 166 Node* const receiver = NodeProperties::GetValueInput(node, 1); |
| 167 Node* const context = NodeProperties::GetContextInput(node); |
| 168 Node* const effect = NodeProperties::GetEffectInput(node); |
| 169 Node* const control = NodeProperties::GetControlInput(node); |
| 170 Operator const* const op = javascript()->CreateGeneratorObject(); |
| 171 Node* create_generator = |
| 172 graph()->NewNode(op, closure, receiver, context, effect, control); |
| 173 ReplaceWithValue(node, create_generator, create_generator); |
| 174 return Changed(create_generator); |
| 175 } |
| 176 |
162 Reduction JSIntrinsicLowering::ReduceGeneratorClose(Node* node) { | 177 Reduction JSIntrinsicLowering::ReduceGeneratorClose(Node* node) { |
163 Node* const generator = NodeProperties::GetValueInput(node, 0); | 178 Node* const generator = NodeProperties::GetValueInput(node, 0); |
164 Node* const effect = NodeProperties::GetEffectInput(node); | 179 Node* const effect = NodeProperties::GetEffectInput(node); |
165 Node* const control = NodeProperties::GetControlInput(node); | 180 Node* const control = NodeProperties::GetControlInput(node); |
166 Node* const closed = jsgraph()->Constant(JSGeneratorObject::kGeneratorClosed); | 181 Node* const closed = jsgraph()->Constant(JSGeneratorObject::kGeneratorClosed); |
167 Node* const undefined = jsgraph()->UndefinedConstant(); | 182 Node* const undefined = jsgraph()->UndefinedConstant(); |
168 Operator const* const op = simplified()->StoreField( | 183 Operator const* const op = simplified()->StoreField( |
169 AccessBuilder::ForJSGeneratorObjectContinuation()); | 184 AccessBuilder::ForJSGeneratorObjectContinuation()); |
170 | 185 |
171 ReplaceWithValue(node, undefined, node); | 186 ReplaceWithValue(node, undefined, node); |
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
506 return jsgraph_->javascript(); | 521 return jsgraph_->javascript(); |
507 } | 522 } |
508 | 523 |
509 SimplifiedOperatorBuilder* JSIntrinsicLowering::simplified() const { | 524 SimplifiedOperatorBuilder* JSIntrinsicLowering::simplified() const { |
510 return jsgraph()->simplified(); | 525 return jsgraph()->simplified(); |
511 } | 526 } |
512 | 527 |
513 } // namespace compiler | 528 } // namespace compiler |
514 } // namespace internal | 529 } // namespace internal |
515 } // namespace v8 | 530 } // namespace v8 |
OLD | NEW |