Chromium Code Reviews| 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()); \ |
| + } \ |
|
siva
2013/04/18 22:48:33
I am wondering if you should be using Symbols::New
srdjan
2013/04/18 23:00:44
Done.
|
| + |
| + 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) { |