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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/bootstrap_natives.h ('k') | runtime/vm/intrinsifier_x64.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/flow_graph_builder.cc
diff --git a/runtime/vm/flow_graph_builder.cc b/runtime/vm/flow_graph_builder.cc
index c97c353ecefcd0f63f953bda306cc197b90c0c12..c411bbd2d9033f4602c452340389059a3b4d8745 100644
--- a/runtime/vm/flow_graph_builder.cc
+++ b/runtime/vm/flow_graph_builder.cc
@@ -2673,30 +2673,37 @@ void EffectGraphVisitor::VisitInstanceCallNode(InstanceCallNode* node) {
static intptr_t GetResultCidOfNativeFactory(const Function& function) {
- const Class& function_class = Class::Handle(function.Owner());
- if (function_class.library() == Library::TypedDataLibrary()) {
- const String& function_name = String::Handle(function.name());
- if (!String::EqualsIgnoringPrivateKey(function_name, Symbols::_New())) {
- return kDynamicCid;
- }
- switch (function_class.id()) {
- case kTypedDataInt8ArrayCid:
- case kTypedDataUint8ArrayCid:
- case kTypedDataUint8ClampedArrayCid:
- case kTypedDataInt16ArrayCid:
- case kTypedDataUint16ArrayCid:
- case kTypedDataInt32ArrayCid:
- case kTypedDataUint32ArrayCid:
- case kTypedDataInt64ArrayCid:
- case kTypedDataUint64ArrayCid:
- case kTypedDataFloat32ArrayCid:
- case kTypedDataFloat64ArrayCid:
- case kTypedDataFloat32x4ArrayCid:
- case kTypedDataInt32x4ArrayCid:
- return function_class.id();
- default:
- return kDynamicCid; // Unknown.
- }
+ switch (function.recognized_kind()) {
+ case MethodRecognizer::kTypedData_Int8Array_factory:
+ return kTypedDataInt8ArrayCid;
+ case MethodRecognizer::kTypedData_Uint8Array_factory:
+ return kTypedDataUint8ArrayCid;
+ case MethodRecognizer::kTypedData_Uint8ClampedArray_factory:
+ return kTypedDataUint8ClampedArrayCid;
+ case MethodRecognizer::kTypedData_Int16Array_factory:
+ return kTypedDataInt16ArrayCid;
+ case MethodRecognizer::kTypedData_Uint16Array_factory:
+ return kTypedDataUint16ArrayCid;
+ case MethodRecognizer::kTypedData_Int32Array_factory:
+ return kTypedDataInt32ArrayCid;
+ case MethodRecognizer::kTypedData_Uint32Array_factory:
+ return kTypedDataUint32ArrayCid;
+ case MethodRecognizer::kTypedData_Int64Array_factory:
+ return kTypedDataInt64ArrayCid;
+ case MethodRecognizer::kTypedData_Uint64Array_factory:
+ return kTypedDataUint64ArrayCid;
+ case MethodRecognizer::kTypedData_Float32Array_factory:
+ return kTypedDataFloat32ArrayCid;
+ case MethodRecognizer::kTypedData_Float64Array_factory:
+ return kTypedDataFloat64ArrayCid;
+ case MethodRecognizer::kTypedData_Float32x4Array_factory:
+ return kTypedDataFloat32x4ArrayCid;
+ case MethodRecognizer::kTypedData_Int32x4Array_factory:
+ return kTypedDataInt32x4ArrayCid;
+ case MethodRecognizer::kTypedData_Float64x2Array_factory:
+ return kTypedDataFloat64x2ArrayCid;
+ default:
+ break;
}
return kDynamicCid;
}
« 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