| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "vm/parser.h" | 5 #include "vm/parser.h" |
| 6 #include "vm/flags.h" | 6 #include "vm/flags.h" |
| 7 | 7 |
| 8 #ifndef DART_PRECOMPILED_RUNTIME | 8 #ifndef DART_PRECOMPILED_RUNTIME |
| 9 | 9 |
| 10 #include "lib/invocation_mirror.h" | 10 #include "lib/invocation_mirror.h" |
| (...skipping 1596 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1607 if (target.raw() != parent.raw()) { | 1607 if (target.raw() != parent.raw()) { |
| 1608 ASSERT(Isolate::Current()->HasAttemptedReload()); | 1608 ASSERT(Isolate::Current()->HasAttemptedReload()); |
| 1609 if (target.IsNull() || | 1609 if (target.IsNull() || |
| 1610 (target.is_static() != parent.is_static()) || | 1610 (target.is_static() != parent.is_static()) || |
| 1611 (target.kind() != parent.kind())) { | 1611 (target.kind() != parent.kind())) { |
| 1612 target = Function::null(); | 1612 target = Function::null(); |
| 1613 } | 1613 } |
| 1614 } | 1614 } |
| 1615 | 1615 |
| 1616 AstNode* call = NULL; | 1616 AstNode* call = NULL; |
| 1617 if (!target.IsNull()) { | 1617 // Check the target still exists and has compatible parameters. If not, |
| 1618 // throw NSME/call nSM instead of forwarding the call. Note we compare the |
| 1619 // parent not func because func has an extra parameter for the closure |
| 1620 // receiver. |
| 1621 if (!target.IsNull() && |
| 1622 (parent.num_fixed_parameters() == target.num_fixed_parameters())) { |
| 1618 call = new StaticCallNode(token_pos, target, func_args); | 1623 call = new StaticCallNode(token_pos, target, func_args); |
| 1619 } else if (!parent.is_static()) { | 1624 } else if (!parent.is_static()) { |
| 1620 ASSERT(Isolate::Current()->HasAttemptedReload()); | 1625 ASSERT(Isolate::Current()->HasAttemptedReload()); |
| 1621 // If a subsequent reload reintroduces the target in the middle of the | 1626 // If a subsequent reload reintroduces the target in the middle of the |
| 1622 // Invocation object being constructed, we won't be able to successfully | 1627 // Invocation object being constructed, we won't be able to successfully |
| 1623 // deopt because the generated AST will change. | 1628 // deopt because the generated AST will change. |
| 1624 current_function().SetIsOptimizable(false); | 1629 func.SetIsOptimizable(false); |
| 1625 | 1630 |
| 1626 ArgumentListNode* arguments = BuildNoSuchMethodArguments( | 1631 ArgumentListNode* arguments = BuildNoSuchMethodArguments( |
| 1627 token_pos, func_name, *func_args, NULL, false); | 1632 token_pos, func_name, *func_args, NULL, false); |
| 1628 const intptr_t kNumArguments = 2; // Receiver, InvocationMirror. | 1633 const intptr_t kNumArguments = 2; // Receiver, InvocationMirror. |
| 1629 ArgumentsDescriptor args_desc( | 1634 ArgumentsDescriptor args_desc( |
| 1630 Array::Handle(Z, ArgumentsDescriptor::New(kNumArguments))); | 1635 Array::Handle(Z, ArgumentsDescriptor::New(kNumArguments))); |
| 1631 Function& no_such_method = Function::ZoneHandle(Z, | 1636 Function& no_such_method = Function::ZoneHandle(Z, |
| 1632 Resolver::ResolveDynamicForReceiverClass(owner, | 1637 Resolver::ResolveDynamicForReceiverClass(owner, |
| 1633 Symbols::NoSuchMethod(), | 1638 Symbols::NoSuchMethod(), |
| 1634 args_desc)); | 1639 args_desc)); |
| 1635 if (no_such_method.IsNull()) { | 1640 if (no_such_method.IsNull()) { |
| 1636 // If noSuchMethod(i) is not found, call Object:noSuchMethod. | 1641 // If noSuchMethod(i) is not found, call Object:noSuchMethod. |
| 1637 no_such_method ^= Resolver::ResolveDynamicForReceiverClass( | 1642 no_such_method ^= Resolver::ResolveDynamicForReceiverClass( |
| 1638 Class::Handle(Z, I->object_store()->object_class()), | 1643 Class::Handle(Z, I->object_store()->object_class()), |
| 1639 Symbols::NoSuchMethod(), | 1644 Symbols::NoSuchMethod(), |
| 1640 args_desc); | 1645 args_desc); |
| 1641 } | 1646 } |
| 1642 call = new StaticCallNode(token_pos, no_such_method, arguments); | 1647 call = new StaticCallNode(token_pos, no_such_method, arguments); |
| 1643 } else { | 1648 } else { |
| 1644 ASSERT(Isolate::Current()->HasAttemptedReload()); | 1649 ASSERT(Isolate::Current()->HasAttemptedReload()); |
| 1645 // If a subsequent reload reintroduces the target in the middle of the | 1650 // If a subsequent reload reintroduces the target in the middle of the |
| 1646 // arguments array being constructed, we won't be able to successfully | 1651 // arguments array being constructed, we won't be able to successfully |
| 1647 // deopt because the generated AST will change. | 1652 // deopt because the generated AST will change. |
| 1648 current_function().SetIsOptimizable(false); | 1653 func.SetIsOptimizable(false); |
| 1649 | 1654 |
| 1650 InvocationMirror::Type im_type; | 1655 InvocationMirror::Type im_type; |
| 1651 if (parent.IsImplicitGetterFunction()) { | 1656 if (parent.IsImplicitGetterFunction()) { |
| 1652 im_type = InvocationMirror::kGetter; | 1657 im_type = InvocationMirror::kGetter; |
| 1653 } else if (parent.IsImplicitSetterFunction()) { | 1658 } else if (parent.IsImplicitSetterFunction()) { |
| 1654 im_type = InvocationMirror::kSetter; | 1659 im_type = InvocationMirror::kSetter; |
| 1655 } else { | 1660 } else { |
| 1656 im_type = InvocationMirror::kMethod; | 1661 im_type = InvocationMirror::kMethod; |
| 1657 } | 1662 } |
| 1658 call = ThrowNoSuchMethodError(TokenPos(), | 1663 call = ThrowNoSuchMethodError(TokenPos(), |
| (...skipping 13117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14776 const ArgumentListNode& function_args, | 14781 const ArgumentListNode& function_args, |
| 14777 const LocalVariable* temp_for_last_arg, | 14782 const LocalVariable* temp_for_last_arg, |
| 14778 bool is_super_invocation) { | 14783 bool is_super_invocation) { |
| 14779 UNREACHABLE(); | 14784 UNREACHABLE(); |
| 14780 return NULL; | 14785 return NULL; |
| 14781 } | 14786 } |
| 14782 | 14787 |
| 14783 } // namespace dart | 14788 } // namespace dart |
| 14784 | 14789 |
| 14785 #endif // DART_PRECOMPILED_RUNTIME | 14790 #endif // DART_PRECOMPILED_RUNTIME |
| OLD | NEW |