| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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/code_generator.h" | 5 #include "vm/code_generator.h" |
| 6 | 6 |
| 7 #include "vm/code_index_table.h" | 7 #include "vm/code_index_table.h" |
| 8 #include "vm/code_patcher.h" | 8 #include "vm/code_patcher.h" |
| 9 #include "vm/compiler.h" | 9 #include "vm/compiler.h" |
| 10 #include "vm/dart_api_impl.h" | 10 #include "vm/dart_api_impl.h" |
| (...skipping 625 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 636 } | 636 } |
| 637 if (!result.IsSmi()) { | 637 if (!result.IsSmi()) { |
| 638 const Class& cls = Class::Handle(result.clazz()); | 638 const Class& cls = Class::Handle(result.clazz()); |
| 639 ASSERT(!cls.IsNull()); | 639 ASSERT(!cls.IsNull()); |
| 640 function = cls.signature_function(); | 640 function = cls.signature_function(); |
| 641 if (!function.IsNull()) { | 641 if (!function.IsNull()) { |
| 642 arguments.SetReturn(result); | 642 arguments.SetReturn(result); |
| 643 return; // Return closure object. | 643 return; // Return closure object. |
| 644 } | 644 } |
| 645 } | 645 } |
| 646 Exceptions::ThrowByType( | 646 Exceptions::ThrowByType(Exceptions::kObjectNotClosure, invoke_arguments); |
| 647 result.IsNull() ? Exceptions::kNullPointer : | |
| 648 Exceptions::kObjectNotClosure, | |
| 649 invoke_arguments); | |
| 650 } | 647 } |
| 651 | 648 |
| 652 | 649 |
| 653 // Invoke Implicit Closure function. | 650 // Invoke Implicit Closure function. |
| 654 // Arg0: closure object. | 651 // Arg0: closure object. |
| 655 // Arg1: arguments descriptor (originally passed as dart instance invocation). | 652 // Arg1: arguments descriptor (originally passed as dart instance invocation). |
| 656 // Arg2: arguments array (originally passed to dart instance invocation). | 653 // Arg2: arguments array (originally passed to dart instance invocation). |
| 657 DEFINE_RUNTIME_ENTRY(InvokeImplicitClosureFunction, 3) { | 654 DEFINE_RUNTIME_ENTRY(InvokeImplicitClosureFunction, 3) { |
| 658 ASSERT(arguments.Count() == | 655 ASSERT(arguments.Count() == |
| 659 kInvokeImplicitClosureFunctionRuntimeEntry.argument_count()); | 656 kInvokeImplicitClosureFunctionRuntimeEntry.argument_count()); |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 765 | 762 |
| 766 // Report that an object is not a closure. | 763 // Report that an object is not a closure. |
| 767 // Arg0: non-closure object. | 764 // Arg0: non-closure object. |
| 768 // Arg1: arguments array. | 765 // Arg1: arguments array. |
| 769 DEFINE_RUNTIME_ENTRY(ReportObjectNotClosure, 2) { | 766 DEFINE_RUNTIME_ENTRY(ReportObjectNotClosure, 2) { |
| 770 ASSERT(arguments.Count() == | 767 ASSERT(arguments.Count() == |
| 771 kReportObjectNotClosureRuntimeEntry.argument_count()); | 768 kReportObjectNotClosureRuntimeEntry.argument_count()); |
| 772 const Instance& bad_closure = Instance::CheckedHandle(arguments.At(0)); | 769 const Instance& bad_closure = Instance::CheckedHandle(arguments.At(0)); |
| 773 if (bad_closure.IsNull()) { | 770 if (bad_closure.IsNull()) { |
| 774 GrowableArray<const Object*> args; | 771 GrowableArray<const Object*> args; |
| 775 Exceptions::ThrowByType(Exceptions::kNullPointer, args); | 772 Exceptions::ThrowByType(Exceptions::kObjectNotClosure, args); |
| 776 } | 773 } |
| 777 // const Array& arguments = Array::CheckedHandle(arguments.At(1)); | 774 // const Array& arguments = Array::CheckedHandle(arguments.At(1)); |
| 778 OS::PrintErr("object '%s' is not a closure\n", bad_closure.ToCString()); | 775 OS::PrintErr("object '%s' is not a closure\n", bad_closure.ToCString()); |
| 779 GrowableArray<const Object*> args; | 776 GrowableArray<const Object*> args; |
| 780 Exceptions::ThrowByType(Exceptions::kObjectNotClosure, args); | 777 Exceptions::ThrowByType(Exceptions::kObjectNotClosure, args); |
| 781 } | 778 } |
| 782 | 779 |
| 783 | 780 |
| 784 DEFINE_RUNTIME_ENTRY(ClosureArgumentMismatch, 0) { | 781 DEFINE_RUNTIME_ENTRY(ClosureArgumentMismatch, 0) { |
| 785 ASSERT(arguments.Count() == | 782 ASSERT(arguments.Count() == |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 997 } | 994 } |
| 998 } | 995 } |
| 999 } | 996 } |
| 1000 // The cache is null terminated, therefore the loop above should never | 997 // The cache is null terminated, therefore the loop above should never |
| 1001 // terminate by itself. | 998 // terminate by itself. |
| 1002 UNREACHABLE(); | 999 UNREACHABLE(); |
| 1003 return Code::null(); | 1000 return Code::null(); |
| 1004 } | 1001 } |
| 1005 | 1002 |
| 1006 } // namespace dart | 1003 } // namespace dart |
| OLD | NEW |