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/flow_graph_builder.h" | 5 #include "vm/flow_graph_builder.h" |
6 | 6 |
7 #include "vm/ast_printer.h" | 7 #include "vm/ast_printer.h" |
8 #include "vm/code_descriptors.h" | 8 #include "vm/code_descriptors.h" |
9 #include "vm/dart_entry.h" | 9 #include "vm/dart_entry.h" |
10 #include "vm/flags.h" | 10 #include "vm/flags.h" |
(...skipping 2791 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2802 receiver->Visit(&for_receiver); | 2802 receiver->Visit(&for_receiver); |
2803 Append(for_receiver); | 2803 Append(for_receiver); |
2804 PushArgumentInstr* push_receiver = PushArgument(for_receiver.value()); | 2804 PushArgumentInstr* push_receiver = PushArgument(for_receiver.value()); |
2805 | 2805 |
2806 // Allocate the arguments and pass them into the construction | 2806 // Allocate the arguments and pass them into the construction |
2807 // of the InvocationMirror. | 2807 // of the InvocationMirror. |
2808 const intptr_t args_pos = method_arguments->token_pos(); | 2808 const intptr_t args_pos = method_arguments->token_pos(); |
2809 ArgumentListNode* arguments = new ArgumentListNode(args_pos); | 2809 ArgumentListNode* arguments = new ArgumentListNode(args_pos); |
2810 // The first argument is the original method name. | 2810 // The first argument is the original method name. |
2811 arguments->Add(new LiteralNode(args_pos, method_name)); | 2811 arguments->Add(new LiteralNode(args_pos, method_name)); |
2812 // The second argument is an array containing the original method arguments. | 2812 // The second argument is the arguments descriptor of the original method. |
| 2813 const Array& args_descriptor = |
| 2814 Array::ZoneHandle(ArgumentsDescriptor::New(method_arguments->length(), |
| 2815 method_arguments->names())); |
| 2816 arguments->Add(new LiteralNode(args_pos, args_descriptor)); |
| 2817 // The third argument is an array containing the original method arguments, |
| 2818 // including the receiver. |
2813 ArrayNode* args_array = | 2819 ArrayNode* args_array = |
2814 new ArrayNode(args_pos, Type::ZoneHandle(Type::ArrayType())); | 2820 new ArrayNode(args_pos, Type::ZoneHandle(Type::ArrayType())); |
2815 for (intptr_t i = 0; i < method_arguments->length(); i++) { | 2821 for (intptr_t i = 0; i < method_arguments->length(); i++) { |
2816 args_array->AddElement(method_arguments->NodeAt(i)); | 2822 args_array->AddElement(method_arguments->NodeAt(i)); |
2817 } | 2823 } |
2818 arguments->Add(args_array); | 2824 arguments->Add(args_array); |
2819 ZoneGrowableArray<PushArgumentInstr*>* allocation_args = | 2825 ZoneGrowableArray<PushArgumentInstr*>* allocation_args = |
2820 new ZoneGrowableArray<PushArgumentInstr*>(arguments->length()); | 2826 new ZoneGrowableArray<PushArgumentInstr*>(arguments->length()); |
2821 BuildPushArguments(*arguments, allocation_args); | 2827 BuildPushArguments(*arguments, allocation_args); |
2822 StaticCallInstr* allocation = new StaticCallInstr(args_pos, | 2828 StaticCallInstr* allocation = new StaticCallInstr(args_pos, |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2960 intptr_t len = OS::SNPrint(NULL, 0, kFormat, function_name, reason) + 1; | 2966 intptr_t len = OS::SNPrint(NULL, 0, kFormat, function_name, reason) + 1; |
2961 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); | 2967 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); |
2962 OS::SNPrint(chars, len, kFormat, function_name, reason); | 2968 OS::SNPrint(chars, len, kFormat, function_name, reason); |
2963 const Error& error = Error::Handle( | 2969 const Error& error = Error::Handle( |
2964 LanguageError::New(String::Handle(String::New(chars)))); | 2970 LanguageError::New(String::Handle(String::New(chars)))); |
2965 Isolate::Current()->long_jump_base()->Jump(1, error); | 2971 Isolate::Current()->long_jump_base()->Jump(1, error); |
2966 } | 2972 } |
2967 | 2973 |
2968 | 2974 |
2969 } // namespace dart | 2975 } // namespace dart |
OLD | NEW |