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 "lib/invocation_mirror.h" | 7 #include "lib/invocation_mirror.h" |
8 #include "vm/ast_printer.h" | 8 #include "vm/ast_printer.h" |
9 #include "vm/bit_vector.h" | 9 #include "vm/bit_vector.h" |
10 #include "vm/compiler.h" | 10 #include "vm/compiler.h" |
(...skipping 2638 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2649 Token::kILLEGAL, | 2649 Token::kILLEGAL, |
2650 arguments, | 2650 arguments, |
2651 node->arguments()->names(), | 2651 node->arguments()->names(), |
2652 1, | 2652 1, |
2653 owner()->ic_data_array()); | 2653 owner()->ic_data_array()); |
2654 ReturnDefinition(call); | 2654 ReturnDefinition(call); |
2655 } | 2655 } |
2656 } | 2656 } |
2657 | 2657 |
2658 | 2658 |
2659 static bool IsNativeListFactory(const Function& function) { | |
2660 switch (function.recognized_kind()) { | |
2661 case MethodRecognizer::kTypedData_Int8Array_factory: | |
2662 case MethodRecognizer::kTypedData_Uint8Array_factory: | |
2663 case MethodRecognizer::kTypedData_Uint8ClampedArray_factory: | |
2664 case MethodRecognizer::kTypedData_Int16Array_factory: | |
2665 case MethodRecognizer::kTypedData_Uint16Array_factory: | |
2666 case MethodRecognizer::kTypedData_Int32Array_factory: | |
2667 case MethodRecognizer::kTypedData_Uint32Array_factory: | |
2668 case MethodRecognizer::kTypedData_Int64Array_factory: | |
2669 case MethodRecognizer::kTypedData_Uint64Array_factory: | |
2670 case MethodRecognizer::kTypedData_Float32Array_factory: | |
2671 case MethodRecognizer::kTypedData_Float64Array_factory: | |
2672 case MethodRecognizer::kTypedData_Float32x4Array_factory: | |
2673 case MethodRecognizer::kTypedData_Int32x4Array_factory: | |
2674 case MethodRecognizer::kTypedData_Float64x2Array_factory: | |
2675 return true; | |
2676 default: | |
2677 break; | |
2678 } | |
2679 return false; | |
2680 } | |
2681 | |
2682 | |
2683 // <Expression> ::= StaticCall { function: Function | 2659 // <Expression> ::= StaticCall { function: Function |
2684 // arguments: <ArgumentList> } | 2660 // arguments: <ArgumentList> } |
2685 void EffectGraphVisitor::VisitStaticCallNode(StaticCallNode* node) { | 2661 void EffectGraphVisitor::VisitStaticCallNode(StaticCallNode* node) { |
2686 ZoneGrowableArray<PushArgumentInstr*>* arguments = | 2662 ZoneGrowableArray<PushArgumentInstr*>* arguments = |
2687 new(Z) ZoneGrowableArray<PushArgumentInstr*>(node->arguments()->length()); | 2663 new(Z) ZoneGrowableArray<PushArgumentInstr*>(node->arguments()->length()); |
2688 BuildPushArguments(*node->arguments(), arguments); | 2664 BuildPushArguments(*node->arguments(), arguments); |
2689 StaticCallInstr* call = | 2665 StaticCallInstr* call = |
2690 new(Z) StaticCallInstr(node->token_pos(), | 2666 new(Z) StaticCallInstr(node->token_pos(), |
2691 node->function(), | 2667 node->function(), |
2692 node->arguments()->names(), | 2668 node->arguments()->names(), |
2693 arguments, | 2669 arguments, |
2694 owner()->ic_data_array()); | 2670 owner()->ic_data_array()); |
2695 if (node->function().is_native() && IsNativeListFactory(node->function())) { | |
2696 call->set_is_native_list_factory(true); | |
2697 } | |
2698 if (node->function().recognized_kind() != MethodRecognizer::kUnknown) { | 2671 if (node->function().recognized_kind() != MethodRecognizer::kUnknown) { |
2699 call->set_result_cid(MethodRecognizer::ResultCid(node->function())); | 2672 call->set_result_cid(MethodRecognizer::ResultCid(node->function())); |
2700 } | 2673 } |
2701 ReturnDefinition(call); | 2674 ReturnDefinition(call); |
2702 } | 2675 } |
2703 | 2676 |
2704 | 2677 |
2705 void EffectGraphVisitor::BuildClosureCall( | 2678 void EffectGraphVisitor::BuildClosureCall( |
2706 ClosureCallNode* node, bool result_needed) { | 2679 ClosureCallNode* node, bool result_needed) { |
2707 ValueGraphVisitor for_closure(owner()); | 2680 ValueGraphVisitor for_closure(owner()); |
(...skipping 1917 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4625 block_marks); | 4598 block_marks); |
4626 ASSERT(found); | 4599 ASSERT(found); |
4627 } | 4600 } |
4628 | 4601 |
4629 | 4602 |
4630 void FlowGraphBuilder::Bailout(const char* reason) const { | 4603 void FlowGraphBuilder::Bailout(const char* reason) const { |
4631 parsed_function_.Bailout("FlowGraphBuilder", reason); | 4604 parsed_function_.Bailout("FlowGraphBuilder", reason); |
4632 } | 4605 } |
4633 | 4606 |
4634 } // namespace dart | 4607 } // namespace dart |
OLD | NEW |