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

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

Issue 2859673002: Pass type argument vector to generic functions (if --reify-generic-functions is (Closed)
Patch Set: Created 3 years, 7 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
OLDNEW
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/globals.h" // Needed here to get TARGET_ARCH_XXX. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_XXX.
6 6
7 #include "vm/flow_graph_compiler.h" 7 #include "vm/flow_graph_compiler.h"
8 8
9 #include "vm/bit_vector.h" 9 #include "vm/bit_vector.h"
10 #include "vm/cha.h" 10 #include "vm/cha.h"
(...skipping 1179 matching lines...) Expand 10 before | Expand all | Expand 10 after
1190 break; 1190 break;
1191 default: 1191 default:
1192 UNIMPLEMENTED(); 1192 UNIMPLEMENTED();
1193 } 1193 }
1194 } 1194 }
1195 1195
1196 1196
1197 void FlowGraphCompiler::GenerateStaticCall(intptr_t deopt_id, 1197 void FlowGraphCompiler::GenerateStaticCall(intptr_t deopt_id,
1198 TokenPosition token_pos, 1198 TokenPosition token_pos,
1199 const Function& function, 1199 const Function& function,
1200 intptr_t type_args_len,
Vyacheslav Egorov (Google) 2017/05/04 12:12:22 I wonder if triple of <type-args-len, pushed_argc,
regis 2017/05/09 18:31:23 Done.
1200 intptr_t argument_count, 1201 intptr_t argument_count,
1201 const Array& argument_names, 1202 const Array& argument_names,
1202 LocationSummary* locs, 1203 LocationSummary* locs,
1203 const ICData& ic_data_in) { 1204 const ICData& ic_data_in) {
1204 const ICData& ic_data = ICData::ZoneHandle(ic_data_in.Original()); 1205 const ICData& ic_data = ICData::ZoneHandle(ic_data_in.Original());
1205 const Array& arguments_descriptor = 1206 const Array& arguments_descriptor = Array::ZoneHandle(
1206 Array::ZoneHandle(ic_data.IsNull() ? ArgumentsDescriptor::New( 1207 ic_data.IsNull()
1207 argument_count, argument_names) 1208 ? ArgumentsDescriptor::New(
1208 : ic_data.arguments_descriptor()); 1209 type_args_len, argument_count - (type_args_len > 0 ? 1 : 0),
1210 argument_names)
1211 : ic_data.arguments_descriptor());
1209 if (is_optimizing()) { 1212 if (is_optimizing()) {
1210 EmitOptimizedStaticCall(function, arguments_descriptor, argument_count, 1213 EmitOptimizedStaticCall(function, arguments_descriptor, argument_count,
1211 deopt_id, token_pos, locs); 1214 deopt_id, token_pos, locs);
1212 } else { 1215 } else {
1213 ICData& call_ic_data = ICData::ZoneHandle(ic_data.raw()); 1216 ICData& call_ic_data = ICData::ZoneHandle(ic_data.raw());
1214 if (call_ic_data.IsNull()) { 1217 if (call_ic_data.IsNull()) {
1215 const intptr_t kNumArgsChecked = 0; 1218 const intptr_t kNumArgsChecked = 0;
1216 call_ic_data = 1219 call_ic_data =
1217 GetOrAddStaticCallICData(deopt_id, function, arguments_descriptor, 1220 GetOrAddStaticCallICData(deopt_id, function, arguments_descriptor,
1218 kNumArgsChecked) 1221 kNumArgsChecked)
(...skipping 617 matching lines...) Expand 10 before | Expand all | Expand 10 after
1836 return true; 1839 return true;
1837 } 1840 }
1838 1841
1839 1842
1840 #if !defined(TARGET_ARCH_DBC) 1843 #if !defined(TARGET_ARCH_DBC)
1841 // DBC emits calls very differently from other architectures due to its 1844 // DBC emits calls very differently from other architectures due to its
1842 // interpreted nature. 1845 // interpreted nature.
1843 void FlowGraphCompiler::EmitPolymorphicInstanceCall( 1846 void FlowGraphCompiler::EmitPolymorphicInstanceCall(
1844 const CallTargets& targets, 1847 const CallTargets& targets,
1845 const InstanceCallInstr& original_call, 1848 const InstanceCallInstr& original_call,
1849 intptr_t type_args_len,
1846 intptr_t argument_count, 1850 intptr_t argument_count,
1847 const Array& argument_names, 1851 const Array& argument_names,
1848 intptr_t deopt_id, 1852 intptr_t deopt_id,
1849 TokenPosition token_pos, 1853 TokenPosition token_pos,
1850 LocationSummary* locs, 1854 LocationSummary* locs,
1851 bool complete, 1855 bool complete,
1852 intptr_t total_ic_calls) { 1856 intptr_t total_ic_calls) {
1853 if (FLAG_polymorphic_with_deopt) { 1857 if (FLAG_polymorphic_with_deopt) {
1854 Label* deopt = 1858 Label* deopt =
1855 AddDeoptStub(deopt_id, ICData::kDeoptPolymorphicInstanceCallTestFail); 1859 AddDeoptStub(deopt_id, ICData::kDeoptPolymorphicInstanceCallTestFail);
1856 Label ok; 1860 Label ok;
1857 EmitTestAndCall(targets, original_call.function_name(), argument_count, 1861 EmitTestAndCall(targets, original_call.function_name(), type_args_len,
1858 argument_names, 1862 argument_count, argument_names,
1859 deopt, // No cid match. 1863 deopt, // No cid match.
1860 &ok, // Found cid. 1864 &ok, // Found cid.
1861 deopt_id, token_pos, locs, complete, total_ic_calls); 1865 deopt_id, token_pos, locs, complete, total_ic_calls);
1862 assembler()->Bind(&ok); 1866 assembler()->Bind(&ok);
1863 } else { 1867 } else {
1864 if (complete) { 1868 if (complete) {
1865 Label ok; 1869 Label ok;
1866 EmitTestAndCall(targets, original_call.function_name(), argument_count, 1870 EmitTestAndCall(targets, original_call.function_name(), type_args_len,
1867 argument_names, 1871 argument_count, argument_names,
1868 NULL, // No cid match. 1872 NULL, // No cid match.
1869 &ok, // Found cid. 1873 &ok, // Found cid.
1870 deopt_id, token_pos, locs, true, total_ic_calls); 1874 deopt_id, token_pos, locs, true, total_ic_calls);
1871 assembler()->Bind(&ok); 1875 assembler()->Bind(&ok);
1872 } else { 1876 } else {
1873 const ICData& unary_checks = ICData::ZoneHandle( 1877 const ICData& unary_checks = ICData::ZoneHandle(
1874 zone(), original_call.ic_data()->AsUnaryClassChecks()); 1878 zone(), original_call.ic_data()->AsUnaryClassChecks());
1875 EmitSwitchableInstanceCall(unary_checks, argument_count, deopt_id, 1879 EmitSwitchableInstanceCall(unary_checks, argument_count, deopt_id,
1876 token_pos, locs); 1880 token_pos, locs);
1877 } 1881 }
1878 } 1882 }
1879 } 1883 }
1880 1884
1881 1885
1882 #define __ assembler()-> 1886 #define __ assembler()->
1883 void FlowGraphCompiler::EmitTestAndCall(const CallTargets& targets, 1887 void FlowGraphCompiler::EmitTestAndCall(const CallTargets& targets,
1884 const String& function_name, 1888 const String& function_name,
1889 intptr_t type_args_len,
1885 intptr_t argument_count, 1890 intptr_t argument_count,
1886 const Array& argument_names, 1891 const Array& argument_names,
1887 Label* failed, 1892 Label* failed,
1888 Label* match_found, 1893 Label* match_found,
1889 intptr_t deopt_id, 1894 intptr_t deopt_id,
1890 TokenPosition token_index, 1895 TokenPosition token_index,
1891 LocationSummary* locs, 1896 LocationSummary* locs,
1892 bool complete, 1897 bool complete,
1893 intptr_t total_ic_calls) { 1898 intptr_t total_ic_calls) {
1894 ASSERT(is_optimizing()); 1899 ASSERT(is_optimizing());
1895 1900
1896 const Array& arguments_descriptor = Array::ZoneHandle( 1901 const Array& arguments_descriptor = Array::ZoneHandle(
1897 zone(), ArgumentsDescriptor::New(argument_count, argument_names)); 1902 zone(), ArgumentsDescriptor::New(
1903 type_args_len, argument_count - (type_args_len > 0 ? 1 : 0),
1904 argument_names));
1898 1905
1899 EmitTestAndCallLoadReceiver(argument_count, arguments_descriptor); 1906 EmitTestAndCallLoadReceiver(argument_count, arguments_descriptor);
1900 1907
1901 static const int kNoCase = -1; 1908 static const int kNoCase = -1;
1902 int smi_case = kNoCase; 1909 int smi_case = kNoCase;
1903 int which_case_to_skip = kNoCase; 1910 int which_case_to_skip = kNoCase;
1904 1911
1905 const int length = targets.length(); 1912 const int length = targets.length();
1906 ASSERT(length > 0); 1913 ASSERT(length > 0);
1907 int non_smi_length = length; 1914 int non_smi_length = length;
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
2069 2076
2070 2077
2071 void FlowGraphCompiler::FrameStateClear() { 2078 void FlowGraphCompiler::FrameStateClear() {
2072 ASSERT(!is_optimizing()); 2079 ASSERT(!is_optimizing());
2073 frame_state_.TruncateTo(0); 2080 frame_state_.TruncateTo(0);
2074 } 2081 }
2075 #endif // defined(DEBUG) && !defined(TARGET_ARCH_DBC) 2082 #endif // defined(DEBUG) && !defined(TARGET_ARCH_DBC)
2076 2083
2077 2084
2078 } // namespace dart 2085 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698