| 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 2594 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2605 Token::kILLEGAL, | 2605 Token::kILLEGAL, |
| 2606 arguments, | 2606 arguments, |
| 2607 node->arguments()->names(), | 2607 node->arguments()->names(), |
| 2608 1, | 2608 1, |
| 2609 owner()->ic_data_array()); | 2609 owner()->ic_data_array()); |
| 2610 ReturnDefinition(call); | 2610 ReturnDefinition(call); |
| 2611 } | 2611 } |
| 2612 } | 2612 } |
| 2613 | 2613 |
| 2614 | 2614 |
| 2615 static bool IsNativeListFactory(const Function& function) { | 2615 static intptr_t GetResultCidOfNativeFactory(const Function& function) { |
| 2616 switch (function.recognized_kind()) { | 2616 switch (function.recognized_kind()) { |
| 2617 case MethodRecognizer::kTypedData_Int8Array_factory: | 2617 case MethodRecognizer::kTypedData_Int8Array_factory: |
| 2618 return kTypedDataInt8ArrayCid; |
| 2618 case MethodRecognizer::kTypedData_Uint8Array_factory: | 2619 case MethodRecognizer::kTypedData_Uint8Array_factory: |
| 2620 return kTypedDataUint8ArrayCid; |
| 2619 case MethodRecognizer::kTypedData_Uint8ClampedArray_factory: | 2621 case MethodRecognizer::kTypedData_Uint8ClampedArray_factory: |
| 2622 return kTypedDataUint8ClampedArrayCid; |
| 2620 case MethodRecognizer::kTypedData_Int16Array_factory: | 2623 case MethodRecognizer::kTypedData_Int16Array_factory: |
| 2624 return kTypedDataInt16ArrayCid; |
| 2621 case MethodRecognizer::kTypedData_Uint16Array_factory: | 2625 case MethodRecognizer::kTypedData_Uint16Array_factory: |
| 2626 return kTypedDataUint16ArrayCid; |
| 2622 case MethodRecognizer::kTypedData_Int32Array_factory: | 2627 case MethodRecognizer::kTypedData_Int32Array_factory: |
| 2628 return kTypedDataInt32ArrayCid; |
| 2623 case MethodRecognizer::kTypedData_Uint32Array_factory: | 2629 case MethodRecognizer::kTypedData_Uint32Array_factory: |
| 2630 return kTypedDataUint32ArrayCid; |
| 2624 case MethodRecognizer::kTypedData_Int64Array_factory: | 2631 case MethodRecognizer::kTypedData_Int64Array_factory: |
| 2632 return kTypedDataInt64ArrayCid; |
| 2625 case MethodRecognizer::kTypedData_Uint64Array_factory: | 2633 case MethodRecognizer::kTypedData_Uint64Array_factory: |
| 2634 return kTypedDataUint64ArrayCid; |
| 2626 case MethodRecognizer::kTypedData_Float32Array_factory: | 2635 case MethodRecognizer::kTypedData_Float32Array_factory: |
| 2636 return kTypedDataFloat32ArrayCid; |
| 2627 case MethodRecognizer::kTypedData_Float64Array_factory: | 2637 case MethodRecognizer::kTypedData_Float64Array_factory: |
| 2638 return kTypedDataFloat64ArrayCid; |
| 2628 case MethodRecognizer::kTypedData_Float32x4Array_factory: | 2639 case MethodRecognizer::kTypedData_Float32x4Array_factory: |
| 2640 return kTypedDataFloat32x4ArrayCid; |
| 2629 case MethodRecognizer::kTypedData_Int32x4Array_factory: | 2641 case MethodRecognizer::kTypedData_Int32x4Array_factory: |
| 2642 return kTypedDataInt32x4ArrayCid; |
| 2630 case MethodRecognizer::kTypedData_Float64x2Array_factory: | 2643 case MethodRecognizer::kTypedData_Float64x2Array_factory: |
| 2631 return true; | 2644 return kTypedDataFloat64x2ArrayCid; |
| 2632 default: | 2645 default: |
| 2633 break; | 2646 break; |
| 2634 } | 2647 } |
| 2635 return false; | 2648 return kDynamicCid; |
| 2636 } | 2649 } |
| 2637 | 2650 |
| 2638 | 2651 |
| 2639 // <Expression> ::= StaticCall { function: Function | 2652 // <Expression> ::= StaticCall { function: Function |
| 2640 // arguments: <ArgumentList> } | 2653 // arguments: <ArgumentList> } |
| 2641 void EffectGraphVisitor::VisitStaticCallNode(StaticCallNode* node) { | 2654 void EffectGraphVisitor::VisitStaticCallNode(StaticCallNode* node) { |
| 2642 ZoneGrowableArray<PushArgumentInstr*>* arguments = | 2655 ZoneGrowableArray<PushArgumentInstr*>* arguments = |
| 2643 new(Z) ZoneGrowableArray<PushArgumentInstr*>(node->arguments()->length()); | 2656 new(Z) ZoneGrowableArray<PushArgumentInstr*>(node->arguments()->length()); |
| 2644 BuildPushArguments(*node->arguments(), arguments); | 2657 BuildPushArguments(*node->arguments(), arguments); |
| 2645 StaticCallInstr* call = | 2658 StaticCallInstr* call = |
| 2646 new(Z) StaticCallInstr(node->token_pos(), | 2659 new(Z) StaticCallInstr(node->token_pos(), |
| 2647 node->function(), | 2660 node->function(), |
| 2648 node->arguments()->names(), | 2661 node->arguments()->names(), |
| 2649 arguments, | 2662 arguments, |
| 2650 owner()->ic_data_array()); | 2663 owner()->ic_data_array()); |
| 2651 if (node->function().is_native() && IsNativeListFactory(node->function())) { | 2664 if (node->function().is_native()) { |
| 2652 call->set_is_native_list_factory(true); | 2665 const intptr_t result_cid = GetResultCidOfNativeFactory(node->function()); |
| 2653 } | 2666 if (result_cid != kDynamicCid) { |
| 2654 if (node->function().recognized_kind() != MethodRecognizer::kUnknown) { | 2667 call->set_result_cid(result_cid); |
| 2655 call->set_result_cid(MethodRecognizer::ResultCid(node->function())); | 2668 call->set_is_native_list_factory(true); |
| 2669 } |
| 2656 } | 2670 } |
| 2657 ReturnDefinition(call); | 2671 ReturnDefinition(call); |
| 2658 } | 2672 } |
| 2659 | 2673 |
| 2660 | 2674 |
| 2661 void EffectGraphVisitor::BuildClosureCall( | 2675 void EffectGraphVisitor::BuildClosureCall( |
| 2662 ClosureCallNode* node, bool result_needed) { | 2676 ClosureCallNode* node, bool result_needed) { |
| 2663 ValueGraphVisitor for_closure(owner()); | 2677 ValueGraphVisitor for_closure(owner()); |
| 2664 node->closure()->Visit(&for_closure); | 2678 node->closure()->Visit(&for_closure); |
| 2665 Append(for_closure); | 2679 Append(for_closure); |
| (...skipping 1912 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4578 block_marks); | 4592 block_marks); |
| 4579 ASSERT(found); | 4593 ASSERT(found); |
| 4580 } | 4594 } |
| 4581 | 4595 |
| 4582 | 4596 |
| 4583 void FlowGraphBuilder::Bailout(const char* reason) const { | 4597 void FlowGraphBuilder::Bailout(const char* reason) const { |
| 4584 parsed_function_.Bailout("FlowGraphBuilder", reason); | 4598 parsed_function_.Bailout("FlowGraphBuilder", reason); |
| 4585 } | 4599 } |
| 4586 | 4600 |
| 4587 } // namespace dart | 4601 } // namespace dart |
| OLD | NEW |