| 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/compiler/js-inlining.h" | 5 #include "src/compiler/js-inlining.h" |
| 6 | 6 |
| 7 #include "src/ast/ast-numbering.h" | 7 #include "src/ast/ast-numbering.h" |
| 8 #include "src/ast/ast.h" | 8 #include "src/ast/ast.h" |
| 9 #include "src/ast/scopes.h" | 9 #include "src/ast/scopes.h" |
| 10 #include "src/compiler.h" | 10 #include "src/compiler.h" |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 return call_->InputAt(1); | 50 return call_->InputAt(1); |
| 51 } | 51 } |
| 52 | 52 |
| 53 Node* new_target() { | 53 Node* new_target() { |
| 54 DCHECK_EQ(IrOpcode::kJSCallConstruct, call_->opcode()); | 54 DCHECK_EQ(IrOpcode::kJSCallConstruct, call_->opcode()); |
| 55 return call_->InputAt(formal_arguments() + 1); | 55 return call_->InputAt(formal_arguments() + 1); |
| 56 } | 56 } |
| 57 | 57 |
| 58 Node* frame_state() { | 58 Node* frame_state() { |
| 59 // Both, {JSCallFunction} and {JSCallConstruct}, have frame state. | 59 // Both, {JSCallFunction} and {JSCallConstruct}, have frame state. |
| 60 return NodeProperties::GetFrameStateInput(call_, 0); | 60 return NodeProperties::GetFrameStateInput(call_); |
| 61 } | 61 } |
| 62 | 62 |
| 63 int formal_arguments() { | 63 int formal_arguments() { |
| 64 // Both, {JSCallFunction} and {JSCallConstruct}, have two extra inputs: | 64 // Both, {JSCallFunction} and {JSCallConstruct}, have two extra inputs: |
| 65 // - JSCallConstruct: Includes target function and new target. | 65 // - JSCallConstruct: Includes target function and new target. |
| 66 // - JSCallFunction: Includes target function and receiver. | 66 // - JSCallFunction: Includes target function and receiver. |
| 67 return call_->op()->ValueInputCount() - 2; | 67 return call_->op()->ValueInputCount() - 2; |
| 68 } | 68 } |
| 69 | 69 |
| 70 private: | 70 private: |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 | 205 |
| 206 Node* JSInliner::CreateTailCallerFrameState(Node* node, Node* frame_state) { | 206 Node* JSInliner::CreateTailCallerFrameState(Node* node, Node* frame_state) { |
| 207 FrameStateInfo const& frame_info = OpParameter<FrameStateInfo>(frame_state); | 207 FrameStateInfo const& frame_info = OpParameter<FrameStateInfo>(frame_state); |
| 208 Handle<SharedFunctionInfo> shared; | 208 Handle<SharedFunctionInfo> shared; |
| 209 frame_info.shared_info().ToHandle(&shared); | 209 frame_info.shared_info().ToHandle(&shared); |
| 210 | 210 |
| 211 Node* function = frame_state->InputAt(kFrameStateFunctionInput); | 211 Node* function = frame_state->InputAt(kFrameStateFunctionInput); |
| 212 | 212 |
| 213 // If we are inlining a tail call drop caller's frame state and an | 213 // If we are inlining a tail call drop caller's frame state and an |
| 214 // arguments adaptor if it exists. | 214 // arguments adaptor if it exists. |
| 215 frame_state = NodeProperties::GetFrameStateInput(frame_state, 0); | 215 frame_state = NodeProperties::GetFrameStateInput(frame_state); |
| 216 if (frame_state->opcode() == IrOpcode::kFrameState) { | 216 if (frame_state->opcode() == IrOpcode::kFrameState) { |
| 217 FrameStateInfo const& frame_info = OpParameter<FrameStateInfo>(frame_state); | 217 FrameStateInfo const& frame_info = OpParameter<FrameStateInfo>(frame_state); |
| 218 if (frame_info.type() == FrameStateType::kArgumentsAdaptor) { | 218 if (frame_info.type() == FrameStateType::kArgumentsAdaptor) { |
| 219 frame_state = NodeProperties::GetFrameStateInput(frame_state, 0); | 219 frame_state = NodeProperties::GetFrameStateInput(frame_state); |
| 220 } | 220 } |
| 221 } | 221 } |
| 222 | 222 |
| 223 const FrameStateFunctionInfo* state_info = | 223 const FrameStateFunctionInfo* state_info = |
| 224 jsgraph_->common()->CreateFrameStateFunctionInfo( | 224 jsgraph_->common()->CreateFrameStateFunctionInfo( |
| 225 FrameStateType::kTailCallerFunction, 0, 0, shared); | 225 FrameStateType::kTailCallerFunction, 0, 0, shared); |
| 226 | 226 |
| 227 const Operator* op = jsgraph_->common()->FrameState( | 227 const Operator* op = jsgraph_->common()->FrameState( |
| 228 BailoutId(-1), OutputFrameStateCombine::Ignore(), state_info); | 228 BailoutId(-1), OutputFrameStateCombine::Ignore(), state_info); |
| 229 const Operator* op0 = jsgraph_->common()->StateValues(0); | 229 const Operator* op0 = jsgraph_->common()->StateValues(0); |
| (...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 515 } | 515 } |
| 516 | 516 |
| 517 return InlineCall(node, new_target, context, frame_state, start, end); | 517 return InlineCall(node, new_target, context, frame_state, start, end); |
| 518 } | 518 } |
| 519 | 519 |
| 520 Graph* JSInliner::graph() const { return jsgraph()->graph(); } | 520 Graph* JSInliner::graph() const { return jsgraph()->graph(); } |
| 521 | 521 |
| 522 } // namespace compiler | 522 } // namespace compiler |
| 523 } // namespace internal | 523 } // namespace internal |
| 524 } // namespace v8 | 524 } // namespace v8 |
| OLD | NEW |