| 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.h" | 7 #include "src/ast/ast.h" |
| 8 #include "src/ast/ast-numbering.h" | 8 #include "src/ast/ast-numbering.h" |
| 9 #include "src/ast/scopes.h" | 9 #include "src/ast/scopes.h" |
| 10 #include "src/compiler.h" | 10 #include "src/compiler.h" |
| (...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 438 | 438 |
| 439 // Insert nodes around the call that model the behavior required for a | 439 // Insert nodes around the call that model the behavior required for a |
| 440 // constructor dispatch (allocate implicit receiver and check return value). | 440 // constructor dispatch (allocate implicit receiver and check return value). |
| 441 // This models the behavior usually accomplished by our {JSConstructStub}. | 441 // This models the behavior usually accomplished by our {JSConstructStub}. |
| 442 // Note that the context has to be the callers context (input to call node). | 442 // Note that the context has to be the callers context (input to call node). |
| 443 Node* receiver = jsgraph_->UndefinedConstant(); // Implicit receiver. | 443 Node* receiver = jsgraph_->UndefinedConstant(); // Implicit receiver. |
| 444 if (node->opcode() == IrOpcode::kJSCallConstruct && | 444 if (node->opcode() == IrOpcode::kJSCallConstruct && |
| 445 NeedsImplicitReceiver(function, info_->isolate())) { | 445 NeedsImplicitReceiver(function, info_->isolate())) { |
| 446 Node* effect = NodeProperties::GetEffectInput(node); | 446 Node* effect = NodeProperties::GetEffectInput(node); |
| 447 Node* context = NodeProperties::GetContextInput(node); | 447 Node* context = NodeProperties::GetContextInput(node); |
| 448 Node* create = jsgraph_->graph()->NewNode(jsgraph_->javascript()->Create(), | 448 Node* create = jsgraph_->graph()->NewNode( |
| 449 call.target(), call.new_target(), | 449 jsgraph_->javascript()->Create(), call.target(), call.new_target(), |
| 450 context, frame_state, effect); | 450 context, call.frame_state_before(), effect); |
| 451 NodeProperties::ReplaceEffectInput(node, create); | 451 NodeProperties::ReplaceEffectInput(node, create); |
| 452 // Insert a check of the return value to determine whether the return value | 452 // Insert a check of the return value to determine whether the return value |
| 453 // or the implicit receiver should be selected as a result of the call. | 453 // or the implicit receiver should be selected as a result of the call. |
| 454 Node* check = jsgraph_->graph()->NewNode( | 454 Node* check = jsgraph_->graph()->NewNode( |
| 455 jsgraph_->javascript()->CallRuntime(Runtime::kInlineIsJSReceiver, 1), | 455 jsgraph_->javascript()->CallRuntime(Runtime::kInlineIsJSReceiver, 1), |
| 456 node, context, node, start); | 456 node, context, node, start); |
| 457 Node* select = jsgraph_->graph()->NewNode( | 457 Node* select = jsgraph_->graph()->NewNode( |
| 458 jsgraph_->common()->Select(MachineRepresentation::kTagged), check, node, | 458 jsgraph_->common()->Select(MachineRepresentation::kTagged), check, node, |
| 459 create); | 459 create); |
| 460 NodeProperties::ReplaceUses(node, select, check, node, node); | 460 NodeProperties::ReplaceUses(node, select, check, node, node); |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 511 node, frame_state, call.formal_arguments(), | 511 node, frame_state, call.formal_arguments(), |
| 512 FrameStateType::kArgumentsAdaptor, info.shared_info()); | 512 FrameStateType::kArgumentsAdaptor, info.shared_info()); |
| 513 } | 513 } |
| 514 | 514 |
| 515 return InlineCall(node, new_target, context, frame_state, start, end); | 515 return InlineCall(node, new_target, context, frame_state, start, end); |
| 516 } | 516 } |
| 517 | 517 |
| 518 } // namespace compiler | 518 } // namespace compiler |
| 519 } // namespace internal | 519 } // namespace internal |
| 520 } // namespace v8 | 520 } // namespace v8 |
| OLD | NEW |