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

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

Issue 2998803002: [kernel] Support for top-level generic functions. (Closed)
Patch Set: Fix test. Created 3 years, 4 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
« runtime/vm/kernel_to_il.h ('K') | « runtime/vm/kernel_to_il.h ('k') | no next file » | 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 776 matching lines...) Expand 10 before | Expand all | Expand 10 after
787 ASSERT(type_arguments_field_offset != dart::Class::kNoTypeArguments); 787 ASSERT(type_arguments_field_offset != dart::Class::kNoTypeArguments);
788 788
789 instructions += LoadLocal(scopes_->this_variable); 789 instructions += LoadLocal(scopes_->this_variable);
790 instructions += LoadField(type_arguments_field_offset); 790 instructions += LoadField(type_arguments_field_offset);
791 } else { 791 } else {
792 instructions += NullConstant(); 792 instructions += NullConstant();
793 } 793 }
794 return instructions; 794 return instructions;
795 } 795 }
796 796
797 // KERNEL_GENERIC_METHODS_UNDONE(sjindel): This seems to work for static
jensj 2017/08/11 06:24:55 todo?
sjindel 2017/08/14 11:05:49 Done.
798 // top-level functions, but probably needs to be revisited when generic methods
799 // are fully supported in kernel.
797 Fragment FlowGraphBuilder::LoadFunctionTypeArguments() { 800 Fragment FlowGraphBuilder::LoadFunctionTypeArguments() {
798 UNIMPLEMENTED(); // TODO(regis) 801 Fragment instructions;
799 return Fragment(NULL); 802 ASSERT(parsed_function_->function_type_arguments() != NULL);
803 instructions += LoadLocal(parsed_function_->function_type_arguments());
804 return instructions;
800 } 805 }
801 806
802 Fragment FlowGraphBuilder::InstantiateType(const AbstractType& type) { 807 Fragment FlowGraphBuilder::InstantiateType(const AbstractType& type) {
803 Value* function_type_args = Pop(); 808 Value* function_type_args = Pop();
804 Value* instantiator_type_args = Pop(); 809 Value* instantiator_type_args = Pop();
805 InstantiateTypeInstr* instr = new (Z) InstantiateTypeInstr( 810 InstantiateTypeInstr* instr = new (Z) InstantiateTypeInstr(
806 TokenPosition::kNoSource, type, instantiator_type_args, 811 TokenPosition::kNoSource, type, instantiator_type_args,
807 function_type_args, GetNextDeoptId()); 812 function_type_args, GetNextDeoptId());
808 Push(instr); 813 Push(instr);
809 return Fragment(instr); 814 return Fragment(instr);
(...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after
1279 (function.name() == Symbols::ListFactory().raw())) { 1284 (function.name() == Symbols::ListFactory().raw())) {
1280 ASSERT(argument_count == 1 || argument_count == 2); 1285 ASSERT(argument_count == 1 || argument_count == 2);
1281 return (argument_count == 1) ? kGrowableObjectArrayCid : kArrayCid; 1286 return (argument_count == 1) ? kGrowableObjectArrayCid : kArrayCid;
1282 } 1287 }
1283 return FactoryRecognizer::ResultCid(function); 1288 return FactoryRecognizer::ResultCid(function);
1284 } 1289 }
1285 1290
1286 Fragment FlowGraphBuilder::StaticCall(TokenPosition position, 1291 Fragment FlowGraphBuilder::StaticCall(TokenPosition position,
1287 const Function& target, 1292 const Function& target,
1288 intptr_t argument_count, 1293 intptr_t argument_count,
1289 const Array& argument_names) { 1294 const Array& argument_names,
1295 intptr_t type_args_count) {
1290 ArgumentArray arguments = GetArguments(argument_count); 1296 ArgumentArray arguments = GetArguments(argument_count);
1291 const intptr_t kTypeArgsLen = 0; // Generic static calls not yet supported.
1292 StaticCallInstr* call = 1297 StaticCallInstr* call =
1293 new (Z) StaticCallInstr(position, target, kTypeArgsLen, argument_names, 1298 new (Z) StaticCallInstr(position, target, type_args_count, argument_names,
1294 arguments, ic_data_array_, GetNextDeoptId()); 1299 arguments, ic_data_array_, GetNextDeoptId());
1295 const intptr_t list_cid = 1300 const intptr_t list_cid =
1296 GetResultCidOfListFactory(Z, target, argument_count); 1301 GetResultCidOfListFactory(Z, target, argument_count);
1297 if (list_cid != kDynamicCid) { 1302 if (list_cid != kDynamicCid) {
1298 call->set_result_cid(list_cid); 1303 call->set_result_cid(list_cid);
1299 call->set_is_known_list_constructor(true); 1304 call->set_is_known_list_constructor(true);
1300 } else if (target.recognized_kind() != MethodRecognizer::kUnknown) { 1305 } else if (target.recognized_kind() != MethodRecognizer::kUnknown) {
1301 call->set_result_cid(MethodRecognizer::ResultCid(target)); 1306 call->set_result_cid(MethodRecognizer::ResultCid(target));
1302 } 1307 }
1303 Push(call); 1308 Push(call);
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
1564 Value* value = stack_; 1569 Value* value = stack_;
1565 stack_ = value->next_use(); 1570 stack_ = value->next_use();
1566 if (stack_ != NULL) stack_->set_previous_use(NULL); 1571 if (stack_ != NULL) stack_->set_previous_use(NULL);
1567 1572
1568 value->set_next_use(NULL); 1573 value->set_next_use(NULL);
1569 value->set_previous_use(NULL); 1574 value->set_previous_use(NULL);
1570 value->definition()->ClearSSATempIndex(); 1575 value->definition()->ClearSSATempIndex();
1571 return value; 1576 return value;
1572 } 1577 }
1573 1578
1579 intptr_t FlowGraphBuilder::StackDepth() {
jensj 2017/08/11 06:24:55 I don't think this method is actually used.
sjindel 2017/08/11 09:21:06 It's not -- I found it useful for debugging, so I
jensj 2017/08/14 06:47:13 While that's fine for developing, I don't think we
sjindel 2017/08/14 11:05:50 Done.
1580 intptr_t depth = 0;
1581 for (Value* value = stack_; value; value = value->next_use()) {
1582 ++depth;
1583 }
1584 return depth;
1585 }
1586
1574 Fragment FlowGraphBuilder::Drop() { 1587 Fragment FlowGraphBuilder::Drop() {
1575 ASSERT(stack_ != NULL); 1588 ASSERT(stack_ != NULL);
1576 Fragment instructions; 1589 Fragment instructions;
1577 Definition* definition = stack_->definition(); 1590 Definition* definition = stack_->definition();
1578 // The SSA renaming implementation doesn't like [LoadLocal]s without a 1591 // The SSA renaming implementation doesn't like [LoadLocal]s without a
1579 // tempindex. 1592 // tempindex.
1580 if (definition->HasSSATemp() || definition->IsLoadLocal()) { 1593 if (definition->HasSSATemp() || definition->IsLoadLocal()) {
1581 instructions <<= new (Z) DropTempsInstr(1, NULL); 1594 instructions <<= new (Z) DropTempsInstr(1, NULL);
1582 } else { 1595 } else {
1583 definition->ClearTempIndex(); 1596 definition->ClearTempIndex();
(...skipping 790 matching lines...) Expand 10 before | Expand all | Expand 10 after
2374 StreamingFlowGraphBuilder streaming_flow_graph_builder( 2387 StreamingFlowGraphBuilder streaming_flow_graph_builder(
2375 &helper, zone_, script.kernel_data(), script.kernel_data_size()); 2388 &helper, zone_, script.kernel_data(), script.kernel_data_size());
2376 return streaming_flow_graph_builder.GetLineStartsFor( 2389 return streaming_flow_graph_builder.GetLineStartsFor(
2377 script.kernel_script_index()); 2390 script.kernel_script_index());
2378 } 2391 }
2379 2392
2380 } // namespace kernel 2393 } // namespace kernel
2381 } // namespace dart 2394 } // namespace dart
2382 2395
2383 #endif // !defined(DART_PRECOMPILED_RUNTIME) 2396 #endif // !defined(DART_PRECOMPILED_RUNTIME)
OLDNEW
« runtime/vm/kernel_to_il.h ('K') | « runtime/vm/kernel_to_il.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698