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

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

Issue 1782003002: Simplify the VM's typed_data constructors. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: added comment Created 4 years, 9 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
« no previous file with comments | « runtime/vm/bootstrap_natives.h ('k') | runtime/vm/intrinsifier_x64.cc » ('j') | 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) 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 2655 matching lines...) Expand 10 before | Expand all | Expand 10 after
2666 arguments, 2666 arguments,
2667 node->arguments()->names(), 2667 node->arguments()->names(),
2668 1, 2668 1,
2669 owner()->ic_data_array()); 2669 owner()->ic_data_array());
2670 ReturnDefinition(call); 2670 ReturnDefinition(call);
2671 } 2671 }
2672 } 2672 }
2673 2673
2674 2674
2675 static intptr_t GetResultCidOfNativeFactory(const Function& function) { 2675 static intptr_t GetResultCidOfNativeFactory(const Function& function) {
2676 const Class& function_class = Class::Handle(function.Owner()); 2676 switch (function.recognized_kind()) {
2677 if (function_class.library() == Library::TypedDataLibrary()) { 2677 case MethodRecognizer::kTypedData_Int8Array_factory:
2678 const String& function_name = String::Handle(function.name()); 2678 return kTypedDataInt8ArrayCid;
2679 if (!String::EqualsIgnoringPrivateKey(function_name, Symbols::_New())) { 2679 case MethodRecognizer::kTypedData_Uint8Array_factory:
2680 return kDynamicCid; 2680 return kTypedDataUint8ArrayCid;
2681 } 2681 case MethodRecognizer::kTypedData_Uint8ClampedArray_factory:
2682 switch (function_class.id()) { 2682 return kTypedDataUint8ClampedArrayCid;
2683 case kTypedDataInt8ArrayCid: 2683 case MethodRecognizer::kTypedData_Int16Array_factory:
2684 case kTypedDataUint8ArrayCid: 2684 return kTypedDataInt16ArrayCid;
2685 case kTypedDataUint8ClampedArrayCid: 2685 case MethodRecognizer::kTypedData_Uint16Array_factory:
2686 case kTypedDataInt16ArrayCid: 2686 return kTypedDataUint16ArrayCid;
2687 case kTypedDataUint16ArrayCid: 2687 case MethodRecognizer::kTypedData_Int32Array_factory:
2688 case kTypedDataInt32ArrayCid: 2688 return kTypedDataInt32ArrayCid;
2689 case kTypedDataUint32ArrayCid: 2689 case MethodRecognizer::kTypedData_Uint32Array_factory:
2690 case kTypedDataInt64ArrayCid: 2690 return kTypedDataUint32ArrayCid;
2691 case kTypedDataUint64ArrayCid: 2691 case MethodRecognizer::kTypedData_Int64Array_factory:
2692 case kTypedDataFloat32ArrayCid: 2692 return kTypedDataInt64ArrayCid;
2693 case kTypedDataFloat64ArrayCid: 2693 case MethodRecognizer::kTypedData_Uint64Array_factory:
2694 case kTypedDataFloat32x4ArrayCid: 2694 return kTypedDataUint64ArrayCid;
2695 case kTypedDataInt32x4ArrayCid: 2695 case MethodRecognizer::kTypedData_Float32Array_factory:
2696 return function_class.id(); 2696 return kTypedDataFloat32ArrayCid;
2697 default: 2697 case MethodRecognizer::kTypedData_Float64Array_factory:
2698 return kDynamicCid; // Unknown. 2698 return kTypedDataFloat64ArrayCid;
2699 } 2699 case MethodRecognizer::kTypedData_Float32x4Array_factory:
2700 return kTypedDataFloat32x4ArrayCid;
2701 case MethodRecognizer::kTypedData_Int32x4Array_factory:
2702 return kTypedDataInt32x4ArrayCid;
2703 case MethodRecognizer::kTypedData_Float64x2Array_factory:
2704 return kTypedDataFloat64x2ArrayCid;
2705 default:
2706 break;
2700 } 2707 }
2701 return kDynamicCid; 2708 return kDynamicCid;
2702 } 2709 }
2703 2710
2704 2711
2705 // <Expression> ::= StaticCall { function: Function 2712 // <Expression> ::= StaticCall { function: Function
2706 // arguments: <ArgumentList> } 2713 // arguments: <ArgumentList> }
2707 void EffectGraphVisitor::VisitStaticCallNode(StaticCallNode* node) { 2714 void EffectGraphVisitor::VisitStaticCallNode(StaticCallNode* node) {
2708 ZoneGrowableArray<PushArgumentInstr*>* arguments = 2715 ZoneGrowableArray<PushArgumentInstr*>* arguments =
2709 new(Z) ZoneGrowableArray<PushArgumentInstr*>(node->arguments()->length()); 2716 new(Z) ZoneGrowableArray<PushArgumentInstr*>(node->arguments()->length());
(...skipping 1944 matching lines...) Expand 10 before | Expand all | Expand 10 after
4654 Script::Handle(function.script()), 4661 Script::Handle(function.script()),
4655 function.token_pos(), 4662 function.token_pos(),
4656 Report::AtLocation, 4663 Report::AtLocation,
4657 "FlowGraphBuilder Bailout: %s %s", 4664 "FlowGraphBuilder Bailout: %s %s",
4658 String::Handle(function.name()).ToCString(), 4665 String::Handle(function.name()).ToCString(),
4659 reason); 4666 reason);
4660 UNREACHABLE(); 4667 UNREACHABLE();
4661 } 4668 }
4662 4669
4663 } // namespace dart 4670 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/bootstrap_natives.h ('k') | runtime/vm/intrinsifier_x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698