| 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 14 matching lines...) Expand all Loading... |
| 25 : AdvancedReducer(editor), jsgraph_(jsgraph), mode_(mode) {} | 25 : AdvancedReducer(editor), jsgraph_(jsgraph), mode_(mode) {} |
| 26 | 26 |
| 27 Reduction JSIntrinsicLowering::Reduce(Node* node) { | 27 Reduction JSIntrinsicLowering::Reduce(Node* node) { |
| 28 if (node->opcode() != IrOpcode::kJSCallRuntime) return NoChange(); | 28 if (node->opcode() != IrOpcode::kJSCallRuntime) return NoChange(); |
| 29 const Runtime::Function* const f = | 29 const Runtime::Function* const f = |
| 30 Runtime::FunctionForId(CallRuntimeParametersOf(node->op()).id()); | 30 Runtime::FunctionForId(CallRuntimeParametersOf(node->op()).id()); |
| 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: |
| 36 return ReduceDebugIsActive(node); |
| 35 case Runtime::kInlineDeoptimizeNow: | 37 case Runtime::kInlineDeoptimizeNow: |
| 36 return ReduceDeoptimizeNow(node); | 38 return ReduceDeoptimizeNow(node); |
| 37 case Runtime::kInlineGeneratorClose: | 39 case Runtime::kInlineGeneratorClose: |
| 38 return ReduceGeneratorClose(node); | 40 return ReduceGeneratorClose(node); |
| 39 case Runtime::kInlineGeneratorGetInputOrDebugPos: | 41 case Runtime::kInlineGeneratorGetInputOrDebugPos: |
| 40 return ReduceGeneratorGetInputOrDebugPos(node); | 42 return ReduceGeneratorGetInputOrDebugPos(node); |
| 41 case Runtime::kInlineGeneratorGetResumeMode: | 43 case Runtime::kInlineGeneratorGetResumeMode: |
| 42 return ReduceGeneratorGetResumeMode(node); | 44 return ReduceGeneratorGetResumeMode(node); |
| 43 case Runtime::kInlineIsArray: | 45 case Runtime::kInlineIsArray: |
| 44 return ReduceIsInstanceType(node, JS_ARRAY_TYPE); | 46 return ReduceIsInstanceType(node, JS_ARRAY_TYPE); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 | 85 |
| 84 Reduction JSIntrinsicLowering::ReduceCreateIterResultObject(Node* node) { | 86 Reduction JSIntrinsicLowering::ReduceCreateIterResultObject(Node* node) { |
| 85 Node* const value = NodeProperties::GetValueInput(node, 0); | 87 Node* const value = NodeProperties::GetValueInput(node, 0); |
| 86 Node* const done = NodeProperties::GetValueInput(node, 1); | 88 Node* const done = NodeProperties::GetValueInput(node, 1); |
| 87 Node* const context = NodeProperties::GetContextInput(node); | 89 Node* const context = NodeProperties::GetContextInput(node); |
| 88 Node* const effect = NodeProperties::GetEffectInput(node); | 90 Node* const effect = NodeProperties::GetEffectInput(node); |
| 89 return Change(node, javascript()->CreateIterResultObject(), value, done, | 91 return Change(node, javascript()->CreateIterResultObject(), value, done, |
| 90 context, effect); | 92 context, effect); |
| 91 } | 93 } |
| 92 | 94 |
| 95 Reduction JSIntrinsicLowering::ReduceDebugIsActive(Node* node) { |
| 96 Node* const value = jsgraph()->ExternalConstant( |
| 97 ExternalReference::debug_is_active_address(isolate())); |
| 98 Node* const effect = NodeProperties::GetEffectInput(node); |
| 99 Node* const control = NodeProperties::GetControlInput(node); |
| 100 Operator const* const op = |
| 101 simplified()->LoadField(AccessBuilder::ForExternalUint8Value()); |
| 102 return Change(node, op, value, effect, control); |
| 103 } |
| 93 | 104 |
| 94 Reduction JSIntrinsicLowering::ReduceDeoptimizeNow(Node* node) { | 105 Reduction JSIntrinsicLowering::ReduceDeoptimizeNow(Node* node) { |
| 95 if (mode() != kDeoptimizationEnabled) return NoChange(); | 106 if (mode() != kDeoptimizationEnabled) return NoChange(); |
| 96 Node* const frame_state = NodeProperties::GetFrameStateInput(node); | 107 Node* const frame_state = NodeProperties::GetFrameStateInput(node); |
| 97 Node* const effect = NodeProperties::GetEffectInput(node); | 108 Node* const effect = NodeProperties::GetEffectInput(node); |
| 98 Node* const control = NodeProperties::GetControlInput(node); | 109 Node* const control = NodeProperties::GetControlInput(node); |
| 99 | 110 |
| 100 // TODO(bmeurer): Move MergeControlToEnd() to the AdvancedReducer. | 111 // TODO(bmeurer): Move MergeControlToEnd() to the AdvancedReducer. |
| 101 Node* deoptimize = graph()->NewNode( | 112 Node* deoptimize = graph()->NewNode( |
| 102 common()->Deoptimize(DeoptimizeKind::kEager, DeoptimizeReason::kNoReason), | 113 common()->Deoptimize(DeoptimizeKind::kEager, DeoptimizeReason::kNoReason), |
| (...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 354 return jsgraph_->javascript(); | 365 return jsgraph_->javascript(); |
| 355 } | 366 } |
| 356 | 367 |
| 357 SimplifiedOperatorBuilder* JSIntrinsicLowering::simplified() const { | 368 SimplifiedOperatorBuilder* JSIntrinsicLowering::simplified() const { |
| 358 return jsgraph()->simplified(); | 369 return jsgraph()->simplified(); |
| 359 } | 370 } |
| 360 | 371 |
| 361 } // namespace compiler | 372 } // namespace compiler |
| 362 } // namespace internal | 373 } // namespace internal |
| 363 } // namespace v8 | 374 } // namespace v8 |
| OLD | NEW |