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.h" | 7 #include "src/ast.h" |
8 #include "src/ast-numbering.h" | 8 #include "src/ast-numbering.h" |
9 #include "src/compiler.h" | 9 #include "src/compiler.h" |
10 #include "src/compiler/all-nodes.h" | 10 #include "src/compiler/all-nodes.h" |
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
419 // constructor dispatch and turn the constructor call into a regular call. | 419 // constructor dispatch and turn the constructor call into a regular call. |
420 // This models the behavior usually accomplished by our {JSConstructStub}. | 420 // This models the behavior usually accomplished by our {JSConstructStub}. |
421 // Note that the context has to be the callers context (input to call node). | 421 // Note that the context has to be the callers context (input to call node). |
422 if (node->opcode() == IrOpcode::kJSCallConstruct) { | 422 if (node->opcode() == IrOpcode::kJSCallConstruct) { |
423 Node* effect = NodeProperties::GetEffectInput(node); | 423 Node* effect = NodeProperties::GetEffectInput(node); |
424 Node* context = NodeProperties::GetContextInput(node); | 424 Node* context = NodeProperties::GetContextInput(node); |
425 Node* create = jsgraph_->graph()->NewNode(jsgraph_->javascript()->Create(), | 425 Node* create = jsgraph_->graph()->NewNode(jsgraph_->javascript()->Create(), |
426 call.target(), call.new_target(), | 426 call.target(), call.new_target(), |
427 context, frame_state, effect); | 427 context, frame_state, effect); |
428 NodeProperties::ReplaceEffectInput(node, create); | 428 NodeProperties::ReplaceEffectInput(node, create); |
429 // TODO(4544): For now Runtime_GetNewTarget depends on the actual target to | |
430 // coincide with the new target. Fix this! | |
431 CHECK_EQ(call.target(), call.new_target()); | |
432 // TODO(4544): For derived constructors we should not allocate an implicit | 429 // TODO(4544): For derived constructors we should not allocate an implicit |
433 // receiver and also the return value should not be checked afterwards. | 430 // receiver and also the return value should not be checked afterwards. |
434 CHECK(!IsClassConstructor(function->shared()->kind())); | 431 CHECK(!IsClassConstructor(function->shared()->kind())); |
435 // Swizzle the inputs of the {JSCallConstruct} node to look like inputs to | 432 // Swizzle the inputs of the {JSCallConstruct} node to look like inputs to |
436 // any {JSCallFunction} node so that the rest of the inlining machinery | 433 // any {JSCallFunction} node so that the rest of the inlining machinery |
437 // behaves as if we were dealing with a regular function invocation. | 434 // behaves as if we were dealing with a regular function invocation. |
438 new_target = call.new_target(); // Retrieve new target value input. | 435 new_target = call.new_target(); // Retrieve new target value input. |
439 node->RemoveInput(call.formal_arguments() + 1); // Drop new target. | 436 node->RemoveInput(call.formal_arguments() + 1); // Drop new target. |
440 node->InsertInput(jsgraph_->graph()->zone(), 1, create); | 437 node->InsertInput(jsgraph_->graph()->zone(), 1, create); |
441 // Insert a check of the return value to determine whether the return value | 438 // Insert a check of the return value to determine whether the return value |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
489 node, frame_state, call.formal_arguments(), | 486 node, frame_state, call.formal_arguments(), |
490 FrameStateType::kArgumentsAdaptor, info.shared_info()); | 487 FrameStateType::kArgumentsAdaptor, info.shared_info()); |
491 } | 488 } |
492 | 489 |
493 return InlineCall(node, new_target, context, frame_state, start, end); | 490 return InlineCall(node, new_target, context, frame_state, start, end); |
494 } | 491 } |
495 | 492 |
496 } // namespace compiler | 493 } // namespace compiler |
497 } // namespace internal | 494 } // namespace internal |
498 } // namespace v8 | 495 } // namespace v8 |
OLD | NEW |