Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(95)

Side by Side Diff: runtime/vm/kernel_to_il.cc

Issue 3007603002: [VM generic function reification] Support generic functions in Invocation class. (Closed)
Patch Set: address review comment Created 3 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « runtime/vm/isolate_reload.cc ('k') | runtime/vm/native_entry.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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 <set> 5 #include <set>
6 6
7 #include "vm/kernel_to_il.h" 7 #include "vm/kernel_to_il.h"
8 8
9 #include "vm/compiler.h" 9 #include "vm/compiler.h"
10 #include "vm/intermediate_language.h" 10 #include "vm/intermediate_language.h"
(...skipping 2008 matching lines...) Expand 10 before | Expand all | Expand 10 after
2019 ZoneGrowableArray<const Instance*>* default_values = 2019 ZoneGrowableArray<const Instance*>* default_values =
2020 new ZoneGrowableArray<const Instance*>(Z, descriptor.NamedCount()); 2020 new ZoneGrowableArray<const Instance*>(Z, descriptor.NamedCount());
2021 for (intptr_t i = 0; i < descriptor.NamedCount(); ++i) { 2021 for (intptr_t i = 0; i < descriptor.NamedCount(); ++i) {
2022 default_values->Add(&Object::null_instance()); 2022 default_values->Add(&Object::null_instance());
2023 } 2023 }
2024 parsed_function_->set_default_parameter_values(default_values); 2024 parsed_function_->set_default_parameter_values(default_values);
2025 2025
2026 Fragment body(normal_entry); 2026 Fragment body(normal_entry);
2027 body += CheckStackOverflowInPrologue(); 2027 body += CheckStackOverflowInPrologue();
2028 2028
2029 // TODO(regis): Check if a type argument vector is passed.
2030
2031 // The receiver is the first argument to noSuchMethod, and it is the first 2029 // The receiver is the first argument to noSuchMethod, and it is the first
2032 // argument passed to the dispatcher function. 2030 // argument passed to the dispatcher function.
2033 LocalScope* scope = parsed_function_->node_sequence()->scope(); 2031 LocalScope* scope = parsed_function_->node_sequence()->scope();
2034 body += LoadLocal(scope->VariableAt(0)); 2032 body += LoadLocal(scope->VariableAt(0));
2035 body += PushArgument(); 2033 body += PushArgument();
2036 2034
2037 // The second argument to noSuchMethod is an invocation mirror. Push the 2035 // The second argument to noSuchMethod is an invocation mirror. Push the
2038 // arguments for allocating the invocation mirror. First, the name. 2036 // arguments for allocating the invocation mirror. First, the name.
2039 body += Constant(String::ZoneHandle(Z, function.name())); 2037 body += Constant(String::ZoneHandle(Z, function.name()));
2040 body += PushArgument(); 2038 body += PushArgument();
2041 2039
2042 // Second, the arguments descriptor. 2040 // Second, the arguments descriptor.
2043 body += Constant(descriptor_array); 2041 body += Constant(descriptor_array);
2044 body += PushArgument(); 2042 body += PushArgument();
2045 2043
2046 // Third, an array containing the original arguments. Create it and fill 2044 // Third, an array containing the original arguments. Create it and fill
2047 // it in. 2045 // it in.
2046 const intptr_t receiver_index = descriptor.TypeArgsLen() > 0 ? 1 : 0;
2048 body += Constant(TypeArguments::ZoneHandle(Z, TypeArguments::null())); 2047 body += Constant(TypeArguments::ZoneHandle(Z, TypeArguments::null()));
2049 body += IntConstant(descriptor.Count()); 2048 body += IntConstant(receiver_index + descriptor.Count());
2050 body += CreateArray(); 2049 body += CreateArray();
2051 LocalVariable* array = MakeTemporary(); 2050 LocalVariable* array = MakeTemporary();
2051 if (receiver_index > 0) {
2052 LocalVariable* type_args = parsed_function_->function_type_arguments();
2053 ASSERT(type_args != NULL);
2054 body += LoadLocal(array);
2055 body += IntConstant(0);
2056 body += LoadLocal(type_args);
2057 body += StoreIndexed(kArrayCid);
2058 body += Drop();
2059 }
2052 for (intptr_t i = 0; i < descriptor.PositionalCount(); ++i) { 2060 for (intptr_t i = 0; i < descriptor.PositionalCount(); ++i) {
2053 body += LoadLocal(array); 2061 body += LoadLocal(array);
2054 body += IntConstant(i); 2062 body += IntConstant(receiver_index + i);
2055 body += LoadLocal(scope->VariableAt(i)); 2063 body += LoadLocal(scope->VariableAt(i));
2056 body += StoreIndexed(kArrayCid); 2064 body += StoreIndexed(kArrayCid);
2057 body += Drop(); 2065 body += Drop();
2058 } 2066 }
2059 String& name = String::Handle(Z); 2067 String& name = String::Handle(Z);
2060 for (intptr_t i = 0; i < descriptor.NamedCount(); ++i) { 2068 for (intptr_t i = 0; i < descriptor.NamedCount(); ++i) {
2061 intptr_t parameter_index = descriptor.PositionalCount() + i; 2069 intptr_t parameter_index = descriptor.PositionalCount() + i;
2062 name = descriptor.NameAt(i); 2070 name = descriptor.NameAt(i);
2063 name = Symbols::New(H.thread(), name); 2071 name = Symbols::New(H.thread(), name);
2064 body += LoadLocal(array); 2072 body += LoadLocal(array);
2065 body += IntConstant(descriptor.PositionAt(i)); 2073 body += IntConstant(receiver_index + descriptor.PositionAt(i));
2066 body += LoadLocal(scope->VariableAt(parameter_index)); 2074 body += LoadLocal(scope->VariableAt(parameter_index));
2067 body += StoreIndexed(kArrayCid); 2075 body += StoreIndexed(kArrayCid);
2068 body += Drop(); 2076 body += Drop();
2069 } 2077 }
2070 body += PushArgument(); 2078 body += PushArgument();
2071 2079
2072 // Fourth, false indicating this is not a super NoSuchMethod. 2080 // Fourth, false indicating this is not a super NoSuchMethod.
2073 body += Constant(Bool::False()); 2081 body += Constant(Bool::False());
2074 body += PushArgument(); 2082 body += PushArgument();
2075 2083
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after
2414 array_object = AsSortedDuplicateFreeArray(&token_positions); 2422 array_object = AsSortedDuplicateFreeArray(&token_positions);
2415 script.set_debug_positions(array_object); 2423 script.set_debug_positions(array_object);
2416 array_object = AsSortedDuplicateFreeArray(&yield_positions); 2424 array_object = AsSortedDuplicateFreeArray(&yield_positions);
2417 script.set_yield_positions(array_object); 2425 script.set_yield_positions(array_object);
2418 } 2426 }
2419 2427
2420 } // namespace kernel 2428 } // namespace kernel
2421 } // namespace dart 2429 } // namespace dart
2422 2430
2423 #endif // !defined(DART_PRECOMPILED_RUNTIME) 2431 #endif // !defined(DART_PRECOMPILED_RUNTIME)
OLDNEW
« no previous file with comments | « runtime/vm/isolate_reload.cc ('k') | runtime/vm/native_entry.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698