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

Unified Diff: runtime/vm/intermediate_language.cc

Issue 25050004: Add a is_recognized bit to function kind field. Improves performance of method recognizer and thus … (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 3 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/intermediate_language.h ('k') | runtime/vm/object.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/intermediate_language.cc
===================================================================
--- runtime/vm/intermediate_language.cc (revision 28022)
+++ runtime/vm/intermediate_language.cc (working copy)
@@ -362,12 +362,12 @@
MethodRecognizer::Kind MethodRecognizer::RecognizeKind(
const Function& function) {
- const Class& function_class = Class::Handle(function.Owner());
- const Library& lib = Library::Handle(function_class.library());
- if (!IsRecognizedLibrary(lib)) {
+ if (!function.is_recognized()) {
return kUnknown;
}
+ const Class& function_class = Class::Handle(function.Owner());
+ const Library& lib = Library::Handle(function_class.library());
const String& function_name = String::Handle(function.name());
const String& class_name = String::Handle(function_class.Name());
@@ -379,6 +379,7 @@
}
RECOGNIZED_LIST(RECOGNIZE_FUNCTION)
#undef RECOGNIZE_FUNCTION
+ UNREACHABLE();
return kUnknown;
}
@@ -414,7 +415,25 @@
}
+void MethodRecognizer::InitializeState() {
+ GrowableArray<Library*> libs(3);
+ libs.Add(&Library::ZoneHandle(Library::CoreLibrary()));
+ libs.Add(&Library::ZoneHandle(Library::MathLibrary()));
+ libs.Add(&Library::ZoneHandle(Library::TypedDataLibrary()));
+ Function& func = Function::Handle();
+
+#define SET_IS_RECOGNIZED(class_name, function_name, dest, fp) \
+ func = Library::GetFunction(libs, #class_name, #function_name); \
+ ASSERT(!func.IsNull()); \
+ func.set_is_recognized(true); \
+
+ RECOGNIZED_LIST(SET_IS_RECOGNIZED);
+
+#undef SET_IS_RECOGNIZED
+}
+
// ==== Support for visiting flow graphs.
+
#define DEFINE_ACCEPT(ShortName) \
void ShortName##Instr::Accept(FlowGraphVisitor* visitor) { \
visitor->Visit##ShortName(this); \
« no previous file with comments | « runtime/vm/intermediate_language.h ('k') | runtime/vm/object.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698