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

Unified Diff: runtime/vm/object.cc

Issue 14247005: Add flag --check-function-fingerprints, it checks all function fingerprints of the intrinsifier and… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 8 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
Index: runtime/vm/object.cc
===================================================================
--- runtime/vm/object.cc (revision 21695)
+++ runtime/vm/object.cc (working copy)
@@ -25,6 +25,7 @@
#include "vm/exceptions.h"
#include "vm/growable_array.h"
#include "vm/heap.h"
+#include "vm/intermediate_language.h"
#include "vm/intrinsifier.h"
#include "vm/object_store.h"
#include "vm/parser.h"
@@ -6859,6 +6860,54 @@
}
+void Library::CheckFunctionFingerprints() {
+ Library& lib = Library::Handle();
+ Class& cls = Class::Handle();
+ Function& func = Function::Handle();
+ String& str = String::Handle();
+ bool has_errors = false;
+
+#define CHECK_FINGERPRINTS(class_name, function_name, dest, fp) \
+ func = Function::null(); \
+ if (strcmp(#class_name, "::") == 0) { \
+ str = String::New(#function_name); \
+ func = lib.LookupFunctionAllowPrivate(str); \
+ } else { \
+ str = String::New(#class_name); \
+ cls = lib.LookupClassAllowPrivate(str); \
+ if (!cls.IsNull()) { \
+ if (#function_name[0] == '.') { \
+ str = String::New(#class_name#function_name); \
+ } else { \
+ str = String::New(#function_name); \
+ } \
+ func = cls.LookupFunctionAllowPrivate(str); \
+ } \
+ } \
+ if (!func.IsNull() && (func.SourceFingerprint() != fp)) { \
+ has_errors = true; \
+ OS::Print("Wrong fingerprint for '%s': expecting %d found %d\n", \
+ func.ToFullyQualifiedCString(), fp, func.SourceFingerprint()); \
+ } \
+
+ lib = Library::CoreLibrary();
+ CORE_LIB_INTRINSIC_LIST(CHECK_FINGERPRINTS);
+
+ RECOGNIZED_LIST(CHECK_FINGERPRINTS);
+
+ lib = Library::MathLibrary();
+ MATH_LIB_INTRINSIC_LIST(CHECK_FINGERPRINTS);
+
+ lib = Library::TypedDataLibrary();
+ TYPEDDATA_LIB_INTRINSIC_LIST(CHECK_FINGERPRINTS);
+
+#undef CHECK_FINGERPRINTS
+ if (has_errors) {
+ FATAL("Fingerprint mismatch.");
+ }
+}
+
+
RawInstructions* Instructions::New(intptr_t size) {
ASSERT(Object::instructions_class() != Class::null());
if (size < 0 || size > kMaxElements) {

Powered by Google App Engine
This is Rietveld 408576698