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 "lib/mirrors.h" | 5 #include "lib/mirrors.h" |
6 | 6 |
7 #include "lib/invocation_mirror.h" | 7 #include "lib/invocation_mirror.h" |
8 #include "vm/bootstrap_natives.h" | 8 #include "vm/bootstrap_natives.h" |
9 #include "vm/class_finalizer.h" | 9 #include "vm/class_finalizer.h" |
10 #include "vm/compiler.h" | 10 #include "vm/compiler.h" |
(...skipping 1325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1336 GET_NATIVE_ARGUMENT(Instance, reflectee, arguments->NativeArgAt(1)); | 1336 GET_NATIVE_ARGUMENT(Instance, reflectee, arguments->NativeArgAt(1)); |
1337 GET_NON_NULL_NATIVE_ARGUMENT(String, function_name, | 1337 GET_NON_NULL_NATIVE_ARGUMENT(String, function_name, |
1338 arguments->NativeArgAt(2)); | 1338 arguments->NativeArgAt(2)); |
1339 GET_NON_NULL_NATIVE_ARGUMENT(Array, args, arguments->NativeArgAt(3)); | 1339 GET_NON_NULL_NATIVE_ARGUMENT(Array, args, arguments->NativeArgAt(3)); |
1340 GET_NON_NULL_NATIVE_ARGUMENT(Array, arg_names, arguments->NativeArgAt(4)); | 1340 GET_NON_NULL_NATIVE_ARGUMENT(Array, arg_names, arguments->NativeArgAt(4)); |
1341 | 1341 |
1342 Class& klass = Class::Handle(reflectee.clazz()); | 1342 Class& klass = Class::Handle(reflectee.clazz()); |
1343 Function& function = Function::Handle( | 1343 Function& function = Function::Handle( |
1344 zone, Resolver::ResolveDynamicAnyArgs(zone, klass, function_name)); | 1344 zone, Resolver::ResolveDynamicAnyArgs(zone, klass, function_name)); |
1345 | 1345 |
1346 const Array& args_descriptor = | 1346 // TODO(regis): Support invocation of generic functions with type arguments. |
1347 Array::Handle(zone, ArgumentsDescriptor::New(args.Length(), arg_names)); | 1347 const int kTypeArgsLen = 0; |
| 1348 const Array& args_descriptor = Array::Handle( |
| 1349 zone, ArgumentsDescriptor::New(kTypeArgsLen, args.Length(), arg_names)); |
1348 | 1350 |
1349 if (function.IsNull()) { | 1351 if (function.IsNull()) { |
1350 // Didn't find a method: try to find a getter and invoke call on its result. | 1352 // Didn't find a method: try to find a getter and invoke call on its result. |
1351 const String& getter_name = | 1353 const String& getter_name = |
1352 String::Handle(zone, Field::GetterName(function_name)); | 1354 String::Handle(zone, Field::GetterName(function_name)); |
1353 function = Resolver::ResolveDynamicAnyArgs(zone, klass, getter_name); | 1355 function = Resolver::ResolveDynamicAnyArgs(zone, klass, getter_name); |
1354 if (!function.IsNull()) { | 1356 if (!function.IsNull()) { |
1355 ASSERT(function.kind() != RawFunction::kMethodExtractor); | 1357 ASSERT(function.kind() != RawFunction::kMethodExtractor); |
1356 // Invoke the getter. | 1358 // Invoke the getter. |
1357 const int kNumArgs = 1; | 1359 const int kNumArgs = 1; |
1358 const Array& getter_args = Array::Handle(zone, Array::New(kNumArgs)); | 1360 const Array& getter_args = Array::Handle(zone, Array::New(kNumArgs)); |
1359 getter_args.SetAt(0, reflectee); | 1361 getter_args.SetAt(0, reflectee); |
1360 const Array& getter_args_descriptor = | 1362 const Array& getter_args_descriptor = Array::Handle( |
1361 Array::Handle(zone, ArgumentsDescriptor::New(getter_args.Length())); | 1363 zone, ArgumentsDescriptor::New(kTypeArgsLen, getter_args.Length())); |
1362 const Instance& getter_result = Instance::Handle( | 1364 const Instance& getter_result = Instance::Handle( |
1363 zone, InvokeDynamicFunction(reflectee, function, getter_name, | 1365 zone, InvokeDynamicFunction(reflectee, function, getter_name, |
1364 getter_args, getter_args_descriptor)); | 1366 getter_args, getter_args_descriptor)); |
1365 // Replace the closure as the receiver in the arguments list. | 1367 // Replace the closure as the receiver in the arguments list. |
1366 args.SetAt(0, getter_result); | 1368 args.SetAt(0, getter_result); |
1367 // Call the closure. | 1369 // Call the closure. |
1368 const Object& call_result = | 1370 const Object& call_result = |
1369 Object::Handle(zone, DartEntry::InvokeClosure(args, args_descriptor)); | 1371 Object::Handle(zone, DartEntry::InvokeClosure(args, args_descriptor)); |
1370 if (call_result.IsError()) { | 1372 if (call_result.IsError()) { |
1371 Exceptions::PropagateError(Error::Cast(call_result)); | 1373 Exceptions::PropagateError(Error::Cast(call_result)); |
(...skipping 25 matching lines...) Expand all Loading... |
1397 // Check for method extraction when method extractors are not created. | 1399 // Check for method extraction when method extractors are not created. |
1398 if (function.IsNull() && !FLAG_lazy_dispatchers) { | 1400 if (function.IsNull() && !FLAG_lazy_dispatchers) { |
1399 function = Resolver::ResolveDynamicAnyArgs(zone, klass, getter_name); | 1401 function = Resolver::ResolveDynamicAnyArgs(zone, klass, getter_name); |
1400 if (!function.IsNull()) { | 1402 if (!function.IsNull()) { |
1401 const Function& closure_function = | 1403 const Function& closure_function = |
1402 Function::Handle(zone, function.ImplicitClosureFunction()); | 1404 Function::Handle(zone, function.ImplicitClosureFunction()); |
1403 return closure_function.ImplicitInstanceClosure(reflectee); | 1405 return closure_function.ImplicitInstanceClosure(reflectee); |
1404 } | 1406 } |
1405 } | 1407 } |
1406 | 1408 |
| 1409 const int kTypeArgsLen = 0; |
1407 const int kNumArgs = 1; | 1410 const int kNumArgs = 1; |
1408 const Array& args = Array::Handle(zone, Array::New(kNumArgs)); | 1411 const Array& args = Array::Handle(zone, Array::New(kNumArgs)); |
1409 args.SetAt(0, reflectee); | 1412 args.SetAt(0, reflectee); |
1410 const Array& args_descriptor = | 1413 const Array& args_descriptor = Array::Handle( |
1411 Array::Handle(zone, ArgumentsDescriptor::New(args.Length())); | 1414 zone, ArgumentsDescriptor::New(kTypeArgsLen, args.Length())); |
1412 | 1415 |
1413 // InvokeDynamic invokes NoSuchMethod if the provided function is null. | 1416 // InvokeDynamic invokes NoSuchMethod if the provided function is null. |
1414 return InvokeDynamicFunction(reflectee, function, internal_getter_name, args, | 1417 return InvokeDynamicFunction(reflectee, function, internal_getter_name, args, |
1415 args_descriptor); | 1418 args_descriptor); |
1416 } | 1419 } |
1417 | 1420 |
1418 | 1421 |
1419 DEFINE_NATIVE_ENTRY(InstanceMirror_invokeSetter, 4) { | 1422 DEFINE_NATIVE_ENTRY(InstanceMirror_invokeSetter, 4) { |
1420 // Argument 0 is the mirror, which is unused by the native. It exists | 1423 // Argument 0 is the mirror, which is unused by the native. It exists |
1421 // because this native is an instance method in order to be polymorphic | 1424 // because this native is an instance method in order to be polymorphic |
1422 // with its cousins. | 1425 // with its cousins. |
1423 GET_NATIVE_ARGUMENT(Instance, reflectee, arguments->NativeArgAt(1)); | 1426 GET_NATIVE_ARGUMENT(Instance, reflectee, arguments->NativeArgAt(1)); |
1424 GET_NON_NULL_NATIVE_ARGUMENT(String, setter_name, arguments->NativeArgAt(2)); | 1427 GET_NON_NULL_NATIVE_ARGUMENT(String, setter_name, arguments->NativeArgAt(2)); |
1425 GET_NATIVE_ARGUMENT(Instance, value, arguments->NativeArgAt(3)); | 1428 GET_NATIVE_ARGUMENT(Instance, value, arguments->NativeArgAt(3)); |
1426 | 1429 |
1427 const Class& klass = Class::Handle(zone, reflectee.clazz()); | 1430 const Class& klass = Class::Handle(zone, reflectee.clazz()); |
1428 const String& internal_setter_name = | 1431 const String& internal_setter_name = |
1429 String::Handle(zone, Field::SetterName(setter_name)); | 1432 String::Handle(zone, Field::SetterName(setter_name)); |
1430 const Function& setter = Function::Handle( | 1433 const Function& setter = Function::Handle( |
1431 zone, Resolver::ResolveDynamicAnyArgs(zone, klass, internal_setter_name)); | 1434 zone, Resolver::ResolveDynamicAnyArgs(zone, klass, internal_setter_name)); |
1432 | 1435 |
| 1436 const int kTypeArgsLen = 0; |
1433 const int kNumArgs = 2; | 1437 const int kNumArgs = 2; |
1434 const Array& args = Array::Handle(zone, Array::New(kNumArgs)); | 1438 const Array& args = Array::Handle(zone, Array::New(kNumArgs)); |
1435 args.SetAt(0, reflectee); | 1439 args.SetAt(0, reflectee); |
1436 args.SetAt(1, value); | 1440 args.SetAt(1, value); |
1437 const Array& args_descriptor = | 1441 const Array& args_descriptor = Array::Handle( |
1438 Array::Handle(zone, ArgumentsDescriptor::New(args.Length())); | 1442 zone, ArgumentsDescriptor::New(kTypeArgsLen, args.Length())); |
1439 | 1443 |
1440 return InvokeDynamicFunction(reflectee, setter, internal_setter_name, args, | 1444 return InvokeDynamicFunction(reflectee, setter, internal_setter_name, args, |
1441 args_descriptor); | 1445 args_descriptor); |
1442 } | 1446 } |
1443 | 1447 |
1444 | 1448 |
1445 DEFINE_NATIVE_ENTRY(InstanceMirror_computeType, 1) { | 1449 DEFINE_NATIVE_ENTRY(InstanceMirror_computeType, 1) { |
1446 GET_NON_NULL_NATIVE_ARGUMENT(Instance, instance, arguments->NativeArgAt(0)); | 1450 GET_NON_NULL_NATIVE_ARGUMENT(Instance, instance, arguments->NativeArgAt(0)); |
1447 const AbstractType& type = AbstractType::Handle(instance.GetType(Heap::kNew)); | 1451 const AbstractType& type = AbstractType::Handle(instance.GetType(Heap::kNew)); |
1448 // The static type of null is specified to be the bottom type, however, the | 1452 // The static type of null is specified to be the bottom type, however, the |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1490 // Argument 0 is the mirror, which is unused by the native. It exists | 1494 // Argument 0 is the mirror, which is unused by the native. It exists |
1491 // because this native is an instance method in order to be polymorphic | 1495 // because this native is an instance method in order to be polymorphic |
1492 // with its cousins. | 1496 // with its cousins. |
1493 GET_NON_NULL_NATIVE_ARGUMENT(MirrorReference, ref, arguments->NativeArgAt(1)); | 1497 GET_NON_NULL_NATIVE_ARGUMENT(MirrorReference, ref, arguments->NativeArgAt(1)); |
1494 const Class& klass = Class::Handle(ref.GetClassReferent()); | 1498 const Class& klass = Class::Handle(ref.GetClassReferent()); |
1495 GET_NON_NULL_NATIVE_ARGUMENT(String, function_name, | 1499 GET_NON_NULL_NATIVE_ARGUMENT(String, function_name, |
1496 arguments->NativeArgAt(2)); | 1500 arguments->NativeArgAt(2)); |
1497 GET_NON_NULL_NATIVE_ARGUMENT(Array, args, arguments->NativeArgAt(3)); | 1501 GET_NON_NULL_NATIVE_ARGUMENT(Array, args, arguments->NativeArgAt(3)); |
1498 GET_NON_NULL_NATIVE_ARGUMENT(Array, arg_names, arguments->NativeArgAt(4)); | 1502 GET_NON_NULL_NATIVE_ARGUMENT(Array, arg_names, arguments->NativeArgAt(4)); |
1499 | 1503 |
| 1504 // TODO(regis): Support invocation of generic functions with type arguments. |
| 1505 const int kTypeArgsLen = 0; |
1500 const Error& error = Error::Handle(zone, klass.EnsureIsFinalized(thread)); | 1506 const Error& error = Error::Handle(zone, klass.EnsureIsFinalized(thread)); |
1501 if (!error.IsNull()) { | 1507 if (!error.IsNull()) { |
1502 Exceptions::PropagateError(error); | 1508 Exceptions::PropagateError(error); |
1503 UNREACHABLE(); | 1509 UNREACHABLE(); |
1504 } | 1510 } |
1505 | 1511 |
1506 Function& function = | 1512 Function& function = |
1507 Function::Handle(klass.LookupStaticFunction(function_name)); | 1513 Function::Handle(klass.LookupStaticFunction(function_name)); |
1508 | 1514 |
1509 if (function.IsNull()) { | 1515 if (function.IsNull()) { |
1510 // Didn't find a method: try to find a getter and invoke call on its result. | 1516 // Didn't find a method: try to find a getter and invoke call on its result. |
1511 const String& getter_name = | 1517 const String& getter_name = |
1512 String::Handle(Field::GetterName(function_name)); | 1518 String::Handle(Field::GetterName(function_name)); |
1513 function = klass.LookupStaticFunction(getter_name); | 1519 function = klass.LookupStaticFunction(getter_name); |
1514 if (!function.IsNull()) { | 1520 if (!function.IsNull()) { |
1515 // Invoke the getter. | 1521 // Invoke the getter. |
1516 const Object& getter_result = Object::Handle( | 1522 const Object& getter_result = Object::Handle( |
1517 DartEntry::InvokeFunction(function, Object::empty_array())); | 1523 DartEntry::InvokeFunction(function, Object::empty_array())); |
1518 if (getter_result.IsError()) { | 1524 if (getter_result.IsError()) { |
1519 Exceptions::PropagateError(Error::Cast(getter_result)); | 1525 Exceptions::PropagateError(Error::Cast(getter_result)); |
1520 UNREACHABLE(); | 1526 UNREACHABLE(); |
1521 } | 1527 } |
1522 // Make room for the closure (receiver) in the argument list. | 1528 // Make room for the closure (receiver) in the argument list. |
1523 intptr_t numArgs = args.Length(); | 1529 const intptr_t num_args = args.Length(); |
1524 const Array& call_args = Array::Handle(Array::New(numArgs + 1)); | 1530 const Array& call_args = Array::Handle(Array::New(num_args + 1)); |
1525 Object& temp = Object::Handle(); | 1531 Object& temp = Object::Handle(); |
1526 for (int i = 0; i < numArgs; i++) { | 1532 for (int i = 0; i < num_args; i++) { |
1527 temp = args.At(i); | 1533 temp = args.At(i); |
1528 call_args.SetAt(i + 1, temp); | 1534 call_args.SetAt(i + 1, temp); |
1529 } | 1535 } |
1530 call_args.SetAt(0, getter_result); | 1536 call_args.SetAt(0, getter_result); |
1531 const Array& call_args_descriptor_array = Array::Handle( | 1537 const Array& call_args_descriptor_array = |
1532 ArgumentsDescriptor::New(call_args.Length(), arg_names)); | 1538 Array::Handle(ArgumentsDescriptor::New( |
| 1539 kTypeArgsLen, call_args.Length(), arg_names)); |
1533 // Call the closure. | 1540 // Call the closure. |
1534 const Object& call_result = Object::Handle( | 1541 const Object& call_result = Object::Handle( |
1535 DartEntry::InvokeClosure(call_args, call_args_descriptor_array)); | 1542 DartEntry::InvokeClosure(call_args, call_args_descriptor_array)); |
1536 if (call_result.IsError()) { | 1543 if (call_result.IsError()) { |
1537 Exceptions::PropagateError(Error::Cast(call_result)); | 1544 Exceptions::PropagateError(Error::Cast(call_result)); |
1538 UNREACHABLE(); | 1545 UNREACHABLE(); |
1539 } | 1546 } |
1540 return call_result.raw(); | 1547 return call_result.raw(); |
1541 } | 1548 } |
1542 } | 1549 } |
1543 | 1550 |
1544 const Array& args_descriptor_array = | 1551 const Array& args_descriptor_array = Array::Handle( |
1545 Array::Handle(ArgumentsDescriptor::New(args.Length(), arg_names)); | 1552 ArgumentsDescriptor::New(kTypeArgsLen, args.Length(), arg_names)); |
1546 | 1553 |
1547 ArgumentsDescriptor args_descriptor(args_descriptor_array); | 1554 ArgumentsDescriptor args_descriptor(args_descriptor_array); |
1548 | 1555 |
1549 if (function.IsNull() || !function.AreValidArguments(args_descriptor, NULL) || | 1556 if (function.IsNull() || !function.AreValidArguments(args_descriptor, NULL) || |
1550 !function.is_reflectable()) { | 1557 !function.is_reflectable()) { |
1551 ThrowNoSuchMethod(AbstractType::Handle(klass.RareType()), function_name, | 1558 ThrowNoSuchMethod(AbstractType::Handle(klass.RareType()), function_name, |
1552 function, args, arg_names, InvocationMirror::kStatic, | 1559 function, args, arg_names, InvocationMirror::kStatic, |
1553 InvocationMirror::kMethod); | 1560 InvocationMirror::kMethod); |
1554 UNREACHABLE(); | 1561 UNREACHABLE(); |
1555 } | 1562 } |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1736 const Array& args = | 1743 const Array& args = |
1737 Array::Handle(Array::New(num_implicit_args + num_explicit_args)); | 1744 Array::Handle(Array::New(num_implicit_args + num_explicit_args)); |
1738 | 1745 |
1739 // Copy over the explicit arguments. | 1746 // Copy over the explicit arguments. |
1740 Object& explicit_argument = Object::Handle(); | 1747 Object& explicit_argument = Object::Handle(); |
1741 for (int i = 0; i < num_explicit_args; i++) { | 1748 for (int i = 0; i < num_explicit_args; i++) { |
1742 explicit_argument = explicit_args.At(i); | 1749 explicit_argument = explicit_args.At(i); |
1743 args.SetAt(i + num_implicit_args, explicit_argument); | 1750 args.SetAt(i + num_implicit_args, explicit_argument); |
1744 } | 1751 } |
1745 | 1752 |
1746 const Array& args_descriptor_array = | 1753 const int kTypeArgsLen = 0; |
1747 Array::Handle(ArgumentsDescriptor::New(args.Length(), arg_names)); | 1754 const Array& args_descriptor_array = Array::Handle( |
| 1755 ArgumentsDescriptor::New(kTypeArgsLen, args.Length(), arg_names)); |
1748 | 1756 |
1749 ArgumentsDescriptor args_descriptor(args_descriptor_array); | 1757 ArgumentsDescriptor args_descriptor(args_descriptor_array); |
1750 if (!redirected_constructor.AreValidArguments(args_descriptor, NULL)) { | 1758 if (!redirected_constructor.AreValidArguments(args_descriptor, NULL)) { |
1751 external_constructor_name = redirected_constructor.name(); | 1759 external_constructor_name = redirected_constructor.name(); |
1752 ThrowNoSuchMethod(AbstractType::Handle(klass.RareType()), | 1760 ThrowNoSuchMethod(AbstractType::Handle(klass.RareType()), |
1753 external_constructor_name, redirected_constructor, | 1761 external_constructor_name, redirected_constructor, |
1754 explicit_args, arg_names, InvocationMirror::kConstructor, | 1762 explicit_args, arg_names, InvocationMirror::kConstructor, |
1755 InvocationMirror::kMethod); | 1763 InvocationMirror::kMethod); |
1756 UNREACHABLE(); | 1764 UNREACHABLE(); |
1757 } | 1765 } |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1797 // Argument 0 is the mirror, which is unused by the native. It exists | 1805 // Argument 0 is the mirror, which is unused by the native. It exists |
1798 // because this native is an instance method in order to be polymorphic | 1806 // because this native is an instance method in order to be polymorphic |
1799 // with its cousins. | 1807 // with its cousins. |
1800 GET_NON_NULL_NATIVE_ARGUMENT(MirrorReference, ref, arguments->NativeArgAt(1)); | 1808 GET_NON_NULL_NATIVE_ARGUMENT(MirrorReference, ref, arguments->NativeArgAt(1)); |
1801 const Library& library = Library::Handle(ref.GetLibraryReferent()); | 1809 const Library& library = Library::Handle(ref.GetLibraryReferent()); |
1802 GET_NON_NULL_NATIVE_ARGUMENT(String, function_name, | 1810 GET_NON_NULL_NATIVE_ARGUMENT(String, function_name, |
1803 arguments->NativeArgAt(2)); | 1811 arguments->NativeArgAt(2)); |
1804 GET_NON_NULL_NATIVE_ARGUMENT(Array, args, arguments->NativeArgAt(3)); | 1812 GET_NON_NULL_NATIVE_ARGUMENT(Array, args, arguments->NativeArgAt(3)); |
1805 GET_NON_NULL_NATIVE_ARGUMENT(Array, arg_names, arguments->NativeArgAt(4)); | 1813 GET_NON_NULL_NATIVE_ARGUMENT(Array, arg_names, arguments->NativeArgAt(4)); |
1806 | 1814 |
| 1815 // TODO(regis): Support invocation of generic functions with type arguments. |
| 1816 const int kTypeArgsLen = 0; |
1807 Function& function = | 1817 Function& function = |
1808 Function::Handle(library.LookupLocalFunction(function_name)); | 1818 Function::Handle(library.LookupLocalFunction(function_name)); |
1809 | 1819 |
1810 if (function.IsNull()) { | 1820 if (function.IsNull()) { |
1811 // Didn't find a method: try to find a getter and invoke call on its result. | 1821 // Didn't find a method: try to find a getter and invoke call on its result. |
1812 const Instance& getter_result = | 1822 const Instance& getter_result = |
1813 Instance::Handle(InvokeLibraryGetter(library, function_name, false)); | 1823 Instance::Handle(InvokeLibraryGetter(library, function_name, false)); |
1814 if (getter_result.raw() != Object::sentinel().raw()) { | 1824 if (getter_result.raw() != Object::sentinel().raw()) { |
1815 // Make room for the closure (receiver) in arguments. | 1825 // Make room for the closure (receiver) in arguments. |
1816 intptr_t numArgs = args.Length(); | 1826 intptr_t numArgs = args.Length(); |
1817 const Array& call_args = Array::Handle(Array::New(numArgs + 1)); | 1827 const Array& call_args = Array::Handle(Array::New(numArgs + 1)); |
1818 Object& temp = Object::Handle(); | 1828 Object& temp = Object::Handle(); |
1819 for (int i = 0; i < numArgs; i++) { | 1829 for (int i = 0; i < numArgs; i++) { |
1820 temp = args.At(i); | 1830 temp = args.At(i); |
1821 call_args.SetAt(i + 1, temp); | 1831 call_args.SetAt(i + 1, temp); |
1822 } | 1832 } |
1823 call_args.SetAt(0, getter_result); | 1833 call_args.SetAt(0, getter_result); |
1824 const Array& call_args_descriptor_array = Array::Handle( | 1834 const Array& call_args_descriptor_array = |
1825 ArgumentsDescriptor::New(call_args.Length(), arg_names)); | 1835 Array::Handle(ArgumentsDescriptor::New( |
| 1836 kTypeArgsLen, call_args.Length(), arg_names)); |
1826 // Call closure. | 1837 // Call closure. |
1827 const Object& call_result = Object::Handle( | 1838 const Object& call_result = Object::Handle( |
1828 DartEntry::InvokeClosure(call_args, call_args_descriptor_array)); | 1839 DartEntry::InvokeClosure(call_args, call_args_descriptor_array)); |
1829 if (call_result.IsError()) { | 1840 if (call_result.IsError()) { |
1830 Exceptions::PropagateError(Error::Cast(call_result)); | 1841 Exceptions::PropagateError(Error::Cast(call_result)); |
1831 UNREACHABLE(); | 1842 UNREACHABLE(); |
1832 } | 1843 } |
1833 return call_result.raw(); | 1844 return call_result.raw(); |
1834 } | 1845 } |
1835 } | 1846 } |
1836 | 1847 |
1837 const Array& args_descriptor_array = | 1848 const Array& args_descriptor_array = Array::Handle( |
1838 Array::Handle(ArgumentsDescriptor::New(args.Length(), arg_names)); | 1849 ArgumentsDescriptor::New(kTypeArgsLen, args.Length(), arg_names)); |
1839 ArgumentsDescriptor args_descriptor(args_descriptor_array); | 1850 ArgumentsDescriptor args_descriptor(args_descriptor_array); |
1840 | 1851 |
1841 if (function.IsNull() || !function.AreValidArguments(args_descriptor, NULL) || | 1852 if (function.IsNull() || !function.AreValidArguments(args_descriptor, NULL) || |
1842 !function.is_reflectable()) { | 1853 !function.is_reflectable()) { |
1843 ThrowNoSuchMethod(Instance::null_instance(), function_name, function, args, | 1854 ThrowNoSuchMethod(Instance::null_instance(), function_name, function, args, |
1844 arg_names, InvocationMirror::kTopLevel, | 1855 arg_names, InvocationMirror::kTopLevel, |
1845 InvocationMirror::kMethod); | 1856 InvocationMirror::kMethod); |
1846 UNREACHABLE(); | 1857 UNREACHABLE(); |
1847 } | 1858 } |
1848 | 1859 |
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2098 | 2109 |
2099 DEFINE_NATIVE_ENTRY(TypeMirror_subtypeTest, 2) { | 2110 DEFINE_NATIVE_ENTRY(TypeMirror_subtypeTest, 2) { |
2100 GET_NON_NULL_NATIVE_ARGUMENT(AbstractType, a, arguments->NativeArgAt(0)); | 2111 GET_NON_NULL_NATIVE_ARGUMENT(AbstractType, a, arguments->NativeArgAt(0)); |
2101 GET_NON_NULL_NATIVE_ARGUMENT(AbstractType, b, arguments->NativeArgAt(1)); | 2112 GET_NON_NULL_NATIVE_ARGUMENT(AbstractType, b, arguments->NativeArgAt(1)); |
2102 return Bool::Get(a.IsSubtypeOf(b, NULL, NULL, Heap::kNew)).raw(); | 2113 return Bool::Get(a.IsSubtypeOf(b, NULL, NULL, Heap::kNew)).raw(); |
2103 } | 2114 } |
2104 | 2115 |
2105 #endif // !PRODUCT && !DART_PRECOMPILED_RUNTIME | 2116 #endif // !PRODUCT && !DART_PRECOMPILED_RUNTIME |
2106 | 2117 |
2107 } // namespace dart | 2118 } // namespace dart |
OLD | NEW |