| 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/code-factory.h" | 5 #include "src/code-factory.h" |
| 6 #include "src/code-stubs.h" | 6 #include "src/code-stubs.h" |
| 7 #include "src/compiler/common-operator.h" | 7 #include "src/compiler/common-operator.h" |
| 8 #include "src/compiler/js-generic-lowering.h" | 8 #include "src/compiler/js-generic-lowering.h" |
| 9 #include "src/compiler/machine-operator.h" | 9 #include "src/compiler/machine-operator.h" |
| 10 #include "src/compiler/node-matchers.h" | 10 #include "src/compiler/node-matchers.h" |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 CallDescriptor::Flags result = CallDescriptor::kNoFlags; | 119 CallDescriptor::Flags result = CallDescriptor::kNoFlags; |
| 120 if (OperatorProperties::HasFrameStateInput(node->op())) { | 120 if (OperatorProperties::HasFrameStateInput(node->op())) { |
| 121 result |= CallDescriptor::kNeedsFrameState; | 121 result |= CallDescriptor::kNeedsFrameState; |
| 122 } | 122 } |
| 123 return result; | 123 return result; |
| 124 } | 124 } |
| 125 | 125 |
| 126 | 126 |
| 127 void JSGenericLowering::ReplaceWithCompareIC(Node* node, Token::Value token) { | 127 void JSGenericLowering::ReplaceWithCompareIC(Node* node, Token::Value token) { |
| 128 Callable callable = CodeFactory::CompareIC(isolate(), token); | 128 Callable callable = CodeFactory::CompareIC(isolate(), token); |
| 129 bool has_frame_state = OperatorProperties::HasFrameStateInput(node->op()); | |
| 130 CallDescriptor* desc_compare = Linkage::GetStubCallDescriptor( | 129 CallDescriptor* desc_compare = Linkage::GetStubCallDescriptor( |
| 131 isolate(), zone(), callable.descriptor(), 0, | 130 isolate(), zone(), callable.descriptor(), 0, |
| 132 CallDescriptor::kPatchableCallSiteWithNop | FlagsForNode(node)); | 131 CallDescriptor::kPatchableCallSiteWithNop | FlagsForNode(node)); |
| 133 | 132 |
| 134 // Create a new call node asking a CompareIC for help. | 133 // Create a new call node asking a CompareIC for help. |
| 135 NodeVector inputs(zone()); | 134 NodeVector inputs(zone()); |
| 136 inputs.reserve(node->InputCount() + 1); | 135 inputs.reserve(node->InputCount() + 1); |
| 137 inputs.push_back(jsgraph()->HeapConstant(callable.code())); | 136 inputs.push_back(jsgraph()->HeapConstant(callable.code())); |
| 138 inputs.push_back(NodeProperties::GetValueInput(node, 0)); | 137 inputs.push_back(NodeProperties::GetValueInput(node, 0)); |
| 139 inputs.push_back(NodeProperties::GetValueInput(node, 1)); | 138 inputs.push_back(NodeProperties::GetValueInput(node, 1)); |
| 140 inputs.push_back(NodeProperties::GetContextInput(node)); | 139 inputs.push_back(NodeProperties::GetContextInput(node)); |
| 141 if (node->op()->HasProperty(Operator::kPure)) { | 140 if (node->op()->HasProperty(Operator::kPure)) { |
| 142 // A pure (strict) comparison doesn't have an effect, control or frame | 141 // A pure (strict) comparison doesn't have an effect, control or frame |
| 143 // state. But for the graph, we need to add control and effect inputs. | 142 // state. But for the graph, we need to add control and effect inputs. |
| 144 DCHECK(!has_frame_state); | 143 DCHECK(!OperatorProperties::HasFrameStateInput(node->op())); |
| 145 inputs.push_back(graph()->start()); | 144 inputs.push_back(graph()->start()); |
| 146 inputs.push_back(graph()->start()); | 145 inputs.push_back(graph()->start()); |
| 147 } else { | 146 } else { |
| 148 DCHECK(has_frame_state == FLAG_turbo_deoptimization); | 147 DCHECK(OperatorProperties::HasFrameStateInput(node->op()) == |
| 148 FLAG_turbo_deoptimization); |
| 149 if (FLAG_turbo_deoptimization) { | 149 if (FLAG_turbo_deoptimization) { |
| 150 inputs.push_back(NodeProperties::GetFrameStateInput(node)); | 150 inputs.push_back(NodeProperties::GetFrameStateInput(node)); |
| 151 } | 151 } |
| 152 inputs.push_back(NodeProperties::GetEffectInput(node)); | 152 inputs.push_back(NodeProperties::GetEffectInput(node)); |
| 153 inputs.push_back(NodeProperties::GetControlInput(node)); | 153 inputs.push_back(NodeProperties::GetControlInput(node)); |
| 154 } | 154 } |
| 155 Node* compare = | 155 Node* compare = |
| 156 graph()->NewNode(common()->Call(desc_compare), | 156 graph()->NewNode(common()->Call(desc_compare), |
| 157 static_cast<int>(inputs.size()), &inputs.front()); | 157 static_cast<int>(inputs.size()), &inputs.front()); |
| 158 NodeProperties::SetBounds( | 158 NodeProperties::SetBounds( |
| (...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 482 | 482 |
| 483 | 483 |
| 484 void JSGenericLowering::LowerJSCallRuntime(Node* node) { | 484 void JSGenericLowering::LowerJSCallRuntime(Node* node) { |
| 485 const CallRuntimeParameters& p = CallRuntimeParametersOf(node->op()); | 485 const CallRuntimeParameters& p = CallRuntimeParametersOf(node->op()); |
| 486 ReplaceWithRuntimeCall(node, p.id(), static_cast<int>(p.arity())); | 486 ReplaceWithRuntimeCall(node, p.id(), static_cast<int>(p.arity())); |
| 487 } | 487 } |
| 488 | 488 |
| 489 } // namespace compiler | 489 } // namespace compiler |
| 490 } // namespace internal | 490 } // namespace internal |
| 491 } // namespace v8 | 491 } // namespace v8 |
| OLD | NEW |