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

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

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

Powered by Google App Engine
This is Rietveld 408576698