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/compilation-info.h" | 8 #include "src/compilation-info.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 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
474 | 474 |
475 // Constructor must be constructable. | 475 // Constructor must be constructable. |
476 if (node->opcode() == IrOpcode::kJSConstruct && | 476 if (node->opcode() == IrOpcode::kJSConstruct && |
477 IsNonConstructible(shared_info)) { | 477 IsNonConstructible(shared_info)) { |
478 TRACE("Not inlining %s into %s because constructor is not constructable.\n", | 478 TRACE("Not inlining %s into %s because constructor is not constructable.\n", |
479 shared_info->DebugName()->ToCString().get(), | 479 shared_info->DebugName()->ToCString().get(), |
480 info_->shared_info()->DebugName()->ToCString().get()); | 480 info_->shared_info()->DebugName()->ToCString().get()); |
481 return NoChange(); | 481 return NoChange(); |
482 } | 482 } |
483 | 483 |
| 484 // TODO(706642): Don't inline derived class constructors for now, as the |
| 485 // inlining logic doesn't deal properly with derived class constructors |
| 486 // that return a primitive, i.e. it's not in sync with what the Parser |
| 487 // and the JSConstructSub does. |
| 488 if (node->opcode() == IrOpcode::kJSConstruct && |
| 489 IsDerivedConstructor(shared_info->kind())) { |
| 490 TRACE("Not inlining %s into %s because constructor is derived.\n", |
| 491 shared_info->DebugName()->ToCString().get(), |
| 492 info_->shared_info()->DebugName()->ToCString().get()); |
| 493 return NoChange(); |
| 494 } |
| 495 |
484 // Class constructors are callable, but [[Call]] will raise an exception. | 496 // Class constructors are callable, but [[Call]] will raise an exception. |
485 // See ES6 section 9.2.1 [[Call]] ( thisArgument, argumentsList ). | 497 // See ES6 section 9.2.1 [[Call]] ( thisArgument, argumentsList ). |
486 if (node->opcode() == IrOpcode::kJSCall && | 498 if (node->opcode() == IrOpcode::kJSCall && |
487 IsClassConstructor(shared_info->kind())) { | 499 IsClassConstructor(shared_info->kind())) { |
488 TRACE("Not inlining %s into %s because callee is a class constructor.\n", | 500 TRACE("Not inlining %s into %s because callee is a class constructor.\n", |
489 shared_info->DebugName()->ToCString().get(), | 501 shared_info->DebugName()->ToCString().get(), |
490 info_->shared_info()->DebugName()->ToCString().get()); | 502 info_->shared_info()->DebugName()->ToCString().get()); |
491 return NoChange(); | 503 return NoChange(); |
492 } | 504 } |
493 | 505 |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
714 | 726 |
715 CommonOperatorBuilder* JSInliner::common() const { return jsgraph()->common(); } | 727 CommonOperatorBuilder* JSInliner::common() const { return jsgraph()->common(); } |
716 | 728 |
717 SimplifiedOperatorBuilder* JSInliner::simplified() const { | 729 SimplifiedOperatorBuilder* JSInliner::simplified() const { |
718 return jsgraph()->simplified(); | 730 return jsgraph()->simplified(); |
719 } | 731 } |
720 | 732 |
721 } // namespace compiler | 733 } // namespace compiler |
722 } // namespace internal | 734 } // namespace internal |
723 } // namespace v8 | 735 } // namespace v8 |
OLD | NEW |