| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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/assembler.h" | 7 #include "vm/assembler.h" |
| 8 #include "vm/ast.h" | 8 #include "vm/ast.h" |
| 9 #include "vm/bigint_operations.h" | 9 #include "vm/bigint_operations.h" |
| 10 #include "vm/code_patcher.h" | 10 #include "vm/code_patcher.h" |
| (...skipping 635 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 646 dst_name, malformed_error_message); | 646 dst_name, malformed_error_message); |
| 647 UNREACHABLE(); | 647 UNREACHABLE(); |
| 648 } | 648 } |
| 649 UpdateTypeTestCache(src_instance, dst_type, | 649 UpdateTypeTestCache(src_instance, dst_type, |
| 650 dst_instantiator, instantiator_type_arguments, | 650 dst_instantiator, instantiator_type_arguments, |
| 651 Bool::True(), cache); | 651 Bool::True(), cache); |
| 652 arguments.SetReturn(src_instance); | 652 arguments.SetReturn(src_instance); |
| 653 } | 653 } |
| 654 | 654 |
| 655 | 655 |
| 656 // Test whether a formal parameter was defined by a passed-in argument. | |
| 657 // Arg0: formal parameter index as Smi. | |
| 658 // Arg1: formal parameter name as Symbol. | |
| 659 // Arg2: arguments descriptor array. | |
| 660 // Return value: true or false. | |
| 661 DEFINE_RUNTIME_ENTRY(ArgumentDefinitionTest, 3) { | |
| 662 ASSERT(arguments.ArgCount() == | |
| 663 kArgumentDefinitionTestRuntimeEntry.argument_count()); | |
| 664 const Smi& param_index = Smi::CheckedHandle(arguments.ArgAt(0)); | |
| 665 const String& param_name = String::CheckedHandle(arguments.ArgAt(1)); | |
| 666 ASSERT(param_name.IsSymbol()); | |
| 667 const Array& arg_desc_array = Array::CheckedHandle(arguments.ArgAt(2)); | |
| 668 ArgumentsDescriptor arg_desc(arg_desc_array); | |
| 669 const intptr_t num_pos_args = arg_desc.PositionalCount(); | |
| 670 // Check if the formal parameter is defined by a positional argument. | |
| 671 bool is_defined = num_pos_args > param_index.Value(); | |
| 672 if (!is_defined) { | |
| 673 // Check if the formal parameter is defined by a named argument. | |
| 674 const intptr_t num_named_args = arg_desc.NamedCount(); | |
| 675 for (intptr_t i = 0; i < num_named_args; i++) { | |
| 676 if (arg_desc.MatchesNameAt(i, param_name)) { | |
| 677 is_defined = true; | |
| 678 break; | |
| 679 } | |
| 680 } | |
| 681 } | |
| 682 arguments.SetReturn(is_defined ? Bool::True() : Bool::False()); | |
| 683 } | |
| 684 | |
| 685 | |
| 686 // Report that the type of the given object is not bool in conditional context. | 656 // Report that the type of the given object is not bool in conditional context. |
| 687 // Arg0: bad object. | 657 // Arg0: bad object. |
| 688 // Return value: none, throws a TypeError. | 658 // Return value: none, throws a TypeError. |
| 689 DEFINE_RUNTIME_ENTRY(ConditionTypeError, 1) { | 659 DEFINE_RUNTIME_ENTRY(ConditionTypeError, 1) { |
| 690 ASSERT(arguments.ArgCount() == | 660 ASSERT(arguments.ArgCount() == |
| 691 kConditionTypeErrorRuntimeEntry.argument_count()); | 661 kConditionTypeErrorRuntimeEntry.argument_count()); |
| 692 const intptr_t location = GetCallerLocation(); | 662 const intptr_t location = GetCallerLocation(); |
| 693 const Instance& src_instance = Instance::CheckedHandle(arguments.ArgAt(0)); | 663 const Instance& src_instance = Instance::CheckedHandle(arguments.ArgAt(0)); |
| 694 ASSERT(src_instance.IsNull() || !src_instance.IsBool()); | 664 ASSERT(src_instance.IsNull() || !src_instance.IsBool()); |
| 695 const Type& bool_interface = Type::Handle(Type::BoolType()); | 665 const Type& bool_interface = Type::Handle(Type::BoolType()); |
| (...skipping 1201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1897 // Arg1: Value that is being stored. | 1867 // Arg1: Value that is being stored. |
| 1898 DEFINE_RUNTIME_ENTRY(UpdateFieldCid, 2) { | 1868 DEFINE_RUNTIME_ENTRY(UpdateFieldCid, 2) { |
| 1899 ASSERT(arguments.ArgCount() == kUpdateFieldCidRuntimeEntry.argument_count()); | 1869 ASSERT(arguments.ArgCount() == kUpdateFieldCidRuntimeEntry.argument_count()); |
| 1900 const Field& field = Field::CheckedHandle(arguments.ArgAt(0)); | 1870 const Field& field = Field::CheckedHandle(arguments.ArgAt(0)); |
| 1901 const Object& value = Object::Handle(arguments.ArgAt(1)); | 1871 const Object& value = Object::Handle(arguments.ArgAt(1)); |
| 1902 | 1872 |
| 1903 field.UpdateCid(value.GetClassId()); | 1873 field.UpdateCid(value.GetClassId()); |
| 1904 } | 1874 } |
| 1905 | 1875 |
| 1906 } // namespace dart | 1876 } // namespace dart |
| OLD | NEW |